Moving mouse to a spot and clicking

Here’s an example with an additional move and click command.

tell application "Finder" to activate

tell application "System Events"
	set visible_apps to application processes whose visible is true
	repeat with app_ in visible_apps
		if name of app_ is not "Finder" then
			set visible of app_ to false
		end if
	end repeat
end tell

on idle
	tell application "Extra Suites"
		ES move mouse {460, 515}
		ES click mouse
		ES move mouse {500, 500}
		ES click mouse
	end tell
	return 120 -- seconds 
end idle

When you save the script in Script Editor, save it as an application and make sure that “Stay Open” is enabled. This is an option in the save dialog. The dialog might/should look something like this, depending on which version of Script Editor is in use:

Hey rob, You’re the man ;). This is good. But it seems that the mouse clicks on 2 places really quick and then waits another 120 seconds. is it possible that it clicks on a certain point, waits 10 seconds, click on another point, wait 10 seconds, click on a point and then wait 120 seconds and repeat the process ?

I know it’s hard, and i understand if you’re busy doing more important things then helping a n00b like me who only needs a script to protect his website :slight_smile: .

Thanks in advance though,

Vincenzo

You can insert delays, measured in seconds, where you need them. Here’s an example.

on idle
	tell application "Extra Suites"
		ES move mouse {460, 515}
		ES click mouse
		delay 10
		ES move mouse {500, 500}
		ES click mouse
	end tell
	return 120 -- seconds 
end idle

– Rob

So Rob, This is the exact code i need ?:

tell application "Finder" to activate

tell application "System Events"
	set visible_apps to application processes whose visible is true
	repeat with app_ in visible_apps
		if name of app_ is not "Finder" then
			set visible of app_ to false
		end if
	end repeat
end tell

on idle
	tell application "Extra Suites"
		ES move mouse {80, 669}
		ES click mouse
		delay 10
		ES move mouse {455, 400}
		ES click mouse
		delay 10
		ES move mouse {492, 634}
		ES click mouse
	end tell
	return 120 -- seconds 
end idle

Thanks in advance,

Vince

Yep, that looks like it should work. :slight_smile:

– Rob

Ok Thanks ! I’m gonna try. Wil it also work when on sleep mode ?

–Vince

No, the computer, but probably not the screen, needs to be awake.

– Rob

I am looking for an easy solution to copy text from a web page (always in the same location) into to a specific location in Word and print.

tell application “Google Chrome”
activate
tell application “Google Chrome” Get id=“customer-name-first” {not sure how to execute this part}
tell application “System Events” to keystroke “c” using command down
end tell

tell application “Microsoft Word”
activate

tell application “Microsoft Word”
set findRange to find object of selection
tell findRange
execute find find text “xxx” replace with “CLIPBOARD” replace {not sure how to get the clipboard pasted here}
replace all
tell application “System Events” to keystroke “v” using command down
tell application “System Events” to keystroke “p” using command down
end tell

ANY help would be very much appreciated

I don’t have Word installed on this mac and also Using safari (Safari and Chrome are pretty much the same). The code you’re looking for should look something like this:


tell application "Google Chrome"
set theText to do javascript "document.getElementbyId('customer-name-first').innerHTML;" of document 1
end tell

tell application "Microsoft Word"
set text of document 1 to theText
end

Hello.

Look here for how to execute Javascript in Chrome with Applescript

Save the post to disk, it disappeared for me once.

Here is a fun read by the way Now you have two problems quote :slight_smile: