teemo Posted May 15, 2013 Share Posted May 15, 2013 I am completly new to autoit but i need it because it works for a problem i need to solve: I want to click on different stuff in the corner of my screen. It goes 3 up then adjust the window and clicks the new 3 (works so far). Then if you press the up button it should go up again (it doesnt). It needs to be triggered by keys and is just clicking up and down. My problem is that it makes sense in my head what i did there but i have no idea how to tell autoit what i want. I guess i used to many whiles cause thats the only thing that worked for me. the "Key" function is the same as _ispressed and 1 while alone it would even run up or down (the 1 click in between adjusts the window) i am sorry for the huge mess i did there...please try to fix it! expandcollapse popup#include "Key.au3" ; going down $all = 1 $u = 1 $i = 1 while $all = 1 Sleep(50) While $i = 1 Sleep(50) While Key("NUMPAD1") MouseClick ("right", 1500 , 1000, 1, 0) Sleep(10) Send ("{DOWN}") sleep (5) Send ("{ENTER}") $i = $i + 1 While $i = 2 Sleep(50) While Key("NUMPAD1") MouseClick ("right", 1500 , 1020, 1, 0) Sleep(10) Send ("{DOWN}") sleep (5) Send ("{ENTER}") $i = $i + 1 While $i = 3 Sleep(50) While Key("NUMPAD1") MouseClick ("right", 1500 , 1040, 1, 0) Sleep(10) Send ("{DOWN}") sleep (5) Send ("{ENTER}") Sleep(20) $i = $i + 1 While $i = 4 Sleep(50) While Key("NUMPAD1") MouseClick ("left", 1905 , 1047, 1, 0) Sleep (200) MouseClick ("right", 1500 , 1040, 1, 0) Sleep(10) Send ("{DOWN}") sleep (5) Send ("{ENTER}") WEnd WEnd WEnd WEnd WEnd WEnd WEnd WEnd ; going up While $i = 5 Sleep(50) While Key("NUMPAD4") MouseClick ("right", 1500 , 1040, 1, 0) Sleep(10) Send ("{DOWN}") sleep (5) Send ("{ENTER}") $i = $i + 1 While $i = 6 Sleep(50) While Key("NUMPAD4") MouseClick ("right", 1500 , 1020, 1, 0) Sleep(10) Send ("{DOWN}") sleep (5) Send ("{ENTER}") $i = $i + 1 While $i = 7 Sleep(50) While Key("NUMPAD4") MouseClick ("right", 1500 , 1000, 1, 0) Sleep(10) Send ("{DOWN}") sleep (5) Send ("{ENTER}") Sleep(20) $i = $i + 1 While $i = 8 Sleep(50) While Key("NUMPAD4") MouseClick ("left", 1905 , 987, 1, 0) Sleep (200) MouseClick ("right", 1500 , 1000, 1, 0) Sleep(10) Send ("{DOWN}") sleep (5) Send ("{ENTER}") WEnd WEnd WEnd WEnd WEnd WEnd WEnd WEnd ; change direction logic ; from down to up While $i = 3 sleep (50) While Key("NUMPAD4") MouseClick ("right", 1500 , 1020, 1, 0) Sleep(10) Send ("{DOWN}") sleep (5) Send ("{ENTER}") $i = 6 WEnd WEnd While $i = 4 sleep (50) While Key("NUMPAD4") MouseClick ("right", 1500 , 1020, 1, 0) Sleep(10) Send ("{DOWN}") sleep (5) Send ("{ENTER}") $i = 6 WEnd WEnd While $i = 2 sleep (50) While Key("NUMPAD4") MouseClick ("right", 1500 , 1000, 1, 0) Sleep(10) Send ("{DOWN}") sleep (5) Send ("{ENTER}") $i = 7 WEnd WEnd While $i = 1 sleep (50) While Key("NUMPAD4") MouseClick ("left", 1905 , 987, 1, 0) Sleep (200) MouseClick ("right", 1500 , 1000, 1, 0) Sleep(10) Send ("{DOWN}") sleep (5) Send ("{ENTER}") $i = 8 WEnd WEnd ; change direction logic ; from down to up While $i = 8 sleep (50) While Key("NUMPAD2") MouseClick ("right", 1500 , 1020, 1, 0) Sleep(10) Send ("{DOWN}") sleep (5) Send ("{ENTER}") $i = 2 WEnd WEnd While $i = 7 sleep (50) While Key("NUMPAD2") MouseClick ("right", 1500 , 1020, 1, 0) Sleep(10) Send ("{DOWN}") sleep (5) Send ("{ENTER}") $i = 2 WEnd WEnd While $i = 6 sleep (50) While Key("NUMPAD2") MouseClick ("right", 1500 , 1020, 1, 0) Sleep(10) Send ("{DOWN}") sleep (5) Send ("{ENTER}") $i = 3 WEnd WEnd While $i = 5 sleep (50) While Key("NUMPAD2") MouseClick ("right", 1500 , 1020, 1, 0) Sleep(10) Send ("{DOWN}") sleep (5) Send ("{ENTER}") $i = 4 WEnd WEnd Link to comment Share on other sites More sharing options...
Danp2 Posted May 15, 2013 Share Posted May 15, 2013 You definitely don't want all of those nested While statements. Have a look at the Switch command in the help file. P.S. What exactly are you trying to automate here? Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
spudw2k Posted May 15, 2013 Share Posted May 15, 2013 Holy cow! No offense. I am also interested in what you are automating. There may be more accurate/graceful means than what you are doing. Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
teemo Posted May 15, 2013 Author Share Posted May 15, 2013 Its for work...the firefighters want to push 1 button to switch between fire alerts. unfortunatly they have no hotkey in the program itself. And due to the fact that I'm just an intern i never used autoit before. The screen is on 2 meters my neck hurts from all the help i read today but I'll check it and keep on trying ^^ Link to comment Share on other sites More sharing options...
teemo Posted May 15, 2013 Author Share Posted May 15, 2013 it runs up it runs down i just cant change direction. Link to comment Share on other sites More sharing options...
spudw2k Posted May 15, 2013 Share Posted May 15, 2013 Check out the AutoIt Window Info tool (included with AutoIt). Depending on the software used for the fire alerts you may be able to use more sophisticated automation techniques. If you are interested in learning AutoIt it would do you good service to learn some of those methods anyways. Just my two cents. Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted May 15, 2013 Moderators Share Posted May 15, 2013 Hi, teemo. Can you provide us with an application name, or a screenshot of the window you're trying to automate, so we can see what you're seeing? It will help us in offering suggestions. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
teemo Posted May 15, 2013 Author Share Posted May 15, 2013 Application is called Winmag I can provide a screenshot as soon as i am home cause im done for today. And my phone cant upload. I think the stuff at the end cant direct to a point in the loops...but i also cant think of a way to get that done. Link to comment Share on other sites More sharing options...
teemo Posted May 15, 2013 Author Share Posted May 15, 2013 To get it straight once: in this program the alerts are shown in a window at the bottom. Now i need to press 1 button to click on the 1st line in the window...a down button Then 2 after next press then 3 and then adjust the window with the scroll arrow dow and click 3 again cause the window only has 3 alerts. that is working! And then i need an up button going up at any point in the line... And also down has to reverse at any point of the up loop. that is not working. 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