Pages

joi, 20 noiembrie 2025

Google Apps Script : keep sheets whose names include today’s date ...

Today, this simple example will keep sheets whose names include today’s date in flexible regex formats
The script not include the month names (e.g., “20-Nov-2025”)
On running keeps sheets whose names contain any of these combinations; deletes the rest.
Let's see the source code:
function deleteSheetsWithoutToday() {
// Get today's components (zero-padded and variants)
var now = new Date();
var tz = Session.getScriptTimeZone();

var dd = Utilities.formatDate(now, tz, "dd"); // e.g., "20"
var d = Utilities.formatDate(now, tz, "d"); // e.g., "20" (no leading zero if <10)
var mm = Utilities.formatDate(now, tz, "MM"); // e.g., "11"
var m = Utilities.formatDate(now, tz, "M"); // e.g., "11" (no leading zero if <10)
var yyyy = Utilities.formatDate(now, tz, "yyyy"); // e.g., "2025"
var yy = Utilities.formatDate(now, tz, "yy"); // e.g., "25"

// Build a regex that matches many possible date embeddings in the sheet name
var dateRegex = buildFlexibleDateRegex({ dd: dd, d: d, mm: mm, m: m, yyyy: yyyy, yy: yy });

// Active spreadsheet
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheets = ss.getSheets();

var kept = 0;
var deleted = 0;

sheets.forEach(function(sheet) {
var name = sheet.getName();

// If the name contains a combination of today's date components (any of the supported formats), keep it
if (dateRegex.test(name)) {
kept++;
Logger.log("KEEP: " + name);
} else {
ss.deleteSheet(sheet);
deleted++;
Logger.log("DELETE: " + name);
}
});

Logger.log("Summary → Kept: " + kept + ", Deleted: " + deleted);
}

/**
* Build a flexible regex that matches today's date in common formats.
* It covers:
* - dd[sep]mm[sep](yyyy|yy)
* - mm[sep]dd[sep](yyyy|yy)
* - (yyyy|yy)[sep]mm[sep]dd
* - (yyyy|yy)[sep]dd[sep]mm
* - contiguous forms like ddmmyyyy, mmddyyyy, yyyymmdd, ddmmyy, etc.
* - allows multiple separator types: -, _, ., /, space, colon
* - accepts zero-padded and non-padded day/month (e.g., "7" or "07")
*/
function buildFlexibleDateRegex(parts) {
var dd = parts.dd; // zero-padded day
var d = parts.d; // non-padded day
var mm = parts.mm; // zero-padded month
var m = parts.m; // non-padded month
var yyyy = parts.yyyy;
var yy = parts.yy;

// Separator class: one or more of -, _, ., /, space, or colon
var SEP = "[\\-_.\\/\\s:]+";

// Day and month alternatives (padded or not)
var DAY = "(?:" + dd + "|" + d + ")";
var MONTH = "(?:" + mm + "|" + m + ")";
var YEAR = "(?:" + yyyy + "|" + yy + ")";

// Ordered patterns with separators
var withSeps = [
DAY + SEP + MONTH + SEP + YEAR, // dd-mm-yyyy or dd/mm/yy, etc.
MONTH + SEP + DAY + SEP + YEAR, // mm-dd-yyyy
YEAR + SEP + MONTH + SEP + DAY, // yyyy-mm-dd
YEAR + SEP + DAY + SEP + MONTH // yyyy-dd-mm
];

// Contiguous patterns (no separators)
var noSeps = [
dd + mm + yyyy,
dd + mm + yy,
mm + dd + yyyy,
mm + dd + yy,
yyyy + mm + dd,
yy + mm + dd
];

// Optional surrounding non-digit boundaries to avoid matching inside longer numbers
// We’ll use word boundaries plus lookarounds to be more permissive with symbols.
var prefix = "(?<!\\d)"; // no digit before
var suffix = "(?!\\d)"; // no digit after

// Combine all patterns into a single alternation
var combined =
prefix +
"(?:" +
withSeps.join("|") +
"|" +
noSeps.join("|") +
")" +
suffix;

// Make the regex case-insensitive and global
return new RegExp(combined, "i");
}

