Reputation: 157
Hey everyone. I can't figure this out for the life of me. Why can't I use 'end if' here?
display dialog "Input your Hard Drive name *Case sensitive*
For Example:
Jimi
Steve
Jony" default answer ""
set hdd_name to text returned of result
set folder_name to "~/Desktop/Backup Files"
display alert "Time Machine Extractor" message "Would you like to backup the" & folder_name & " directory now?" & return buttons {"Cancel", "Backup Now"} default button "Backup Now"
set theButton to button returned of the result
if theButton is "Cancel" then error number -128
**end if**
set shellCmd to "open /Volumes/" & quoted form of hdd_name & "/"
set shellCopy to "cp -r " & quoted form of folder_name & " /Volumes/" & quoted form of hdd_name
tell application "ASObjC Runner"
reset progress
set properties of progress window to {button title:"Cancel", button visible:true, message:"Backing up...", indeterminate:true}
activate
show progress
end tell
try
do shell script shellCmd
end try
try
set shellOutput to do shell script shellCopy
end try
tell application "ASObjC Runner" to hide progress
display dialog "Copy Complete"
So where I have the end if, it keeps telling me I have a syntax error. Any ideas?
Upvotes: 0
Views: 56
Reputation: 3292
You need to start a new line after the then
i.e,
if theButton is "Cancel" then
error number -128
end if
Upvotes: 1