Saturday, January 20, 2018

#1 2003-04-21 11:39:58 am

Trash Man
Sanitation Department
Registered: 2005-10-20
Posts: 5336

More 'Date' scripting using the unix 'cal' command.

The Unix 'cal' command can also come in handy for certain 'date' scripting tasks.

OS version: OS X

Applescript:

set mmCount to word -1 of (do shell script "cal"
-->"30"
set febCount to word -1 of (do shell script "cal 2 2003") as number
--> 28

--If your looping thru every day of the month (to build urls for an example)
set dayList to words 10 thru -1 of (do shell script "cal")
-->{"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30"}


One mans trash is another mans treasure

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)