Greetings to everyone. Thanks for having this forum.
I’m attempting exactly my second applescript.
The endgame is to have an applescript export my firefox bookmarks (via firefox’s “export” command) to a file and then upload it into a webpage on my server. I’m using a G4, firefox 1.0.4, and OS 10.3.9 (Panther). So I am, at this point, just trying to get my applescript to open the “Bookmarks Manager” window. I figure once I can do that, I’ll be able to similarly perform the export menu item from that window.
I understand that I could just go “get” the bookmarks file, but, like many others on this forum, I’m using this as a menu-mining exercise.
I’ve searched these fora and uncovered many pitfalls and I believe I’ve avoided them. I’ve enabled assistive devices and and confirmed (via both the online script at apple.com and the pre-loaded “probe menu bar” script) that gui scripting is “on”. I’m using an elipsis instead of three-dots, etc.
Here is the script:
tell application "Firefox" activate end tell on do_menu(firefox, bookmarks, "Manage Bookmarks.") try tell application "System Events" tell application process firefox set frontmost to true delay 2 tell process firefox tell menu bar 1 tell menu bar item 7 click menu item 2 of menu 1 end tell end tell end tell end tell end tell return true on error error_messsage return false end try end do_menu
Here are my questions:
When I run this, it executes without an error…but nothing happens. That is, no Bookmarks Manager window opens. I get the impression that it is somehow open in the background without me seeing it, but I don’t have the debugging expertise with applescript to verify that. For example, I don’t see a “visible” attribute in UI Element Instpector for that element or anything like that (the “AXVisibleChildren” doesn’t seem salient). How would a more experienced applesdev’er go about debugging a script that has no visible result (with an emphasis on this specific example, obviously)?
You’ll notice that I departed from apple.com’s example by putting the first three lines (the activation of firefox) outside the do_menu routine. When it was inside that routine, it didn’t activate at all. Lines 7 and 8 are designed to make sure the Firefox is frontmost and that seems to work. Why was it necessary to do both? All examples that I’ve seen do one or the other.
I’ve tried “perform action “AXPick” of” and “perform action “AXPress” of” instead of “click” and the result (or lack thereof) seems the same. Does that matter?
I honestly don’t understand the significance of lines 19-21…my earlier versions of the script returned error messages even without those lines being present. Pardon my newbieness on that point, but I’m curious.
Finally, I understand that Firefox is not at all applescript friendly, but I was surprised by the lack of firefox related guiscripts. I remain undaunted, but is there something uniquely un-guiscript about Firefox that I’m unaware of? System Events on the os should bypass all of that, I would think.
Thanks for your help!
Mark A. Morenz, MS Ed., CCAI, Linux+
“Not all of this is true” --Steven Wright