Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use AppleScript version "2.4" -- Yosemite (10.10) or later
- use scripting additions
- set nameArray to {}
- set templateFolder to (alias "Macintosh HD:Users:jsnell:Dropbox:Podcast Templates:")
- tell application "Finder"
- set theItems to the items in folder templateFolder
- set theNames to the name of items in folder templateFolder
- end tell
- set mychoice to (choose from list theNames with prompt "Choose your Template" default items "None" OK button name {"Choose"} cancel button name {"Cancel"}) as string
- tell application "Finder"
- duplicate item ((templateFolder as text) & mychoice) as alias to (path to desktop folder)
- open item ((path to desktop folder as string) & mychoice) as alias
- delay 2
- delete item ((path to desktop folder as string) & mychoice) as alias
- end tell
- if mychoice contains "Download" then
- set unixDate to (do shell script "date +'%s'") as number
- set premiere to "1493316000" as number
- set newdate to unixDate - premiere -- seconds since premiere
- set newdate to newdate / 86400 -- days since premiere
- set weekcount to newdate / 7 --weeks since premiere
- set weekcount to weekcount as integer
- set weekcount to (weekcount - 1) --adjust for extra episodes
- set theNewName to ("Download " & (weekcount as string))
- tell application "System Events"
- set name of file (((path to desktop folder) as string) & "Download Template:download.logicx") to (("download" & weekcount as string) & ".logicx")
- set name of folder (((path to desktop folder) as string) & "Download Template") to theNewName
- end tell
- end if
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement