Hi
I cant get this to work. I want to be able to apple click (hold apple key, left click)
Thanks
Hi
I cant get this to work. I want to be able to apple click (hold apple key, left click)
Thanks
If you’re not able to do it with UI scripting (via System Events), clicks and mouse movements are not possible with plain vanilla AppleScript.
You need a scripting addition like Extra Suites (which is actually no scripting addition).
I have extra suits, I just don’t know what the actual code is
I’m sorry, I don’t use Extra Suites.
It’s an application, so it has its own dictionary
There is a folder that comes with Extra Suites called “Extras” and it contains
many examples.
Here are some handlers I use often.
Cheers!
Craig
on mouseClick(move_to_and_click, the_delay)
	tell application "Extra Suites"
		ES move mouse move_to_and_click
		ES click mouse
		delay the_delay
	end tell
end mouseClick
on getMouseLocation()
	tell application "Extra Suites"
		set mouseLoc to (ES mouse location)
	end tell
	return mouseLoc
end getMouseLocation
on mouseDoubleClick(move_to_and_click, the_delay)
	tell application "Extra Suites"
		ES move mouse move_to_and_click
		ES click mouse with double click
		delay the_delay
	end tell
end mouseDoubleClick
on getMouseLocationClibboard()
	tell application "Extra Suites"
		set mouseLoc to (ES mouse location)
	end tell
	set itemOne to item 1 of mouseLoc
	set itemTwo to item 2 of mouseLoc
	set mouseLocation to "{" & (item 1 of myLoc) & ", " & (item 2 of myLoc) & "}" & ", " as string
	set the clipboard to mouseLocation
end getMouseLocationClibboard
Those are very useful thank you. I’m not sure if I’m missing it but I still don’t understand how to hold down command and click. All I can find in extra suites is how to hold command and press a key, but nothing for clicking. 
Read the dictionary
ES click mousei[/i]press the mouse (from the Input Commands suite)
command syntax
ES click mouse double click boolean ¬
command boolean ¬
option boolean ¬
shift boolean ¬
control boolean
that means:
ES click mouse command true
which will be probably compiled as
ES click mouse with command
It doesn’t seem to hold down that the command key long enough to actually command click. Here is what I got
repeat
   tell application "System Events"
       
       tell application "World of Warcraft" to activate
       
       tell application "Extra Suites"
           
           ES move mouse {519, 557} with relative
           ES click mouse with command
           
       end tell
   end tell
   
   
   
   
   delay (random number from 3 to 4)
   
end repeat
This is sort of what I am after, but it doesn’t work.
repeat
	tell application "System Events"
		
		tell application "World of Warcraft" to activate
		
		tell application "Extra Suites"
			
			ES move mouse {519, 557} with relative
			key down command
			ES click mouse
			key up command
			
		end tell
	end tell
	
	
	
	
	delay (random number from 3 to 4)
	
end repeat
bump