The problem is you are trying to reuse the result variable after your script has changed its value.
Result assumes the value of the result of the last command. In your script it assumes the value of the display dialog command, then the value of the tag screen, but your command asking for the button returned is still expecting for the display dialog record and finding a string.
The script below works by not relying on the result variable at all.
HTH
ES
on open the_file set userResponse to display dialog "Prompt text here " & the_file default answer "" with icon note buttons ["Cancel", "Tag", "Tag & OCR"] default button "Tag" set tag_string to text returned of userResponse ------------------------------------------------------------------------ if button returned of userResponse is "Cancel" then return else if button returned of userResponse is "Tag" then set do_OCR to false else set do_OCR to true end if ------------------------------------------------------------------------ -- tell application "Finder" set the_comment to get comment of (the_file as alias) set comment of (the_file as alias) to the_comment & " " & tag_string end tell
return end open
on open the_file display dialog "Prompt text here " & the_file default answer "" with icon note buttons ["Cancel", "Tag", "Tag & OCR"] default button "Tag" set tag_string to text returned of result ------------------------------------------------------------------------ - if button returned of result is "Cancel" then return else if button returned of result is "Tag" then set do_OCR to false else set do_OCR to true end if ------------------------------------------------------------------------ -- tell application "Finder" set the_comment to get comment of (the_file as alias) set comment of (the_file as alias) to the_comment & " " & tag_string end tell
return end open
If I drag a file onto the icon, I get this error message: Can't get class <<bhit>> of "the text I entered in the dialog" =
|