Jump to content
  1. nacerbaaziz


  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By NassauSky
      Hi all,
      The more projects I work on, the harder it is to find old scripts I created with certain techniques in them. I'd like to leave this here for others to get an idea from and it will be available now by keyword searching in this forum.
      This project needed an evenly distributed button grid setup on a touch screen with half decent sized buttons and spacing so the user would be less likely to press the key beside it. Here is one quick example to give anyone an idea of a way to handle it.
      #include <GUIConstants.au3> GUICreate("Button Grid", 1080, 100) ; will create a dialog box that when displayed is centered GUISetState(@SW_SHOW) ; will display an empty dialog box ;--Create and Position Controls Dim $btnActivated[1][2] ;Col 1 is button id, Col 2 is True/False used in 1 example as depressed Dim $btnArray[100][2] ;Col 1 is button id, Col 2 is True/False used in 1 example as depressed $num = 0 $btnActivated[0][0] = GUICtrlCreateButton("Activated", 0, 0, 100, 100) ;x,y,w,h $btnActivated[0][1] = True GUICtrlSetBkColor(-1,0x00ff00) GUICtrlSetColor(-1,0x005500) GUICtrlSetFont(-1,14) For $Y = 0 To 1 For $X = 0 To 7 ConsoleWrite( ($X * 100) + ($X*20) + 120 & @CRLF) If $Y=0 Then $btnArray[$num][0] = GUICtrlCreateButton($num + 1, ($X * 100) + ($X*20) + 120, 0, 100, 40) ;x,y,w,h Else $btnArray[$num][0] = GUICtrlCreateButton($num + 1, ($X * 100) + ($X*20) + 120, ($Y * 40) + $Y*20, 100, 40) ;x,y,w,h EndIf GUICtrlSetBkColor($btnArray[$num][0], 0xFFFFFF) $num += 1 Next Next ;--Set Button Names GUICtrlSetData($btnArray[0][0],"Autoit") GUICtrlSetData($btnArray[1][0],"Is") GUICtrlSetData($btnArray[2][0],"Cool") ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop Case $btnActivated[0][0] $btnActivated[0][1] = NOT $btnActivated[0][1] If $btnActivated[0][1] Then GUICtrlSetBkColor($btnActivated[0][0],0x00ff00) GUICtrlSetColor($btnActivated[0][0],0x005500) GUICtrlSetData($btnActivated[0][0],"Activated") GUICtrlSetFont($btnActivated[0][0],14) Else GUICtrlSetBkColor($btnActivated[0][0],0xFF9999) GUICtrlSetColor($btnActivated[0][0],0x550000) GUICtrlSetData($btnActivated[0][0],"DeActivated") GUICtrlSetFont($btnActivated[0][0],13) EndIf Case $btnArray[0][0] If $btnActivated[0][1] Then MsgBox(0,"Notice","Btn1",1) EndIf Case $btnArray[1][0] If $btnActivated[0][1] Then MsgBox(0,"Notice","Btn2",1) EndIf Case $btnArray[2][0] If $btnActivated[0][1] Then MsgBox(0,"Notice","Btn3",1) EndIf EndSwitch WEnd I couldn't find one of my old projects that broke the button array into more columns that included the actual button name in the field. Feel free to share your own or share a more flexible version of this simple example.

    • By Vipan
      I have developed Java maven based framework and integrated AutoIt in it. I am automated a desktop application. During automation, I am facing below issue. Can someone please guide me?
      1. I am unable to select a menu option from a nested tree view:
              TreeOption ToSelect
      In above case, TreeTitle1 is a folder in which TreeTitle2 is another folder and the TreeOptionToSelect is the one i want to select.
      I tried below command:
      AutoItX autoIt = new AutoItX();
      But it didn't work... kindly help
    • By TheAlienDoctor
      Hi, I was looking into creating a script that would detect if a file exists, then move it (and in some cases rename it, depending on the file) as well as write to a log file.
      The issue is, there is a lot of files that need to be moved, sometimes some files will exist and others won't depending on the use-case. However if a file does exist, it will always be going into the same directory with the same name.
      Currently I have an array nested inside of the array, with each array inside that array having both the old and new directory, and then a For loop to actually run through and do the file transferring. The issue I am having is how to call the Array inside of the array, because how do I specify  which the old directory is and which the new is?
      Global $FileTransfer[2000] = [Global $Dir1[2] = ["original dir 1", "new dir 1"], Global $Dir2[2] = ["original dir 2", "new dir 2"]] For $FileTransfer = [0] To [1] Step +1 If FileExists({original dir}) Then FileMove({original dir}, new dir, 1) FileOpen("log.latest.txt", 1) FileWrite("log.latest.txt", "{original dir} found, moved it to new dir." & @CRLF) FileClose("log.latest.txt") Else FileOpen("log_latest.txt", 1) FileWrite("log_latest.txt", "{original dir} not found, ignoreing it." & @CRLF) FileClose("log_latest.txt") EndIf Next I have put what I want the old and new directory to be for each array in {}, so hopefully its easier to tell which part is working and whats not.

      I am still reasonably new to AutoIT, any help is appreciated. Thankyou
    • By It_is_me_Me
      I am making some GUI with combobox for the Baudrates communications and I listed 9600, 57600, 115200. 
      I wrote the code to be defaulted to 57600 like this:
      GUICtrlSetData($comboBox_opticalBaudRate, "9600|57600|115200", "57600")
      But I wanted the GUI to remember the last item the user picks so the baudrates will NOT be defaulted to 57600.
      Example, I pick 9600 as my baudrates, then I close the GUI, after opening it, it always prompt 57600 since that is what I did in my code. But I want that if I choose 9600 and close the GUI, opening it again will show 9600 now instead of 57600.
      Is there a way to do it in GUI setting?
    • By arunkw
      I have a spreadsheet - daily routine which has two columns: activity and time as shown here
      | Activity             | Time     | |----------------------|----------| | Sleep               |  6:00 am | | Toilet              |  6:15 am | | Get ready for gym  |  6:30 am | | Exercise            |  7:50 am | | ... more things      |  9:00 pm | | ... still more       | 10:45 pm | | Sleep               |  6:00 am |   I wanted to find out, say in C1 which activity is current for me using now() I.e., if it’s 6:45am on my watch, it should show me Exercise  in C1 Thanks to Adam D. PE, this formula works like magic to get the result =VLOOKUP(MOD(NOW(),1),{B2:B,A2:A},2,1)   Now, I want to reproduce same result in autoit, how to do that? To have easy solution say, I copy-paste spreadsheet data in array directly in code, right? Use for loop and run the above vlookup function and show the answer using tooltip. How to achieve this? please help.  
  • Create New...