Hi Everyone,
I am making a script that basically starts by asking a question with buttons:
set the_button to button returned of (display dialog "Welcome to P2Pixie, would you like to use the FTP and Mailing Function?" buttons {"Yes", "No"} default button "Yes")
if the_button is "Yes" then
property new_foldername : "PROXY"
set this_folder to (choose folder with prompt "Select the main shoot folder")
set foldername to name of (info for this_folder)
set folderPOSIXpath to POSIX path of this_folder
set tries to 1
set validextension to false
---coerce illegal characters to legal
--Store the current TIDs. To be polite to other scripts.
set previousDelimiter to AppleScript's text item delimiters
set potentialName to foldername as text
set legalName to {}
set illegalCharacters to {"/", ":", ","} --Whatever you want to eliminate.
set legalcharacter to {"-"}
--Now iterate through the characters checking them.
repeat with thisCharacter in the characters of potentialName
set thisCharacter to thisCharacter as text
if thisCharacter is not in illegalCharacters then
set the end of legalName to thisCharacter
else if thisCharacter is in illegalCharacters then
set the end of legalName to legalcharacter
end if
end repeat
---There is more action
if the_button is "No" then
--Insert the other code
property new_foldername : "PROXY"
set this_folder to (choose folder with prompt "Select the main shoot folder")
set foldername to name of (info for this_folder)
set folderPOSIXpath to POSIX path of this_folder
set tries to 1
set validextension to false
---coerce illegal characters to legal
--Store the current TIDs. To be polite to other scripts.
set previousDelimiter to AppleScript's text item delimiters
set potentialName to foldername as text
set legalName to {}
set illegalCharacters to {"/", ":", ","} --Whatever you want to eliminate.
set legalcharacter to {"-"}
--Now iterate through the characters checking them.
repeat with thisCharacter in the characters of potentialName
set thisCharacter to thisCharacter as text
if thisCharacter is not in illegalCharacters then
set the end of legalName to thisCharacter
else if thisCharacter is in illegalCharacters then
set the end of legalName to legalcharacter
end if
end repeat
end if
--This is where the "yes" button would active the FTP upload
So, here is the problem. I basically want to use the “yes” button to activate an action to create a file and then upload the file to an FTP site.
I have the FTP part figured out, but the code I want to insert has some property statements in the beginning. However, when I do this, it seems to bypass the beginning code and go straight to the property action. Any thoughts or solutions of how to fix this?
Thank you so much