• 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
Help on Checking an applications dictionary for a command
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Help on Checking an applications dictionary for a command


  • Subject: Help on Checking an applications dictionary for a command
  • From: David Siberry <email@hidden>
  • Date: Wed, 22 Jun 2005 10:11:07 +0100

Hi,

Its been a few days now and I have not heard anything back so im stull
abit stumped.
Can anyone help me out? Even if you dont know the answer but have some
ideas abot how to solve this problem I would love to hear from you.

Thanks again,

David



Previous question below -->

I am trying to write an apple script to check to see if a web browser
supports JavaScript. Its part of a browser detection application i am
writing.

The approach I am taking is this:

I want to use a try statement because depending on what your default
browser is depends which command you use. E.g. if your web browser is
Safari then the function call is "do JavaScript", if its Internet
Explorer then its "do script".

However, I want to create one script which will check the dictionary
of the multiple browsers if installed on your machine and try and call
"do script" if the try fails return false then call "do JavaScript".
If the command is found then return true.

For the "tell application "Safari" for example, the name of the
browser will be dynamic and passed in as a parameter from my C
program. This way I can keep the script generic and reusable.

However I am finding that when I compile if the "do script" or "do
JavaScript" is not in the given applications dictionary, then the
script will not compile.

The script I have written is:

tell application "Safari"

      try
              do script "window.name" (* simple dummy script to test with*)
              if (do script) then
                      return true
              else
                      return false
              end if
      end try

      try
              do JavaScript "window.name" (* simple dummy script to test with*)
              if (do JavaScript) then
                      return true
              else
                      return false
              end if
      end try

end tell

Cheers

David
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Help on Checking an applications dictionary for a command
      • From: Adam Wuellner <email@hidden>
  • Prev by Date: Re: scripting barcodes
  • Next by Date: Closing a window
  • Previous by thread: Status Busy - does this work?
  • Next by thread: Re: Help on Checking an applications dictionary for a command
  • Index(es):
    • Date
    • Thread