Jump to content

My first (failed) script - any suggestions


rumourh
 Share

Recommended Posts

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

Link to comment
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.

Link to comment
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:

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...