Dear MacScripters,
I am learning the applescript with the book AppleScript 1-2-3 and I don’t quite get the concept of ‘as string’ and how to get text out of a variable and change its word delimiters.
I want to ‘patch’ the content of 2 vars, the string “by” and the current short date into one hyphen delimited string that I can use to name a project folder.
Here is what I have so far and I don’t know how to convert the content of titleName to a list so I can apply the hyphen delimiters. I am also looking for a neat way to prepend the current date to the string (yyyy-mm-dd) Any help is much appreciated.
roadie.
---- create project folder name from date-title-author
set titleName to "The Title"
set authorName to "The Author"
set folderSourceName to titleName & space & "by" & space & authorName as string
--> gives me "The Title by The Author"
-- I want to get "yyyy-mm-dd-the-title-by-the-author" as a string
--set AppleScript's text item delimiters to space
--set theseItems to the text items of titleName
--set AppleScript's text item delimiters to {""}
--return theseItems
--set AppleScript's text item delimiters to "-"
--set projectFolderName to {titleName & "by" & authorName} as string
--set AppleScript's text item delimiters to {""}
--return projectFolderName