Sign in to follow this  
Followers 0
rumourh

My first (failed) script - any suggestions

7 posts in this topic

So: I'm trying to work out how to use AutoIT v3 and I've had a shot at working it out but am having no luck in getting it to work. I've made and attempt at writing it and was wondering if anyone is able to assist me with where I am going wrong.

Basically: I want to have a script that sits active, I can run (and restart) with F11, pause with F8 and exit with {ESC}. The routines in the script I would like to be able to call to repeat actions within an Macromedia Flash window of Internet Explorer.

I am having no joy with this so far, any tips or suggestions would be appreciated. With some fear of being laughed at, here is my script (which doesnt work at all):

Global $Pause

HotKeySet("{F11}","Start")

HotKeySet("{F8}","PauseIT")

HotKeySet("{ESC}","ExitScript")

AutoItSetOption ("WintTitleMatchMode", 2)

WinActivate("Windows Internet Explorer")

;Main body of Script

Func Start()

Action1()

Sleep(2000)

$checksum = PixelChecksum(230,450,235,455)

While $checksum = PixelChecksum(230,450,235,455) ;If these pixels change I want it to stop

Action2()

Sleep(5000)

WEnd

EndFunc

;Functions

Func Action1()

ControlClick ("[Class:MacromediaFlashPlayerActiveX]","", 800, 100)

SEND ("Some text")

ControlClick ("[Class:MacromediaFlashPlayerActiveX]","", 900, 100)

Sleep(2000)

Endfunc

Func Action2()

ControlClick("[Class:MacromediaFlashPlayerActiveX]","", 600, 100)

Sleep(1000)

Endfunc

Func PauseIT()

$Pause = NOT $Pause

While $Pause

sleep(10000) ;10 Seconds between checking to reduce CPU usage

ToolTip('Script is "Paused" - Press F8 to continue',0,0)

WEnd

ToolTip("")

EndFunc

Func ExitScript()

Exit 0

EndFunc

Share this post


Link to post
Share on other sites



It would help if you were to mention what about it dosent work.

As far as IO can tell it wont do anything at all as it stands, as there is no loop in your main body of script to keep it alive

just a simple

While 1 
      Sleep(10)
WEnd

will do

You should also put your code between code tags

[code]

;your code

[/code]


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

Cheers John, thanks for the tip - I'll keep reading up and continue having a go.

It's for remote home monitoring, and I've worked out I've got the two actions around the wrong way and the monitoring status pixel check backwards too :graduated:

Share this post


Link to post
Share on other sites

Sorry :graduated:

Because it was flash player I automatically assumed it was.

What is it exactly that your trying to acheive, like what is it this script is going to be doing for you.

Im a newbie But have learnt tons of stuff over the last month, and could be of some help

Sparky x


[center]First Ever Script/App[/center][center]Simple Battery Meter[/center]

Share this post


Link to post
Share on other sites

I found this Example in the documentation

it has pixelchecksum() and a while loop as well

look at the example at the bottom of the page, its basically what your trying to do :graduated: (loop to check if pixels have changed )


[center]First Ever Script/App[/center][center]Simple Battery Meter[/center]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0