Applescript aids Flash games

Joined
Oct 6, 2010
Messages
47
Reaction score
0
Points
6
Your Mac's Specs
iMac 24" 2.66 GHz C2D 4GB RAM Nvidia GeForce 9400 | iPhone 3GS | TV2
Just to be clear, my primary question is if it's possible with Applescript to do this for someone who's not a professional programmer. If it is, and anyone can impart some of their relevant knowledge on how to do it to me I'd be most grateful.

Many games on the internet make use of the Flash plug in. Now with Applescript it's possible to simulate virtual mouse clicks in Safari thus:

repeat 10 times
delay 1
tell application "System Events"
tell application process "Safari"
click (click at {1266, 198})
end tell
end tell
end repeat

That's straightforward enough, but it doesn't seem to work if you're trying to click within a Flash browser plugin instance. So I changed the script. I went to File --> Open dictionary and tried replacing Safari with things like "Flash Player" etc. And I recompiled and ran it. These attempts fared no better than the first. :(

So is there a way to do this?
 
OP
archos4
Joined
Oct 6, 2010
Messages
47
Reaction score
0
Points
6
Your Mac's Specs
iMac 24" 2.66 GHz C2D 4GB RAM Nvidia GeForce 9400 | iPhone 3GS | TV2
Any pointers? I still can't do it.

I've managed to get what I want to happen by using Automator instead of Applescript. But I can't work in the foreground with the clicking going on in the background now. So that's not much use.
 
Joined
May 14, 2009
Messages
2,052
Reaction score
136
Points
63
Location
Near Whitehorse, Yukon
Your Mac's Specs
2012 MBP i7 2.7 GHz 15" Matte - 16 GB RAM - 120 GB Intel SSD - 500 GB DataDoubler Mac OS 10.9
The one BIG problem with Applescript is that even though Apple made it, application developers still need to add support to their applications that they understand what Applescript wants from them.
Firefox is one good example, it doesn't even have click support which means that you can't even click a normal webpage link.


I have tried Applescript with Java and Flash games and both times I draw a blank.
I can see Applescipt try to click, the Browser responds with the page title and page contents and then fails to send the Flash/Java content to Applescript.
I strongly believe that it's just Flash that needs to be made to receive Applescript commands and know what to do with them. Right now, it doesn't seem to be able to do either. :(

Annoying, but there isn't much one can do about it.
 
OP
archos4
Joined
Oct 6, 2010
Messages
47
Reaction score
0
Points
6
Your Mac's Specs
iMac 24" 2.66 GHz C2D 4GB RAM Nvidia GeForce 9400 | iPhone 3GS | TV2
OK, so Applescript's out by the sound of things. Thanks for straightening that out.

But do you know whether it's possible to accomplish the same thing with Automator (clicking in inactive windows while I work in the foreground is kind of important still)? I can't seem to find mention of any people who've managed this successfully and posted how to do it on the internet. :/
 
Joined
May 14, 2009
Messages
2,052
Reaction score
136
Points
63
Location
Near Whitehorse, Yukon
Your Mac's Specs
2012 MBP i7 2.7 GHz 15" Matte - 16 GB RAM - 120 GB Intel SSD - 500 GB DataDoubler Mac OS 10.9
No, Automator can't click in the background as it records your clicks and then plays them back to you like you were using the mouse.
It can do other stuff in the background, but not the Watch Me Do action.
 
OP
archos4
Joined
Oct 6, 2010
Messages
47
Reaction score
0
Points
6
Your Mac's Specs
iMac 24" 2.66 GHz C2D 4GB RAM Nvidia GeForce 9400 | iPhone 3GS | TV2
Oh dear. I don't really know any other possible ways to do this then. Are there any or am I going to have to just compromise?

Say, that's an idea. I've got Windows 7 Ultimate running through Parallels 6. Could I get a free program like AutoIt to do what I want in the Windows virtual machine...and then run OS X in the foreground over it? Would that work do you know? Well, I'm going to try it now anyway and will come back with any comments if that's OK.
 
Joined
May 14, 2009
Messages
2,052
Reaction score
136
Points
63
Location
Near Whitehorse, Yukon
Your Mac's Specs
2012 MBP i7 2.7 GHz 15" Matte - 16 GB RAM - 120 GB Intel SSD - 500 GB DataDoubler Mac OS 10.9
I don't know, I don't have any need for running windows on the side so I can't tell you about the Windows idea.
However it seems that there isn't another option for doing it in Mac OS, there's just one other app that I can think of that you might want to try. Startly - QuicKeys 4 for Mac OS X
I don't know if it can do it but AFIK it can also click for you, not sure if it can do stuff in the background though.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top