Discussion in 'Mac Programming' started by andy8686, Jun 7, 2011.

  1. andy8686, Jun 7, 2011
    Last edited: Jun 7, 2011

    andy8686 macrumors newbie

    Jun 7, 2011
    I just started learning Applescript programming. I need to write an Applescript program to enable the drop-down of the menu and clicking one of the item in the drop-down.

    Example of the drop-down menu:
    For example, I need to click the DHTML menu in Home. (Applescript to let Home auto drop-down and Auto click on DHTML)

    Please guide me on how should i write this program and if possible do give me a sample Applescript coding so that i am able to reference to.
  2. numero macrumors regular

    Jul 23, 2002
    If you are looking for a way for AppleScript to interact with a web page, that can't be done (in a practical sense). AppleScript does its magic by sending AppleEvents between applications. You can control Safari by telling it to open a new tab, what address to load, make a PDF of the page, etc. But you can't interact with Javascript on that page.

    Now, I don't give up easily. If I was bound and determined to get something to work I would have AppleScript tell Safari to load the page, then tell Safari to give me the page source and then parse through that looking for the event that happens when I click a certain item. That may cause another page to load, which I would tell Safari to load for me. Etc.

    It's the long way around and isn't exactly suited for AppleScript's strengths, but it could be done.

Share This Page