Okay, First off my Name is Eric and I am an Applescripting NOOB. Not that I am completely clueless when it comes to scripting (Lingo, Actionscript, JavaScript) but this is my first crack at Applescript.
Below is the portion of the script that is causing me the problem, which is that I get the error “Finder got an error: Can’t make class folder.” when the line
make new folder at gCustomerFolder with properties {name:lBox}
attempts to run. The problem seems to be with the variable gCustomerFolder which I eventually deduced by:
- putting the location desktop in place of the variable and
- typing in the full path “ESD MAC:FTP Server:Company A:” in place of the variable
Both of which resulted in the script performing successfully. I had also tried to use the alias form of the variable and attached the disk using it’s firewire and then it’s USB cable none of which did anything.
What is the problem I am having here? Why wont the variable gCustomerFolder, which has the very same information associated with it as the typed path “ESD MAC:FTP Server:Company A:”, have the same result when the script is run? I want to avoid hard coding the disk and folder paths at all costs so any help would be greatly appreciated.
global gMainHD, gFTPFolder, gCustomerFolder, gScriptsFolder
tell application "Finder"
activate
set gMainHD to startup disk as string
set gCustomerFolder to (choose folder with prompt "Select the Users FTP Folder") as string
set gScriptsFolder to "Backups_MAC & PC:Mac:My Automation:Applescripts:" --Hardcoded path (Fix this)
set lInboxScripts to {"eMail.scpt", "DBase.scpt", "iCal.scpt", "imaging.scpt", "Decider.scpt"} --Rewrite to set to contents of folder A
set lOutboxScripts to {"DBase.scpt", "iCal.scpt", "Cleanup.scpt", "eMail.scpt"} --Rewrite to set to contents of folder B
set lCFCharacters to characters of gCustomerFolder
set lStartPoint to ""
set x to -2 --Last character is always a colon, must set to 2nd from last
repeat until lStartPoint is ":"
set x to x - 1 --Go backwards until a colon is found
set lStartPoint to item x of lCFCharacters
end repeat
set gFTPFolder to items 1 thru x of lCFCharacters as string --Strip customer name from gCustomerFolder
my sMakeFolder("Inbox", lInboxScripts)
my sMakeFolder("Outbox", lOutboxScripts)
end tell
on sMakeFolder(lBox, lBoxScripts)
--set y to count of lBoxScripts
tell application "Finder"
make new folder at gCustomerFolder with properties {name:lBox}
--repeat with i from 1 to y
--attach action to folder gCustomerFolder & lBox using gScriptsFolder and name
--end repeat
end tell
end sMakeFolder
Model: Mac Mini - PPC
AppleScript: 10.4.9
Operating System: Mac OS X (10.4)