I’m a bit of a neat freak on my computer, so i made a script like this:
tell application “Finder”
if not (the folder “Old Desktop” of home exists) then
make new folder at home with properties {name:“Old Desktop”}
end if
move (every file of desktop) & (every folder of desktop) to the folder “Old Desktop” of home
end tell
Well, i generally have a CD, or game in my computer, and i don’t paticularly want to click cancel ever time, is there a way i could so something like:
tell application “Finder”
if not (the folder “Old Desktop” of home exists) then
make new folder at home with properties {name:“Old Desktop”}
end if
move ((every file of desktop) & (every folder of desktop) - “My Rock on Dawgs CD version 4.2”) to the folder “Old Desktop” of home
end tell
Next, is there any way i can make a script to click my mouse?
And last, is there a way i can move my mouse?
tell application "System Events" to click
(* From the dictionary:
click v : cause the target process to behave as if the UI element were clicked
click [UI element] : The UI element to be clicked.
[at list] : when sent to a "process" object, the { x, y } location at which to click, in global coordinates
*)
Using kel’s suggestion, a slightly different way to phrase your script might be:
on getFolder for n at f
tell application "Finder" to tell f
tell folder n to if it exists then return it
make new folder at it with properties {name:n}
end tell
end getFolder
tell application "Finder" to move (items whose kind is not "Volume") to my (getFolder for "Old Desktop" at home)
If I may, perhaps I could add a small qualification to Adam’s equally good answer. Depending on your aim, you might have to bring the target process frontmost before a click achieves the desired result.
On the question of mouse movement, you’ll probably have to resort to a third-party solution, such as XTool:
It is hard to understand what you are trying to do and it took me a long time to understand what you wanted to do originally. What do you mean by coordinance?
Having a problem too, but I think he wants screen coordinates of something he wants to click on. If that something is a button somewhere or a window’s close button, say, then there are other, easier ways to get there. Ugrax - be more specific about what you want to do and we’ll help.
I have a very hard time using System Events to click in a window also. What I tried in the past is getting the bounds of the window.
bounds of front window
After you get the coordinates of the window, you calculate the coordinates of the button relative to the window bounds. This way the window may be positioned anywhere on the screen.
Well, I do mean screen coordinance, and I’m not worried about it moving, because it would be inside a game fullscreen, and since its a game, its not very script friendly. This make much sence? incase ur wondering, its not a bot or anything lol
[Edit]
Got it, but, thanks a ton for the help above