korábbi időjárásscript aktualizált verziója, régi és friss Growl-ra, fixált curl hívással:
(* Meteo by Gabor PENOFF (//fns.pappito.com) release 20111215_161716 Requirements: - before run you need to Enable Access for Assistive Devices in SysPrefs/Universal Access - install Growl to get non-modal notification dialogs Usage: - just run the script That's all. *) set myScriptID to "Meteo" -- ID for Growl display -- set date variables: set myYear to get text 1 thru 4 of (year of (current date) as string) set myMonth to month of (current date) as number if myMonth < 10 then set myMonth to "0" & myMonth as string set myDay to day of (current date) if myDay < 10 then set myDay to "0" & myDay as string set myHour to hours of (current date) if myHour < 10 then set myHour to "0" & myHour as string set myMinute to "00" set tmpDir to "delme-meteo" set myFilePrefix to "delme-met-" set tIdokepStart to "http://www.idokep.hu/arch_kep.php?kep=" set myURLs to {¬ "http://terkep.idokep.hu/kep.php?kep=mix|jpg", ¬ "http://terkep.idokep.hu/kep.php?kep=hoterkep2®io=hu1680|jpg", ¬ "http://terkep.idokep.hu/kep.php?kep=felhokep2®io=hu1680|jpg", ¬ "http://terkep.idokep.hu/kep.php?kep=szelterkep2_anim|gif", ¬ "http://terkep.idokep.hu/kep.php?kep=szelterkep2®io=hu1680|jpg", ¬ "http://terkep.idokep.hu/kep.php?kep=legnyomasterkep|jpg", ¬ "http://feny.idokep.hu/kep.php?kep=csap24|jpg", ¬ "http://feny.idokep.hu/kep.php?kep=csap1|jpg", ¬ "http://feny.idokep.hu/kep.php?kep=aqua|jpg", ¬ "http://terkep.idokep.hu/kep.php?kep=rh|jpg", ¬ "http://terkep.idokep.hu/kep.php?kep=uv|jpg", ¬ "http://terkep.idokep.hu/kep.php?kep=pollen0|jpg", ¬ "http://terkep.idokep.hu/kep.php?kep=radar®io=eu|jpg"} set rootDir to (path to home folder as string) & "Pictures" tell application "Finder" to set fullDir to rootDir & ":" & tmpDir -- save fullDir set myNotification to "Downloading METEO images to " & (POSIX path of fullDir) & "..." tell me to notifyWithGrowl(myScriptID, myNotification) try tell application "Finder" to delete fullDir end try tell application "Finder" to make new folder at alias rootDir with properties {name:tmpDir} -- download files: --tell application "URL Access Scripting.app" set i to 1 repeat with myURL in myURLs set thisURL to (text 1 thru ((offset of "|" in myURL) - 1) of myURL) set thisExt to (text ((offset of "|" in myURL) + 1) thru (length of myURL) of myURL) set the myFile to fullDir & ":" & myFilePrefix & i & "." & thisExt --set myFile to ((path to temporary items) as string) & "url_access_file.xml" --«event aevtdwnl» thisURL given «class fdst»:file myFile, «class rplc»:«constant erplyes » do shell script "curl -L \"" & thisURL & "\" -o \"" & (POSIX path of myFile) & "\"" set i to i + 1 end repeat --end tell -- display images using full-featured QuickLook window: tell application "Finder" activate open folder fullDir set current view of front Finder window to list view end tell tell application "System Events" key code 0 using {command down} -- cmd+a key code 49 using {option down} -- cmd+opt+y; y is 16 for US, 6 for Hungarians :) end tell -- that would be the callback after QuickLook: --tell application "Finder" -- activate -- set current view of front Finder window to v -- close front Finder window --end tell -- display images using a very limited (dumb) QuickLook window: --do shell script "qlmanage -p " & (POSIX path of fullDir) & "/* >& /dev/null" -- GrowlCheck: on growlInstalled() try do shell script "ls /Library/PreferencePanes/Growl.prefPane/" return true on error try do shell script "ls -d /Applications/Growl.app" return true on error return false end try end try end growlInstalled -- Growl notifier: on notifyWithGrowl(myApp, myText) set myIconApp to "SYSTEM:Users:fns:Documents:Scripts:meteo" set notificationID to myApp & ".default" if growlInstalled() then tell application "Growl" -- list of notification types set the ANL to {notificationID} -- list of enabled notifications set the DNL to {notificationID} -- register script register as application myApp all notifications ANL default notifications DNL icon of application myIconApp -- send notification notify with name notificationID title myApp description myText application name myApp end tell else -- skip alert if no Growl installed --display alert "Growl is not installed" end if end notifyWithGrowl