You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Apple script to delete the Safari Bookmarks

This below code is not working In script editor to delete the bookmarks. any help or suggestion please.


tell application "Safari"

activate

delay 1

tell application "System Events"

keystroke bookmarkName

delay 1

keydown control

key code 63

key up control

delay 1

key code 125

delay 1

keystroke return

delay 1

end tell

end tell





Posted on Oct 10, 2024 8:10 AM

Reply
1 reply

Oct 11, 2024 12:03 PM in response to vglax

Your code would never run as-is. Either there's more to it that you're not showing us, or your flow is just wrong.


For example:


keystroke bookmarkName


bookmarkName is not defined in your script (as posted), therefore the script is going to bail at this point since it doesn't know what you're trying to type.


Second:


keydown control 
key code 63
key up control


key code 63 is the function key... so you're trying to hold the control key, tap the function key, then release the control key? What do you expect this to achieve?


key code 125


Is the down arrow, followed by a return.


Nowhere do I see anything to delete a bookmark, so I'm not quite sure what you're trying to achieve.

Apple script to delete the Safari Bookmarks

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.