Jump to content

Recommended Posts

I'm trying to write a basic script in AutoIT to automate a Datamoshing workload.

The script is supposed to run like this: It reads a position on my screen, if it reads a certain colour, it will go through the steps to delete the frame, if it doesn't read that certain colour, it will go through the steps to cycle through to the next frame. here's what I have so far:

WinActivate
HotKeySet('q', "Kill")

Func Kill()
Exit 0
EndFunc
Func script()
$iColor = PixelGetColor(475, 1021)
If $iColor = 0xF0F0F0
then MouseClick("Left", 210, 984)
Sleep(250)
MouseClick("Left"),117,984)
Sleep(250) MouseClick("left"),243,985)
Send("{DELETE}")
Else MouseClick('left', 116, 985)
EndFunc

I'm fairly new to scripting, and this doesn't seem that hard, but it wont work, I think mainly because I don't know the syntax, any help?

Link to post
Share on other sites

Here's where I'm at now: 

WinActivate
HotKeySet('q', "Kill")

Func Kill()
    Exit 0
EndFunc

$iColor = PixelGetColor(475, 1021)
If $iColor = 0xF0F0F0 then
    MouseClick("left", 210, 984)
    Sleep(250)
    MouseClick("left"),117,984)
    Sleep(250)
    MouseClick("left"),243,985)
    Send("{DELETE}")
    Else
    MouseClick('left', 116, 985)

    EndIf

Link to post
Share on other sites
Posted (edited)

I would not recomend using pixels to do your automation. 99% of the time there is a better way to do it. 

You may want to look into ControlSend()

However,

WinActivate(" Put the title of the program you are wanting to activate ")
HotKeySet('q', "Kill")

Func Kill()
    Exit 0
EndFunc   ;==>Kill

$iColor = PixelGetColor(475, 1021)
If $iColor = 0xF0F0F0 Then
    MouseClick("left", 210, 984)
    Sleep(250)
    MouseClick("left", 117, 984)
    Sleep(250)
    MouseClick("left", 243, 985)
    Send("{DELETE}")
Else
    MouseClick('left', 116, 985)

EndIf

 

Edited by SkysLastChance

Life's simple. You make choices and you don't look back.

Link to post
Share on other sites
Posted (edited)
2 hours ago, KevinBrawn said:

Here's where I'm at now :

Did you run your script at least once by yourself ?

WinActivate expects as non-optional parameter : a title/hWnd/class of the window to activate.  I hope you didn't omit the window title due to the fact that it contains, for example, the name of a game. That would violate the forum rules.

MouseClick("left"),117,984) and  MouseClick("left"),243,985) produces a syntax error, because there is one closing parenthesis too much.

Edit : @SkysLastChance was a few seconds faster ;). I agree with his advice to use an alternative way of doing things.

Edited by Musashi
typo

Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...