I’d like to move my mouse to a certain point on the page and click at a certain place. I Do not even know the co-ordinates yet so all help is apreciated. Could you also please give me some example scripts ?
Thanks a Bunch,
Vincenzo
I’d like to move my mouse to a certain point on the page and click at a certain place. I Do not even know the co-ordinates yet so all help is apreciated. Could you also please give me some example scripts ?
Thanks a Bunch,
Vincenzo
Please anybody ?
Well, if you have access to GUI scripting, you might be able to do what you want to do. On my Jaguar machine, the following script will click on the second tab in Safari. You may see different results based on screen resolution, number of tabs open in Safari, etc. I don’t know if GUI scripting will work within a web page or document.
tell application "Safari" to activate
tell application "System Events"
tell process "Safari"
click at {300, 100} -- {from left, from top}
end tell
end tell
– Rob
why do you need the mouse to click at a certain place? what is it doing?
ben
Ben: It helps me with a site… Not important.
Rob: Thanks, But i don’t have access to GUI Scripting… Is this a Panther Only thing ? Sorry for being such a newbie. I Inserted:
tell application "Safari" to activate
tell application "System Events"
tell process "Safari"
click at {300, 100} -- {from left, from top}
end tell
end tell
In My Scriptmaker ( Jaguar ) But it sais it can’t understand the command click at.
Btw, My aim is to click at certain places in the actual site.
Thanks, And sorry for being such a n00b :oops:
Vince
Panther offers GUI scripting by default but Jaguar users (OS X 10.2.3 or later) must install a beta version of System Events [d/l the beta] to gain access to the UI. Make sure to follow all instructions in the documentation if you decide to install it or it won’t work.
Edit: You can also manipulate the mouse (move the cursor, click, get the coordinates, check to see if the mouse is down) with Extra Suites.
– Rob
Rob, Thanks for the Help so far. Now i know how to get my co-ordinates. I also have some scripts to move the mouse and some to click with the mouse. However, i can’t combine them and get the result i want. I Want to move the mouse ( Co-ordinates i allready know ) and click, then repeat this process. Can someone give me the exact script for this ? This’d be awesome !
Thanks for the help so far,
Vince
Someone might be able to help if you post the code snippets that you need to pull together.
– Rob
Ok Rob, So The Code to move the mouse will be:
tell application "Extra Suites"
ES move mouse {460, 515}
end tell
Unfortunatly i can’t get the Click-Script. I need to click ONCE. I found this example but it’s totally wrong:
tell application "Finder" to activate
tell application "Extra Suites"
ES click mouse with double click --and option
--ES click mouse with control
end tell
The Thing is, I don’t need to open anything. i only need to click at the location my mouse moved to in the previous code. then repeat this process constantly.
Thanks for the Help so far, and thanks in advance,
Vincenzo
This works for me as long as no application windows are visible when the script is executed. I tested it by placing a folder in the targeted location. After running the script via the Script menu, the folder’s icon is selected.
tell application "Extra Suites" to ES move mouse {460, 515}
tell application "Finder" to activate
tell application "Extra Suites" to ES click mouse
Why do you need to repeat the process constantly?
– Rob
Rob, You’ve been a great help so far . This works pretty good yeah. But i need to repeat it cause i have a website with this security program that has to be refreshed every 2 minutes. When im in school ( im 14 ) i can’t do this, so i want a script to do it for me. Thanks so far, and more help would be great !!
Thanks,
Vince
Maybe this will work when saved as a stay open application. Once launched, it should run the code every 120 seconds.
on idle
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
tell application "Extra Suites" to ES move mouse {460, 515}
delay 1
tell application "Extra Suites" to ES click mouse
return 120 -- seconds
end idle
– Rob (who will be extremely mad if he finds out that this is used to break the rules at school)
Thanks ! .
Lol, Naa, I won’t run it at my school’s computer. Just at home And it’s allowed anyways. You’re the best man. Is it ok if i PM you if i need more help ?
Thanks a lot,
Vincenzo
It’s ok to PM me but others with similar needs might benefit if we keep the discussion here.
– Rob
Oh wait, it seems not to work. Nothing happens :? Weird
If you run it in Script Editor, it will do nothing. It must be saved as a stay open application and then launched (the same way you launch other applications).
If there’s no chance that the computer will be used while the script is running, the following version will be more resource friendly since it doesn’t need to hide the applications every time it executes.
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
tell application "Extra Suites" to ES move mouse {460, 515}
delay 1
on idle
tell application "Extra Suites" to ES click mouse
return 120 -- seconds
end idle
– Rob
k Thanks man. I think this is working . What if i want to add extra mouse movements and clicks… So thesame thing but more in one serie ? Lol, I know i keep on wining but since were solving problems, might aswell solve’em all now
Thanks in advance,
Vince
I would probably use something like this, where you can add more move and click commands to the idle handler (at the end of the script).
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
-- more move and click commands here
end tell
return 120 -- seconds
end idle
– Rob
As i’m a complete newbie, and i didnt really get what u ment in your last post, could you give me an example of this script with another move and click mouse code ? Ill insert the Co-ordinates BTW, i tried running your previous codes as an app. But it opens and disappears, and then nothing happens. is this normal ?
thanks,
Vince