The Safari Super AppleScript

Screen Shot 2015-08-20 at 3.41.52 PMToday I had an idea… why not take all of the functions I use in Safari and turn them into one super AppleScript function that does everything! I’m not sure why I never thought of this before…

Because it is so useful, so time saving, and so awesome… I decided that I would give this to anyone that donates to my site via the Pay Pal button as a gift.

Now the Super Safari Script is not that hard to make, and may be a fun AppleScript project to try yourself…but if you don’t want to spend the aggravation and time to make it then consider it… or consider donating anyway because I just gave you the awesome idea!

What is it?

super(theAction, type, identifier, num, input)

(If this makes no sense to you then learn how to use AppleScript Safari functions by reading some of my other tutorials and come back to this page.  How to fill out forms on websites using AppleScript  might be a good place to start.)

The Super Safari Script is a function that with only one line of code you can….

 

Click on anything:

super(“click”, “class”, “classXYZ”, 2, 0

super(“click”, “id”, “idXYZ”, 0, 0)

super(“click”, “name”, “nameXYZ”, 4, 0)

super(“click”, “tag”, “tagXYZ”, 3, 0)

Get an input from anything:

super(“get”, “class”, “classXYZ”, 2, 0)

super(“get”, “id”, “idXYZ”, 0, 0)

super(“get”, “name”, “nameXYZ”, 4, 0)

super(“get”, “tag”, “tagXYZ”, 3, 0)

Input text into a form:

super(“input”, “class”, “classXYZ”, 2, “Some text you want to input”)

super(“input”, “id”, “idXYZ”, 0,“Some text you want to input”)

super(“input”, “name”, “nameXYZ”, 4,“Some text you want to input”)

super(“input”, “tag”, “tagXYZ”, 3,“Some text you want to input”)

Submit a form:

super(“submit”, “class”, “classXYZ”, 2, 0)

super(“submit”, “id”, “idXYZ”, 0,0)

super(“submit”, “name”, “nameXYZ”, 4,0)

super(“submit”, “tag”, “tagXYZ”, 3,0)

Force an onchange event with applescript:

super(“force”, “class”, “classXYZ”, 2, 0)

super(“force”, “id”, “idXYZ”, 0,0)

super(“force”, “name”, “nameXYZ”, 4,0)

super(“force”, “tag”, “tagXYZ”, 3,0)

As you can see… it literally does everything you could think to do! Except go to a web page… but if you really want I can write that in for you.

 

Here are the instructions FYI… if you are still confused.

 

————————————–

How to use this!

————————————–

All parameters must be entered in quotes unless they are a number. For example you would write: super(“input”, “name”, “query”, 0, “Cogs”)

————————————–

theAction can be: click, get, or input

click – clicks an element

get – retrieves the innerHTML

input – inputs into a form

submit – submits a form

force – forces the onchange event

————————————–

type can be: id, class, tag, or name

————————————–

identifier is the class name, tag name, id, or name

example: <a class = “bob”>Larry</a> <– bob is the identifier

————————————–

num is the instance of the class, name, or tag set to 0 if using id

There are 30 elements that have the class “bob”. This tells the script which bob to click on. The first bob is 0.

example: if we wanted to click on Leroy we would use num 2

<a class = “aNameOfSomeone”>Larry</a> <– instance 0

<a class = “aNameOfSomeone”>Steve</a> <– instance 1

<a class = “aNameOfSomeone”>Leroy</a> <– instance 2

————————————–

input is what you are inputting. If you are not inputting anything set this to 0

————————————–

 

Leave a Reply

Your email address will not be published. Required fields are marked *