KevinBrawn Posted May 24, 2022 Share Posted May 24, 2022 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:WinActivateHotKeySet('q', "Kill")Func Kill()Exit 0EndFuncFunc script()$iColor = PixelGetColor(475, 1021)If $iColor = 0xF0F0F0then MouseClick("Left", 210, 984)Sleep(250)MouseClick("Left"),117,984)Sleep(250) MouseClick("left"),243,985)Send("{DELETE}")Else MouseClick('left', 116, 985)EndFuncI'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 comment Share on other sites More sharing options...
KevinBrawn Posted May 24, 2022 Author Share Posted May 24, 2022 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 comment Share on other sites More sharing options...
SkysLastChance Posted May 24, 2022 Share Posted May 24, 2022 (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 May 24, 2022 by SkysLastChance Musashi 1 You miss 100% of the shots you don't take. -Wayne Gretzky -Michael Scott Link to comment Share on other sites More sharing options...
Musashi Posted May 24, 2022 Share Posted May 24, 2022 (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 May 24, 2022 by Musashi typo SkysLastChance 1 "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 comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now