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"
所以,如果我有结束,它一直告诉我,我有一个语法错误。有什么想法吗?
答案 0 :(得分:1)
您需要在then
即,
if theButton is "Cancel" then
error number -128
end if