What I need is the ability to make a folder but choose the location (server) it goes to
here is what I have so far.
on run
tell application "Finder"
activate
set job_number to text returned of (display dialog "Enter the Job Number:" default answer "" buttons {"Cancel", "Ok"} default button 2 with icon 1)
set job_name to text returned of (display dialog "Enter the Job Name:" default answer "" buttons {"Cancel", "Ok"} default button 2 with icon 1)
(display dialog "" buttons {"location_1", "location_2"} default button 2 with icon 1)
if "location_1" make new folder at folder "location_1" with properties {name:{job_number & " " & job_name}}
end if
if "location_2" make new folder at folder "location_2" with properties {name:{job_number & " " & job_name}}
end if
end tell
end run
the error I am getting with this script is
cant make <> “folder name” of <> “location_1” of application “finder” into a boolean.
Any help would greatly be appericated.
Herb
There may be other problems, but the first thing is to fix the if statements.
if "location_1" make new folder...
You and I can guess that you mean to test which button the user pressed. The script needs things spelled out in a bit more detail.
“location_1” isn’t something that can be true or false. I think that’s confusing the compiler and getting it to try to interpret the rest of the line as something true/false. When the compiler gets confused, it tends to spit out misleading error messages :?
How to turn “location_1” into something that can be true or false? The line should go along the lines of
"if ... is "location_1" then make new folder...
Don’t type that in yet: you still need to identify the something that must be “location_1” Well your script needs to find out what button was clicked.
First save the result of the dialog in a variable so you can refer to it in several places. Your line displaying the dialog will become
set chosen_location to display dialog "" buttons ...
Then your first if statement becomes
if button returned of chosen_location is "location_1" then make new folder...
Try that. And then find out all the other problems with your script!
Thank you so much…you sent me down the right path but did not give me all the answers…so I could figure them out on on my own…Thanks again for all your hlep!
Herb