Skip to main content
change the "simple" and "little" as well as rephrase the ask since this is quite long. also tags
Source Link
bmike
  • 241.3k
  • 80
  • 433
  • 958

A simplecomplicated script to automate functions in Safari

clear history

I can navigate a script to control specific "Menu" items... but I can not find information on directing a script to find and click a specific button on a drop down sheet such as the one shown

Im just too inexperienced to know the proper naming and path commands .. any pointers to relevant information is appreciated.

Here is some more information.

Using Automator and Script Editor I made two scripts, saved them as Applications and set them each with a command key.

The result was that I could quickly open and close Safari and have the browser reset each time... works like a charm until Apple modifies Safari enough where the scripts need to be adjusted for the new path to the same function.

This time the control to reset is the "Clear History" function with I believe also clears the website data as well. Safari can be set to open in Private mode by default now so that helps a lot for keeping the cache clean

So once the user hits the menu item "Clear History"... instead of a pop up anything... there is a drop down.??..sheet?

I have gotten the script to get as far as that... the script seems to have located the "sheet"... but can not locate the button I want it to click.

What I have so far that gets .. to.. the button that I want clicked:

tell application "System Events"
tell application process "Safari"
    tell menu bar 1 to tell menu bar item "Safari" to tell menu 1 to tell menu item "Clear History…" to click
end tell

end tell

I tried to insert something like:

tell application "System Events" to tell process "Safari" to tell sheet 1 to click (button whose description is "Clear History")

end tell

the error result looks like:

error "Can’t get button whose description = "Clear History"." number -1728

Now I’m actually surprise the script got this far as I’m just hacking lines I saw in other scripts that I thought might work.

So basically I just can’t make my little script take the jump from controlling a few menu items to getting pointed to some type of drop down and making a button click for me.

ThanksCan I extend this to automate UI scripting in advance for your time and efforts.Safari?

A simple script to automate functions in Safari

clear history

I can navigate a script to control specific "Menu" items... but I can not find information on directing a script to find and click a specific button on a drop down sheet such as the one shown

Im just too inexperienced to know the proper naming and path commands .. any pointers to relevant information is appreciated.

Here is some more information.

Using Automator and Script Editor I made two scripts, saved them as Applications and set them each with a command key.

The result was that I could quickly open and close Safari and have the browser reset each time... works like a charm until Apple modifies Safari enough where the scripts need to be adjusted for the new path to the same function.

This time the control to reset is the "Clear History" function with I believe also clears the website data as well. Safari can be set to open in Private mode by default now so that helps a lot for keeping the cache clean

So once the user hits the menu item "Clear History"... instead of a pop up anything... there is a drop down.??..sheet?

I have gotten the script to get as far as that... the script seems to have located the "sheet"... but can not locate the button I want it to click.

What I have so far that gets .. to.. the button that I want clicked:

tell application "System Events"
tell application process "Safari"
    tell menu bar 1 to tell menu bar item "Safari" to tell menu 1 to tell menu item "Clear History…" to click
end tell

end tell

I tried to insert something like:

tell application "System Events" to tell process "Safari" to tell sheet 1 to click (button whose description is "Clear History")

end tell

the error result looks like:

error "Can’t get button whose description = "Clear History"." number -1728

Now I’m actually surprise the script got this far as I’m just hacking lines I saw in other scripts that I thought might work.

So basically I just can’t make my little script take the jump from controlling a few menu items to getting pointed to some type of drop down and making a button click for me.

Thanks in advance for your time and efforts.

A complicated script to automate functions in Safari

clear history

I can navigate a script to control specific "Menu" items... but I can not find information on directing a script to find and click a specific button on a drop down sheet such as the one shown

Im just too inexperienced to know the proper naming and path commands .. any pointers to relevant information is appreciated.

Here is some more information.

Using Automator and Script Editor I made two scripts, saved them as Applications and set them each with a command key.

The result was that I could quickly open and close Safari and have the browser reset each time... works like a charm until Apple modifies Safari enough where the scripts need to be adjusted for the new path to the same function.

This time the control to reset is the "Clear History" function with I believe also clears the website data as well. Safari can be set to open in Private mode by default now so that helps a lot for keeping the cache clean

So once the user hits the menu item "Clear History"... instead of a pop up anything... there is a drop down.??..sheet?

I have gotten the script to get as far as that... the script seems to have located the "sheet"... but can not locate the button I want it to click.

What I have so far that gets .. to.. the button that I want clicked:

tell application "System Events"
tell application process "Safari"
    tell menu bar 1 to tell menu bar item "Safari" to tell menu 1 to tell menu item "Clear History…" to click
end tell

end tell

I tried to insert something like:

tell application "System Events" to tell process "Safari" to tell sheet 1 to click (button whose description is "Clear History")

end tell

the error result looks like:

error "Can’t get button whose description = "Clear History"." number -1728

Now I’m actually surprise the script got this far as I’m just hacking lines I saw in other scripts that I thought might work.

So basically I just can’t make my script take the jump from controlling a few menu items to getting pointed to some type of drop down and making a button click for me.

Can I extend this to automate UI scripting in Safari?

Bumped by Community user
Bumped by Community user
Question Protected by CommunityBot
addition info and sample script lines
Source Link
user150034
user150034

clear history

I can navigate a script to control specific "Menu" items... but I can not find information on directing a script to find and click a specific button on a drop down sheet such as the one shown

Im just too inexperienced to know the proper naming and path commands .. any pointers to relevant information is appreciated.

Im just too inexperiencedHere is some more information.

Using Automator and Script Editor I made two scripts, saved them as Applications and set them each with a command key.

The result was that I could quickly open and close Safari and have the browser reset each time... works like a charm until Apple modifies Safari enough where the scripts need to knowbe adjusted for the proper naming andnew path commands to the same function.

This time the control to reset is the "Clear History" function with I believe also clears the website data as well. any pointers Safari can be set to relevant informationopen in Private mode by default now so that helps a lot for keeping the cache clean

So once the user hits the menu item "Clear History"... instead of a pop up anything... there is appreciateda drop down.??..sheet?

I have gotten the script to get as far as that... the script seems to have located the "sheet"... but can not locate the button I want it to click.

What I have so far that gets .. to.. the button that I want clicked:

tell application "System Events"
tell application process "Safari"
    tell menu bar 1 to tell menu bar item "Safari" to tell menu 1 to tell menu item "Clear History…" to click
end tell

end tell

I tried to insert something like:

tell application "System Events" to tell process "Safari" to tell sheet 1 to click (button whose description is "Clear History")

end tell

the error result looks like:

error "Can’t get button whose description = "Clear History"." number -1728

Now I’m actually surprise the script got this far as I’m just hacking lines I saw in other scripts that I thought might work.

So basically I just can’t make my little script take the jump from controlling a few menu items to getting pointed to some type of drop down and making a button click for me.

Thanks in advance for your time and efforts.

clear history

I can navigate a script to control specific "Menu" items... but I can not find information on directing a script to find and click a specific button on a drop down sheet such as the one shown

Im just too inexperienced to know the proper naming and path commands .. any pointers to relevant information is appreciated.

clear history

I can navigate a script to control specific "Menu" items... but I can not find information on directing a script to find and click a specific button on a drop down sheet such as the one shown

Im just too inexperienced to know the proper naming and path commands .. any pointers to relevant information is appreciated.

Here is some more information.

Using Automator and Script Editor I made two scripts, saved them as Applications and set them each with a command key.

The result was that I could quickly open and close Safari and have the browser reset each time... works like a charm until Apple modifies Safari enough where the scripts need to be adjusted for the new path to the same function.

This time the control to reset is the "Clear History" function with I believe also clears the website data as well. Safari can be set to open in Private mode by default now so that helps a lot for keeping the cache clean

So once the user hits the menu item "Clear History"... instead of a pop up anything... there is a drop down.??..sheet?

I have gotten the script to get as far as that... the script seems to have located the "sheet"... but can not locate the button I want it to click.

What I have so far that gets .. to.. the button that I want clicked:

tell application "System Events"
tell application process "Safari"
    tell menu bar 1 to tell menu bar item "Safari" to tell menu 1 to tell menu item "Clear History…" to click
end tell

end tell

I tried to insert something like:

tell application "System Events" to tell process "Safari" to tell sheet 1 to click (button whose description is "Clear History")

end tell

the error result looks like:

error "Can’t get button whose description = "Clear History"." number -1728

Now I’m actually surprise the script got this far as I’m just hacking lines I saw in other scripts that I thought might work.

So basically I just can’t make my little script take the jump from controlling a few menu items to getting pointed to some type of drop down and making a button click for me.

Thanks in advance for your time and efforts.

added 1 character in body
Source Link
user150034
user150034

clear history

I can navigate a script to control specific "Menu" items... but I can not find information on directing a script to find and click a specific button on a drop down sheet such as the one shown

Im just totoo inexperienced to know the proper naming and path commands .. any pointers to relevant information is appreciated.

clear history

I can navigate a script to control specific "Menu" items... but I can not find information on directing a script to find and click a specific button on a drop down sheet such as the one shown

Im just to inexperienced to know the proper naming and path commands .. any pointers to relevant information is appreciated.

clear history

I can navigate a script to control specific "Menu" items... but I can not find information on directing a script to find and click a specific button on a drop down sheet such as the one shown

Im just too inexperienced to know the proper naming and path commands .. any pointers to relevant information is appreciated.

Source Link
user150034
user150034
Loading