Search the Community
Showing results for tags 'while 1'.
-
Hello to everyone I am relatively new to autoit script, I did a lot of research and mostly my script is formed by combining scripts and using the help file, so if it possible to help me with this one. When it gets clicked the row with the second book will open like first one so in need to get back to "while 1" to create a new directory and when "$nr" gets to 45 I need to scroll down and get pos of the las row i exported. i used image search #include <ImageSearch.au3> HotKeySet("{space}", "Terminate") #include <AutoItConstants.au3> f2() func f2() EndFunc $x1=0 $y1=0 MouseClick("left",242,249,1,1) ToolTip("mouse set") Sleep(400) While 1 $result = _ImageSearch("book.bmp",1,$x1,$y1,0) if $result=1 Then MouseMove($x1,$y1,3) MouseClick("left",$x1,$y1,1) ; folder name MouseMove(453,212,0) sleep(50) MouseClick("left",453,212,1,1) sleep(50) Send ("^a") Send ("^c") $fname = ClipGet() ; Folder code MouseMove(67,213,0) sleep(50) MouseClick("left",67,213,1,1) sleep(50) Send ("^a") Send ("^c") $fcode = ClipGet() ;create and open directory ToolTip("Mouse here") Sleep(1000) ToolTip("clicked on in") DirCreate("D:\DB\" & $fcode & " " & $fname) ShellExecute("D:\DB\" & $fcode & " " & $fname) Sleep(1000) MouseClick("left",$x1+100,$y1+16,1) ;Start copy $y1= $y1+16 elseif $result =0 Then $nr=0 f1() func f1() $locpart =$y1 While $locpart <>974 $locpart = $locpart + 16 $nr= $nr + 1 ;when $nr gets to 45 MouseWheel($MOUSE_WHEEL_down, 14) and reset mouse location MouseMove(220, $locpart ,1) MouseClick("left",220, $locpart,1) sleep(1000) ;break when second book if find and return to while 1 if $result = 1 Then f2() WinActivate("Selección de Parámetros") sleep(200) if WinActive("Selección de Parámetros") then Send ("{esc}") endif ToolTip("Mouse Here " & $nr) sleep(50) MouseMove(34,173,0) sleep(50) MouseDown($MOUSE_CLICK_LEFT) sleep(50) MouseMove(2464,339,0) ToolTip("mouse here") Sleep(50) MouseUp($MOUSE_CLICK_LEFT) WinActivate("Reemplazar u omitir archivos") sleep(200) if WinActive("Reemplazar u omitir archivos") then Send ("{esc}") endif WEnd EndFunc ;scroll ;else ;MouseWheel($MOUSE_WHEEL_down, 14) endif WEnd Func Terminate() SplashTextOn("Exit","EXIT PROGRAM") Sleep(600) Exit EndFunc ;==>Terminate
-
Good Afternoon All Let me start by saying... I'm not sure if this belongs in the GUI part of the forum as it's more of a loop / code / dynamic GUI layout issue. I understand if you move it though. I have been doing some crazy things in AutoIT lately and one of them just so happens to be an accidental infinite loop. I am dynamically populating my GUI labels... so that means if I have a users ip address I create $L_PP1_WhoISSearch However, if I assign a function to a non existent label... for instance a user has no ip address or it is invalid, I get an infinite loop / crash. The While loop below just goes crazy running ShellExecute. Since the label $L_PP1_WhoISSearch doesn't exist, the function WhoISSearch() just runs ShellExecute to infinity... What should I do differently??? Is there a trigger I can set in the Gui to ignore missing cases??? Sorry, I can only provide "snippets" of my code since it's for work. Thanks you all!!! ; This is my loop of doom if the $L_PP1_WhoISSearch doesn't exist in my gui. While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $L_PP1_DashboardLink DashboardLink01() Case $L_PP1_WhoISSearch WhoISSearch() Case $B_PP1_BACK02 GUIDelete() Gui01_PP_INC() Case $B_PP1_EXIT02 Exit EndSwitch WEnd Func WhoISSearch() ShellExecute('http://whois.arin.net/rest/nets;q=' & $PP1_SourceIPClick01 & '?showDetails=true&showARIN=false&showNonArinTopLevelNet=false') ;MsgBox (0, "", 'WTF') EndFunc; This is my dynamic label for my Gui. ElseIf $i = 5 Then $L_PP1_SourceIP = GUICtrlCreateLabel($LabelVariable & ' ' & $aArray_Variable_PP_Gui01[$i], 10, $L_PP1_Var_StartHeight, 316, 19) GUICtrlSetFont(-1, 10, 800, 0, "Calibri") $L_PP1_Var_StartHeight += 22 $L_PP1_WhoISSearch = GUICtrlCreateLabel('WhoIS Search: ' & $PP1_SourceIPClick01, 10, $L_PP1_Var_StartHeight, 316, 19) GUICtrlSetFont(-1, 10, 800, 0, "Calibri") GUICtrlSetColor(-1, 0x0000FF) $L_PP1_Var_StartHeight += 22