Jump to content

Search the Community

Showing results for tags 'while'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office


  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



Member Title




Found 21 results

  1. Recently I was working on a script with icons using GuiCtrkCreatIcon. I decided to change the sub folder name of the icons to a more meaning name, however made a typo. I tested the .exe on my test computer and it worked flawlessly (because both icon folder where on my test computer) 😁 But after I installed the script on the intended computers , I got chaos!😵 Zooming into the problem, I discovered, that because the icons could not be found, the ControlID were returned with a value of 0 and thus played havoc within the GuiGetMsg() switch/case statement. I have been able to reproduce this (see example) #include <GUIConstantsEx.au3> ;============================================================================================================ ; PLEASE, do not save this example in the example folder: C:\Program Files (x86)\AutoIt3\Examples\Helpfile ;============================================================================================================ Example() Func Example() GUICreate(" My GUI Icons", 250, 250) $Icon1 = GUICtrlCreateIcon("shell32.dll", 10, 20, 20) $Icon2 = GUICtrlCreateIcon(@ScriptDir & '\Extras\horse.ani', -1, 20, 40, 32, 32) $Icon3 = GUICtrlCreateIcon("shell32.dll", 7, 20, 75, 32, 32) GUISetState(@SW_SHOW) ;$Icon2 = -1 ; ==> When this line is uncommented the script "works", so -1 could be a potential fix. ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $Icon2 Beep (500,500) EndSwitch WEnd GUIDelete() EndFunc ;==>Example If you save the above script outside the Autoit example folder and run it, it will keep beeping because GuiCtrlCreatIcon did not find horse.ani and return $Icon2=0. At the moment GUICtrlCreateIcon () only returns the conntrolID on success and 0 on failure. I would like to propose a return of -1 on failure, so a existing and working script won't go awry when the icon can not be found.
  2. First off, the project I'm working on revolves around AS/400 "Client Access software", it's foundation is directly influenced by the thread linked at the bottom of this post. Moving on, to explain the problem I'm facing; my project utilizes an infinite While loop and automatically performs semi-hard coded monotonous tasks to save users time and effort, the problem is, occasionally and unexpectedly "Display Messages" will popup and the core script will continue executing instead of dismissing said message and the script "breaks". As a countermeasure I've added some code to the While loop in an effort to intervene and dismiss these display messages before the core script has a chance to do anything... however it doesn't work. I hope I didn't do too bad of a job explaining that. So I think my question is: How can I temporarily "pause" the core script when these messages spontaneously appear? The only other solution I thought of would be to check if a display message has appeared before executing every line of code but that obviously isn't very practical. Any and all help is greatly appreciated! Thanks ;Loop to keep script running and handle display messages While 1 dismiss_display_messages() Sleep(50) WEnd ;Function to dismiss display messages Func dismiss_display_messages() If $ps.SearchText("Display Messages") Then $ps.SendKeys("[enter]", 8, 1) ;This while loop waits until the display message has disappeared to resume the core script While $ps.SearchText("Display Messages") Sleep(100) WEnd EndIf EndFunc
  3. I've to upload different number of photos online in different assignments. There is a problem that all photos cannot be selected at once to upload. I have to choose and upload photos one by one. For this purpose I have made a script to automate whatever I have to do manually for choosing and uploading photos one by one. Please see my script below and check the last "MouseClick" command. This command clicks the button to choose and upload next photo. The problem I'm facing is; the last "MouseClick" works 1 step extra when all photos have been selected and uploaded. I mean if 7 photos are to be uploaded, this command opens the box from where next photo is selected and uploaded then it again opens the box and next photo is choosen and so on.... when last photo is selected and uploaded, this button once again opens the box. When all photos are uploaded, it should not click the button to select next photo. Please suggest how can I resolve this issue. #include <AutoItConstants.au3> Sleep(200) HotKeySet("{ESC}","Quit") ;Press ESC key to quit Send("{ALT DOWN}") Send("{TAB}") Send("{ALT UP}") Sleep(200) Local $photos = InputBox("Question", "How many photos to upload?", "#", "", _ - 1, -1, 0, 0) ; How many photos to upload Local $selector = 0 While $photos <> $selector MouseClick("Left", 281, 238, 1) ; mouse click on very first photo in the box. if $selector = 0 Then Send("{ENTER}") ; for selecting very first photo from "open" window. Sleep(800) Else sleep(200) Send("{RIGHT " & $selector & "}") ; for selecting 2nd to onward photos from "open" window. sleep(1000) Send("{ENTER}") sleep(1000) EndIf MouseClick("Left", 495, 198, 1) ; for clicking a button to choose next photo to upload $selector = $selector + 1 WEnd Beep(1500, 300) ; beep when all photos uploaded Exit Regards, Shakeel
  4. I want to make a while loop, that creates variables based on a array. For thist I created the array $iDsO with the number and the name of folders in an other folder. Every folder has a different name an I want to create variables(arrays) for each folder that show me all the files in that folder. For example: I have the Folder \Folder1. In it there are the Folders \1, \2, \3. In 1, 2 and 3 there are some files(.png). The array for Folder1 is $iDsO and now I want to crate the arrays $iDsO1, $iDsO2 and $iDsO3 with the files in them can I make something like this: While $iDs > 0 ;$iDs is the number of files in Folder1>> $iDsO[0] $iDs#here should come the Foldername for example '1'# = _FileListtoArray(@ProgramFilesDir&"\Folder1\"&$iDsO[$iDs]) $iDs = $iDs - 1 Wend So that in the End I have three variabels ($iDs1, $iDs2 and $iDs3) Is this posible or if not what could I do instead ( I don´t know the number of folders in Folder1 in the begining).
  5. I know on other languages when you try to use a string like this Global $sString = "Some String" If ($sString) Then ; ... EndIf The compiler will fail because string cannot be used in an expression where it needs a bool (something along those lines). But I see instances in other languages where using $sString in an expression will work and implicitly use the length of the string (or because there is some value in that variable). I'm wondering why AutoIt doesn't do the same. If the $sString is used like in my example (or some other expression where it wants a bool type) implicitly use the length of the string instead of the converting to 0?
  6. so right now i have a small project and i wanted to print this text out every second. i have made a random number for the sleep function. but when i want to print out with the while loop it just doesn't work. Run("notepad.exe") Sleep(1000) Local $rndSleep = Int (Random(180000,240000,1000)) While $rndSleep <> 0 $rndSleep - 1 If Mod ( $rndSleep, 1000 ) == 0 Then Send("This note will show the sleeptime before closing the tabs, you got " & $rndSleep & " seconds left.") EndIf WEnd plis halp me
  7. i used this code to take names for a text file called data and put the info of the image and it location from the data file into the gui interface but it only detect the lines with the info and it do not show the images . here is the code #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <MsgBoxConstants.au3> #include <WindowsConstants.au3> #include <AVIConstants.au3> #include <TreeViewConstants.au3> #include <GuiComboBox.au3> #include <GuiTab.au3> #include <file.au3> #include <array.au3> _Main() Func _Main() Local $idTab1 $Form1 = GUICreate("Form1", 500, 334, 240, 182) $Group1 = GUICtrlCreateGroup("Group1", 20, 12, 249, 314) $idButton6 = GUICtrlCreateButton("Info", 50, 270, 185, 49) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) Global $fileMPA = "C:\T-in\MPA\data.txt" FileOpen($fileMPA, 0) Global $line1 = FileReadLine($fileMPA , 1) $imp = 0 $idTab1 = GUICtrlCreateTab(300, -3, 180, 330) GUICtrlCreateTabItem("imglist1") GUICtrlSetTip(-1, '#Region TAB1') GUICtrlSetTip(-1, '#Region LIST') Local $imglist1 = GUICtrlCreateList("", 307, 26, 164, 304) $cline =_FileCountLines($fileMPA) While $imp < $cline $line2 = FileReadLine($fileMPA , $imp + 2) $imp = $imp + 7 if $line2 = "" then ExitLoop else GUICtrlSetData(-1, ""& $line2 &"", "") endif WEnd GUICtrlCreateTabItem("imagelist2") GUICtrlSetTip(-1, '#Region TAB2') GUICtrlCreateTabItem("imagelist3") GUICtrlSetTip(-1, '#Region TAB3') While 1 $Msg = GUIGetMsg() Select Case $Msg = $GUI_EVENT_CLOSE Exit Global $whatnow = GUICtrlRead($imglist1) Case $Msg = $idButton6 $imp2 = 0 While $imp2 < 30 $line2 = FileReadLine($fileMPA ,$imp2 + 2) $line3 = FileReadLine($fileMPA , $imp2 + 3) $line7 = FileReadLine($fileMPA , 7) $imp2 = $imp2 + 7 if $line2 = "" then ExitLoop If GUICtrlRead($imglist1) = ""& $line2 &"" Then MsgBox($MB_SYSTEMMODAL, "img info" , $line3) WEnd EndSelect $imp2 = 0 While $imp2 < 30 $line2 = FileReadLine($fileMPA ,$imp2 + 2) $line3 = FileReadLine($fileMPA , $imp2 + 3) $line7 = FileReadLine($fileMPA , 7) $imp2 = $imp2 + 7 Select Case GUICtrlRead($imglist1) = ""& $line2 &"" if $line2 = "" then ExitLoop $Pic1 = GUICtrlCreatePic(""& $line7 &"", 185, 28, 233, 230) If GUICtrlRead($imglist1) then ExitLoop EndSelect WEnd WEnd EndFunc ;==>_Main i wish some one can help me fix this without having to choose the images manually and i know that the script is messy but am still new in the world of autoit some bear with me . thanks for your time
  8. So currently I have some code waiting for a status to change(there is different indicators to check if this status has changed) Func oneRow($count) $globaltimer = _Timer_SetTimer($gui, 60000*10, "reset") $errTimer = TimerInit() While (1)         If PixelGetColor(1117, 326) = 0xC6C6C6 Then ExitLoop (1)         Sleep(500)         MouseClick("right")         Sleep(600)         If PixelGetColor(1117, 326) = 0xC6C6C6 Then ExitLoop (1)         If TimerDiff($errTimer) > 5000 Then             If PixelGetColor(1100, 310) = 0x707070 Or PixelGetColor(901, 305) = 0xE0E0E0 Or PixelGetColor(1043, 383) = 0xC6C6C6 Then                 Sleep(100)                 Send("{esc}")                 Sleep(1000)             EndIf         EndIf     WEnd .... EndFunc   ;==>oneRow The two timers is for error checking. This works just fine the problem comes when I go into the while 1 loop, my hotkeys at the top of the program seems to stop working, for an example HotKeySet("{f1}", "stop") Func stop() Exit EndFunc ;==>stop Does not work at all after the while loop. The globaltimer is never called even though i tried setting the delay all the way down to 3 seconds. So I thought that maybe one of the function I use is blocking so the timer would never be called/the hotkey wouldn't work? if i make an delay just before the while loop the hotkey works just fine. Oh and the errTimer is supossed to not reset after 5 seconds but should keep making the check it does if five seconds have passed
  9. #include <Misc.au3> While 1 If _IsPressed(59) Then Send("{B}") MouseDown("left") Else Send("{B}") MouseUp("left") EndIf WEnd I want the script to do this: - if I press "Y", send "B" once and hold left click down until i release "Y". - if I take my hands off of "Y" key, then send "B" once again and release left click. but the script I made has problems. when I run the script, it starts sending "B" repeatedly, and my left click won't work. I'm not smart enough to figure out what the problem is... please help me! sorry for bad English.
  10. Opt("WinDetectHiddenText",1) #include <IE.au3> #include <Array.au3> #include <File.au3> #include <MsgBoxConstants.au3> #include <clear.au3> #include <ColorConstants.au3>; Including required files #include <GUIConstantsEx.au3> #include <file.au3> #include <string.au3> Sleep(5000) Local $emails = "email.txt" ;sets file path Local $pwd = "pwd.txt" ;sets file path Local $name = "name.txt" Local $ArrayEmail[57], $ArrayPwd[57], $ArrayName[57] ;declares array _FileReadToArray($emails, $ArrayEmail) ;converts file to array _FileReadToArray($pwd, $ArrayPwd);converts file to array _FileReadToArray($name, $ArrayName);converts file to array Local $url= "https://localhost/signup" Local $oIE = _IECreate($url, 1) $tags = $oIE.document.GetElementsByTagName("a") For $tag in $tags $class_value = $tag.GetAttribute("class") If string($class_value) = "badge-signup-email-link" Then $oCorrectObj = $tag ExitLoop EndIf Next If IsObj ( $oCorrectObj ) Then _IEAction ($oCorrectObj, "click") EndIf Local $name = _IEGetObjByName ($oIE, "fullname") Local $email = _IEGetObjByName ($oIE, "email") Local $password = _IEGetObjByName ($oIE, "password") _IEFormElementSetValue($name, $ArrayName[1]) _IEFormElementSetValue($email, "" & ++1 & $Arrayemail[1]) _IEFormElementSetValue($password, $ArrayPwd[1]) $colTags = _IETagNameGetCollection($oIE, "input") For $oTag In $colTags If $oTag.value = "Sign Up" Then sleep(15000) _IEAction($oTag, "click") _IENavigate($oIE,"javascript:void(0);") ; javascript:void is triggered. EndIf Next I coded this script and silly me forgot to create it in a loop to begin with -.- now I have tried While & For loop with counters and what not, but I just can't seem to get it to work. Could someone be of assistance? Thanks in advance.
  11. Hi guys, I would like to create a button which restarts the script from a set point from me.. Unfortunately with: Run(FileGetShortName(@AutoItExe) & " " & FileGetShortName(@ScriptFullPath)) I repeated everything the script , however I need to do it again from a point that I imposed.. Thank's..
  12. I got a while loop, if something happens the while loop shall stop, but shall continue after a specific time like lets say 10 minutes, how would you manage this.
  13. I got these function but somehow only the first one gets called. test01() test02() test03() test04() test05() Func test01() While 1 ConsoleWrite("01") WEnd EndFunc Func test02() While 1 ConsoleWrite("02") WEnd EndFunc Func test03() While 1 ConsoleWrite("03") WEnd EndFunc Func test04() While 1 ConsoleWrite("04") WEnd EndFuncIs there a way to accomplish this this way?
  14. Hey, I have to move something to the upper line, and then scan line by line from above to below, with letting out the row I started on. Any ideas on this?
  15. hi everyone . Learning more and more of autoit and i have to say it is VERY powerful. now im into a small automation project Here is what i plan : i want , using while/ wend to monitor a log file of an application and when there is a line added i need that auto it " exports" that line i need this for an automation of my ftp server. it checks sfv files and when an upload is " COMPLETE " the ftp server logs it . i need that when there is written this log entry to extract it and run unrar is some regex parameters are met. the hard part is the real time monitoring at the moment my code is very unsuccessful (if required i can paste it here) plus after 40 sec of run time i usually get an out of memory error can you please me show some effective ways of to monitor a file and extract last written line (guess using readline -1) in real time ? thx and regards
  16. Hello, I am relatively new to autoit (and this type of programming in general, typically do front end web dev). I have been tasked with writing some scripts to login to, navigate, and download files from some private websites. I have been hacking my way through these projects with plenty of wrong turns, cursing, and confusion. I currently have a script that works, but utilizes some rather lengthy Sleep times to manage varying page loading times. During page loads, there will often be text that says "Page Loading" I am trying to write some code to check whether this exists after particular steps, then if it does sleep for a few seconds, then check again until it no longer exists (page has loaded) then proceed. This is what I was trying based on sample code that I've seen throughout my google searches. It doesn't seem to work correctly, can someone point out what I'm doing wrong, or provide links to a 'for dummies' explanation of how to do what I'm trying to do? $body = _IEBodyReadHTML($oIE) While If StringInStr($body, "Page Loading")== 1 Then Sleep(5000) Else EndIf WEndThank you for your insight.
  17. I am having problem. I have script that has a main GUI window that allows you to select which kind of encryption you'd like to use. When I go to start the script, for some reason the case statement for the: $iSubmit button for the child GUI runs right away and tried to read the data from the input on the child window, which hasn't been created yet, and then pops up the MsgBox. I have been scouring the forums for something of similar nature, but unsuccessful. I have checked helpfile and it seems I am doing this correct. Here is my script: ; includes #include <GUIConstantsEx.au3> #include <Crypt.au3> ; vars Local $hGUI, $msg = 0, $hInput, $iButton, $hDecode, $dButton Local $aChkBx[8], $cValue, $iChild, $iMsg, $iPswd, $iMsgBox Local $iPswdBox, $iSubmit ;main line GUI() While 1 $msg = GUIGetMsg(1) Switch $msg[1] Case $hGUI Switch $msg[0] Case $GUI_EVENT_CLOSE Quit() Case $iButton getCheckbox() inputChild() ;Crypt(, $cValue) Case $dButton getCheckbox() EndSwitch Case $iChild Switch $msg[0] Case $GUI_EVENT_CLOSE GUIDelete($iChild) Case $iSubmit $iMsg = GUICtrlRead($iMsgBox) $iPswd = GUICtrlRead($iPswdBox) MsgBox(0, "title", "msg:" & $iMsg & " paswrd:" & $iPswd) EndSwitch EndSwitch WEnd ;functions Func GUI() $hGUI = GUICreate("Short-Order Encrypter", 300, 200) GUICtrlCreateLabel("Encrypt a Message!", 95, 15) GUICtrlCreateLabel("This is a simple input and output encryption program.", 25, 35) GUICtrlCreateLabel("You will select which method of encryption, then", 30, 48) GUICtrlCreateLabel("input your text by pressing the Input button,", 40, 61) GUICtrlCreateLabel("or you will press the Decode button to", 55, 74) GUICtrlCreateLabel("decode an encrypted message.", 65, 87) $iButton = GUICtrlCreateButton("Input", 50, 160, 70, 30) $dButton = GUICtrlCreateButton("Decode", 160, 160, 70, 30) $aChkBx[0] = GUICtrlCreateCheckbox("Text", 15, 105) $aChkBx[1] = GUICtrlCreateCheckbox("3DES", 67, 105) $aChkBx[2] = GUICtrlCreateCheckbox("AES (128bit)", 122, 105) $aChkBx[3] = GUICtrlCreateCheckbox("AES (192bit)", 208, 105) $aChkBx[4] = GUICtrlCreateCheckbox("AES (256bit)", 32, 130) $aChkBx[5] = GUICtrlCreateCheckbox("DES", 121, 130) $aChkBx[6] = GUICtrlCreateCheckbox("RC2", 172, 130) $aChkBx[7] = GUICtrlCreateCheckbox("RC4", 224, 130) GUISetState(@SW_SHOW) EndFunc ;==>GUI Func getCheckbox() Local $i, $readArray, $cCounter = 0 For $i = 0 To UBound($aChkBx) - 1 Step 1 $readArray = GUICtrlRead($aChkBx[$i]) If $readArray = 1 Then $cCounter += 1 $cValue &= $i EndIf Next If $cCounter > 1 Then MsgBox(0, "Encryption Type", "Could not specify encryption type due to multiple selections. Please make sure you have only selected on type of encryption") $cValue = "" Return ElseIf $cCounter = 0 Then MsgBox(0, "Encryption Type", "You must select an encryption type in the Short-Order Encrypter window") Return EndIf EndFunc ;==>getCheckbox Func inputChild() If $cValue = "" Then Return EndIf $iChild = GUICreate("Input Message", 386, 120, -1, -1, -1, -1, $hGUI) GUICtrlCreateLabel("Message", 5, 10) GUICtrlCreateLabel("Password", 200, 10) $iMsgBox = GUICtrlCreateInput("", 5, 25, 180, 60) $iPswdBox = GUICtrlCreateInput("", 200, 25, 180, 60) $iSubmit = GUICtrlCreateButton("Encrypt", 172, 90) GUISetState() EndFunc ;==>inputChild #cs Func Crypt($iMsg, $iPass, $iflag) Local $mFlag[8] $mFlag[0] = "TEXT" $mFlag[1] = $CALG_3DES $mFlag[2] = $CALG_AES_128 $mFlag[3] = $CALG_AES_192 $mFlag[4] = $CALG_AES_256 $mFlag[5] = $CALG_DES $mFlag[6] = $CALG_RC2 $mFlag[7] = $CALG_RC4 EndFunc ;==>Crypt #ce Func Quit() GUIDelete($hGUI) Exit EndFunc ;==>Quit
  18. Hello FellowForumers I have some questions about this subject and Although I have researched about i have some problems let it sink in proper Although i have basic understanding of Global and Local I Still have questions to be absolute sure: #include <Array.au3> Global $TSAB[20] While 1 trading() If $TSAB[19] = True Then MsgBox(0,"","Thank you AutoIT Forum ^^ ") ;~ If $TSAB[19] = True then Exit WEnd func trading() $TSAB[19] = "" $TSAB[7] = "" while 1 _ArrayDisplay($TSAB) $TSAB[7] = "done" _ArrayDisplay($TSAB) If $TSAB[7] = "Done" Then $TSAB = ClientDoneCommand() _ArrayDisplay($TSAB) If $TSAB[19] = True then Return $TSAB WEnd EndFunc func ClientDoneCommand() $TSAB[19] = True Return $TSAB EndFunc My own example Above gives to me Decent understanding that Global can be called anywhere in the program and that the global variable is sent and called towards other functions and loops as it was just before it got sent or returned is there anything I have to keep in mind to Prevent any big mess? Am I something missing about this or has anyone some advice? I will use this global as the soul of my program and store information on where it has been and been and what functions it has visit and what it has been doing etc Here I move to Local $var So I got the same script and added some Local var: #include <Array.au3> Global $TSAB[20] local $hugs = "" While 1 ConsoleWrite($hugs & "0" & @LF) ;Added line $hugs = trading() If $TSAB[19] = True Then MsgBox(0,"","Thank you AutoIT Forum ^^ ") ;~ If $TSAB[19] = True then Exit ConsoleWrite($hugs & "1" & @LF) ;Added line WEnd func trading() $TSAB[19] = "" $TSAB[7] = "" local $hugs = "yes" while 1 ConsoleWrite($hugs & "2" & @LF) ;Added line _ArrayDisplay($TSAB) $TSAB[7] = "done" _ArrayDisplay($TSAB) If $TSAB[7] = "Done" Then $TSAB = ClientDoneCommand($hugs) _ArrayDisplay($TSAB) ConsoleWrite($hugs & "4" & @LF) ;Added line If $TSAB[19] = True then Return $TSAB WEnd EndFunc func ClientDoneCommand($hugs) $TSAB[19] = True ConsoleWrite($hugs & "3" & @LF) ;Added line $hugs = "Maybe" Return $TSAB EndFunc Here I added a few console writes and numbered them the consolewrite output is 0 yes2 yes3 yes4 1 repeat So the following things I see in my blurry mind as are as follow at the very start I need to declare Local $hugs = "" else ; ConsoleWrite($hugs & "0" & @LF) ;Added line will have variable used before declaration (meaning nothing has been stored ever which I understand) Now here comes an interesting part to me, about: $hugs = trading() If $TSAB[19] = True Then MsgBox(0,"","Thank you AutoIT Forum ^^ ") ;~ If $TSAB[19] = True then Exit ConsoleWrite($hugs & "1" & @LF) ;Added line here Happens nothing , not even a error (which I expected) I do not get a consolewrite: 0 it does not output anything I understand that the functions has not returned the variable of local $hugs = "yes" or $hugs = "Maybe" But I expected an error, why no error? What Happens with the at line 33 $hugs = "Maybe" does it get lost? deleted (from the memory ) at the end of the function? @ line 17? local $hugs = "yes" Would it be wise to write there local $hugs = "yes" or is $hugs = "yes" Good enough , does it really matter with managing anything? and as last I also understand if I would change that at line 26 that it is not needed the write return $TSAB but just return would be good enough? because $TSAB is in every function / If / while for next loop avaiable and it will carry over the information stored inside of it? if i would change it into Return $hugs then ConsoleWrite($hugs & "1" & @LF) will give me yes1 and even at the very start of the while loop ConsoleWrite($hugs & "0" & @LF) will give me yes0 and it was previous just 0 so it seems anything wrong here? so it seems the local does not get lost at the end of the while loop then my final questions about for / next For $z = 0 to 9 For $x = 0 to 9 For $y = 0 to 9 ConsoleWrite($z & $x & $y & @LF) next next next if $z = 9 Then MsgBox(0,"","1000 ^^ ") if $x = 9 Then MsgBox(0,"","x = 9 ^^ ") if $y = 9 Then MsgBox(0,"","y = 9 ^^ ") the Variable $z , $x and $y are they only used in the for next loop or can they be used outside of it? my msgboxs do not work here after the next so i guess they end right away in the for next loop any tips or suggestions are welcome if i am saying anything wrong or retarded here Cheers Butterfly
  19. Just trying to use a simple While loop to watch for input in a GUI window, but when I go to run it and then give the input. It seems to completely hang and I must at that point stop it manually and restart. I know I'm missing something (could be trivial), but a push would be greatly appreciated. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiButton.au3> #include <EditConstants.au3> #include <MsgBoxConstants.au3> Local $F1Button, $F1Key HotKeySet("{Esc}", "Quit") $F1Key = HotKeySet("{F1}", "UnlockCar") GUI() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_Event_Close Quit() Case $msg = $F1Button UnlockMe() EndSelect WEnd Func GUI() $DisclaimerHandle = GUICreate("Disclaimer", 525, 245, -1, -1, -1, $WS_EX_TOPMOST) ;Creates the GUI window GUICtrlCreateLabel("example", 7, 15) GUICtrlCreateLabel("", 7, 30) GUICtrlCreateLabel("example", 7, 45) GUICtrlCreateLabel(" example", 7, 60) GUICtrlCreateLabel("", 7, 75) GUICtrlCreateLabel("example", 7, 90) GUICtrlCreateLabel("example", 7, 105) GUICtrlCreateLabel("example", 7, 135) GUICtrlCreateLabel("example", 7, 165) GUICtrlCreateLabel("if using a touchscreen press the F1 button below.", 7, 180) $F1Button = GUICtrlCreateButton("F1", 217, 205, 50, 30) GUISetState(@SW_SHOW) ;Shows the GUI window EndFunc ;==>GUI Func UnlockMe() MsgBox(0, "I work", "I work") Quit() EndFunc ;==>UnlockMe Func Quit() GUIDelete() Exit EndFunc ;==>Quit
  20. Hopefully this is a dumb, easy question. I have three input fields, and I would like to parse the data entered in the first field to generate default data for the other two. But I only want that to run while the first field has focus, or else the data could not be changed. So I imagined I could use a While loop testing the state of $name, expecting it to be 256 (The value of $GUI_FOCUS from GUIConstantsEx.au3). But when I do that, the functions never run. I checked the state of the field with a Label, and it shows that the state is 80. (There's no GUI Constant for 80.) It seems to return 80, though, regardless of whether the field has focus or not. When I While Loop on 80, as soon as the field loses focus, it locks up. What gives? GUICreate("New Account",265,110,-1,-1,-1,-1,$mainwindow) GUICtrlCreateLabel("Full Name:",5,7) GUICtrlCreateLabel("Username:",5,32) GUICtrlCreateLabel("Password:",5,57) Dim $name = GUICtrlCreateInput("",60,5,200,20) Dim $uname = GUICtrlCreateInput("",60,30,200,20) Dim $pass = GUICtrlCreateInput("",60,55,200,20) Dim $newacctbtn = GUICtrlCreateButton("Create Account",5,80,100,25) Dim $state = GUICtrlCreateLabel("",230,90) GUISetState(@SW_SHOW) While True Dim $msg2 = GUIGetMsg() ;GUICtrlSetData($state,GUICtrlGetState($name)) While GUICtrlGetState($name) = XXX GUICtrlSetData($uname,NameToUname(GUICtrlRead($name))) GUICtrlSetData($pass,GenPass(GUICtrlRead($name))) WEnd If $msg2 = $newacctbtn Then MsgBox(0,"","snth") If $msg2 = -3 Then ExitLoop WEnd Func NameToUname($input) If $input <> "" And StringInStr($input," ") > 0 Then Local $finit = StringLeft($input,1) Local $array = StringSplit($input," ") Local $lname = $array[$array[0]] Return StringLower($finit & $lname) Else Return "" EndIf EndFunc Func GenPass($input) If $input <> "" And StringInStr($input," ") > 0 Then Local $finit = StringLeft($input,1) Local $array = StringSplit($input," ") Local $linit = StringLeft($array[$array[0]],1) Return StringLower($finit & $linit & @YEAR) Else Return "" EndIf EndFunc
  21. Hello, i try to parse some info from one site, just for fun and experience. But have some problems, while parsing can't find needed formula, to make it more easy and performance, can someone help. Critics allowed, i know code is very bad.. sorry long time no sleep. Trouble part: I have removed coz question is to stupid ^^ sry for spam. Thanks in any case.
  • Create New...