The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniWeb General (http://forums.omnigroup.com/forumdisplay.php?f=8)
-   -   Applescript and Bookmark Path (http://forums.omnigroup.com/showthread.php?t=25458)

exactabox14 2012-09-13 04:22 PM

Applescript and Bookmark Path
 
Does anyone have an example on how to applescript a path to a nested bookmark. This script is from an earlier post by scb

tell application "OmniWeb"
tell favorites
set theaddress to address of bookmark "Quix"
end tell

tell front browser
OpenURL theaddress
end tell

end tell

This script also works using personal bookmarks in place of favorites.
How can I make it work if the bookmark "Quix" in another folder like:
Favorites/My Bookmarks/"Quix"

whpalmer4 2012-09-13 07:16 PM

This is undoubtedly not the best way to do it, but it does give some idea of the structure.

I'm trying to get to the "How to Buy" bookmark which is in the "The Omni Group" folder in Personal Bookmarks. Bookmark folders are just bookmarks with more bookmarks within, so I grab the bookmarks from the top-level bookmark for the folder and walk the list looking for a matching name. Probably one wishing to do a lot of this would write a routine that takes a pathname, grabs its components in succession and walks the bookmark tree to the bottom. Left as an exercise for the reader :-)

[code]

tell application "OmniWeb"
set _bookmarks to bookmarks of bookmark "The Omni Group" of personal bookmarks

repeat with i from 1 to length of _bookmarks
if name of item i of _bookmarks is "How to Buy" then
set theaddress to address of item i of _bookmarks
exit repeat
end if
end repeat

tell front browser
OpenURL theaddress
end tell
end tell
[/code]

exactabox14 2012-09-13 09:50 PM

Another way
 
I also found another way of doing the script
the key was finding out that the folder is a bookmark without an address
you can assign an address to the folder and it will open that address
it will also become a folder Icon with a bookmark Icon over it

tell application "OmniWeb"
tell personal bookmarks -- or favorites
tell bookmark "The Omni Group" -- folder
set theaddress to address of bookmark "Omni News"
end tell
end tell

tell front browser
OpenURL theaddress
end tell
end tell


All times are GMT -8. The time now is 06:54 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.