• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
RE: Bizarre "can't get class <<bhit>>" error
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Bizarre "can't get class <<bhit>>" error


  • Subject: RE: Bizarre "can't get class <<bhit>>" error
  • From: Ed Stockly <email@hidden>
  • Date: Tue, 20 Nov 2007 07:30:37 -0800

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"


=
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Prev by Date: Re: Simple GUIs
  • Next by Date: Re: Extract text from window using system events
  • Previous by thread: Re: Bizarre "can't get class <<bhit>>" error
  • Next by thread: XMLlib -- > Xpath
  • Index(es):
    • Date
    • Thread