Re: Making bookmarks for Safari
Re: Making bookmarks for Safari
- Subject: Re: Making bookmarks for Safari
- From: "Dr. Max Bonilla" <email@hidden>
- Date: Mon, 23 Feb 2004 10:27:37 -0500
After working on the problem for a while, I came up with my own answer.
I'm trying to import links into bookmarks. I have a number of files with a
series of links each that I would like to make bookmarks. The links number
in the hundreds for each file, so finding a way thru AS was preferable. The
following script does the trick. There are likely more elegant ways of
accomplishing this, using for example an HTML editor such as PageSpinner,
instead of Tex-Edit. Also there might even be ways of doing it without
using UI scripting (though I doubt it, at least for the current version of
Safari). I used UI Browser 1.2, which made that part of the script the
easiest. The bookmark ends up in the last bookmark folder used.
This is the script:
on bookmark1(z)
tell application "Safari"
try
open location z
delay 3
set a to name of window 1
my bookmark2()
close every window saving no
end try
end tell
end bookmark1
on bookmark2()
tell application "Safari" to activate
-- may not need to activate application
tell application "System Events"
if (system attribute "sysv") < 4144 or UI elements enabled then
tell application process "Safari"
click menu item "Add Bookmark
" of menu "Bookmarks" of menu
bar item "Bookmarks" of menu bar 1
delay 2
click button "Add" of sheet 1 of window 1
delay 2
end tell
else
tell application "System Preferences"
activate
set current pane to pane
"com.apple.preference.universalaccess"
beep
display dialog "GUI Scripting is not enabled." & return &
return & "Check \"Enable access for assistive devices\" in the Universal
Access preference pane (authentication is required), then run this script
again." with icon stop buttons {"OK"} default button "OK"
end tell
end if
end tell
end bookmark2
on run
tell application "Tex-Edit Plus"
set a to name of window 1
set x to true
repeat until x = false
search window a looking for "<A href=\"^*\"" finding next
set x to result
set z to selection
set z to characters 10 thru -2 of z as string
my bookmark1(z)
end repeat
close every window saving no
end tell
end run
On 2/21/04 12:26 PM, "Dr. Max Bonilla" <email@hidden> wrote:
>
Hello everyone,
>
>
I'm trying to find a way to import a series of link on a page to bookmarks
>
in Safari. I have several files full of links, just links, that I would
>
like to turn into Safari bookmarks, putting them, if possible into
>
particular bookmark folders.
>
>
Is there a way to do this?
>
>
Thanks.
>
>
Max
>
_______________________________________________
>
applescript-users mailing list | email@hidden
>
Help/Unsubscribe/Archives:
>
http://www.lists.apple.com/mailman/listinfo/applescript-users
>
Do not post admin requests to the list. They will be ignored.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.