A Few Questions...

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?

Hi ugrax,

replace this:

(every folder of desktop)

with this:

(every folder of desktop whose kind is not “Volume”)

I don’t know how to click the mouse.

gl,

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

*)

Two questions down, one to go, Ugrax - but first…

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:

(* requires XTool *)
move mouse {100, 200}

:slight_smile:

Awesome! Thanks you all!

I feel quite stupid lol, how do i find out the coordinance?
I tried using record, and using it on Finder windows, but that proved quite innacurate :open_mouth:

Ty, again tho

Hi Ugrax,

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?

gl,

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 think you’re right Adam!

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.

gl,

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 :smiley:

[Edit]
Got it, but, thanks a ton for the help above