News : Disney Dreamlight Valley: Wishblossom Ranch | Expansion Launch Trailer

News : 17th Annual Unity Awards

News : GTA Online: A Safehouse in the Hills Coming This December

News : Cozy Marbles Announcement Trailer

News : Star Citizen | Behind the Ships: RSI Perseus and Alpha 4.4: Welcome to Nyx.

... two videos :

News : Redot 4.4 rc-1 is now live! in XR technology.

Create your 2D and 3D games, cross-platform projects, or explore innovative ideas in XR technology with Redot Engine!

News : ... new beta features on blogger !

**Try our New Beta Features**: Create a more engaging reading experience with the help of Google Google Search previews: Easily insert visual Google Search previews for popular people, locations, pop-culture and more directly in your blog! In Compose View, look for the ‘G’ button in the editor tool bar to get started.
Blogger was launched on August 23, 1999 by Pyra Labs, founded by Evan Williams.
In the early 2000s, Blogger grew quickly as one of the first platforms to make blogging accessible to everyone.
Blogger experienced rapid growth, becoming one of the first platforms to make blogging widely accessible.
In 2003, Google acquired Blogger and integrated it into its services, offering free hosting under blogspot.com.
Later, it faced strong competition from WordPress and other modern CMS platforms, which reduced its market share.
In 2010, Google ended FTP publishing and centralized all blogs on its own servers.
After 2010, Blogger saw a relative decline as WordPress and other modern CMS platforms rose in popularity and captured much of the market.
In 2025, Google introduced new beta features for Blogger, showing that the platform has not been abandoned. These experimental tools aim to modernize Blogger, adding visual elements and creating a more engaging reading experience for users.

News : Seeing what's new in the Rogue Point Playtest 2! 💥

marți, 18 noiembrie 2025

News : Welcome to Roblox: Discover a World of Imagination

News : Lightyear Frontier - Country Roads Update Launch Trailer

News : Introducing Age Check by Roblox.

News : ... vlc cli script for radio online .

I used vlc cli on this type .bat script for online radio:

@echo off
:menu
cls
echo ================================
echo   Meniu Radio Muzica Clasica
echo ================================
echo 1. Venice Classic Radio (Italia)
echo 2. Radio Swiss Classic
echo 3. ABC Classic (Australia)
echo 4. Opreste VLC
echo 5. Iesire
echo ================================
set /p choice=Selecteaza optiunea (1-5): 

if "%choice%"=="1" goto venice
if "%choice%"=="2" goto swiss
if "%choice%"=="3" goto abc
if "%choice%"=="4" goto stopvlc
if "%choice%"=="5" goto end
goto menu

:venice
echo Pornesc Venice Classic Radio...
"C:\Windows\System32\taskkill.exe" /IM vlc.exe /F >nul 2>&1
start "" /B vlc.exe -I dummy "http://174.36.206.197:8000/stream"
goto menu

:swiss
echo Pornesc Radio Swiss Classic...
"C:\Windows\System32\taskkill.exe" /IM vlc.exe /F >nul 2>&1
start "" /B vlc.exe -I dummy "http://stream.srg-ssr.ch/m/rsc_de/mp3_128"
goto menu

:abc
echo Pornesc ABC Classic...
"C:\Windows\System32\taskkill.exe" /IM vlc.exe /F >nul 2>&1
start "" /B vlc.exe -I dummy "http://live-radio01.mediahubaustralia.com/2FMW/mp3/"
goto menu

:stopvlc
echo Oprire VLC...
"C:\Windows\System32\taskkill.exe" /IM vlc.exe /F >nul 2>&1
goto menu

:end
echo Inchidere...