Search the Community

Showing results for tags 'GUI'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • General
    • Announcements and Site News
    • Chat
    • 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


  • Forum
  • AutoIt


  • Community Calendar

Found 325 results

  1. Hi I have jus started using auto-it . Please correct me if I'm wrong. I need to read data from an input in text box and search in excel file and return value in next column of matched cell on GUI. I have written below code but i cannot use variable which has data stored. it works only when search string is hard coded. Please help out. Example() Func Example() Local $GuiMain = GUICreate("EXCEL TEST", 399, 180) ;creates main GUI ;~ Local $idOK = GUISetOnEvent($GUI_EVENT_CLOSE, "Close") Local $iWidthCell = 70 Local $idLabel = GUICtrlCreateLabel("PART NUMBER", 10, 30, $iWidthCell,50) Local $RUN_1 = GUICtrlCreateButton("OK", 70, 70, 85, 25) Local $Input_1 = GUICtrlCreateInput("PART NUMBER", 100, 20, 120, 20) Local $sMenutext = GUICtrlRead($Input_1, 1) GUISetState(@SW_SHOW, $GuiMain) While 1 $MSG = GUIGetMsg() Select Case $MSG = $GUI_EVENT_CLOSE Exit Case $MSG = $RUN_1 Local $oAppl = _Excel_Open() Local $sFilePath1 = "D:\Anu_WorkFolder\Components.xlsx" Local $oWorkbook = _Excel_BookOpen($oAppl, $sFilePath1, Default, Default, True) Local $aResult = _Excel_RangeFind($oWorkbook, $sMenutext , Default, Default, $xlWhole)
  2. Hello all ~ I am running an autoit script on Windows 10 inside VMware Workstation 12 Pro version 12.5.2. Technically I am remoting into ESXi which has a Domain Controller (DC), WebServer, FilServer, Windows 10, etc. Using the GUI (i.e. running explorer.exe) I am able to open several different folders successfully. The desktop, documents, USB external all open without issue. The network share opening gives me issues. Whenever I attempt to open \\filserver\users\user\sharedfolder I get the documents folder instead. I understand that the documents folder is the default for explorer. I have also attempted to use the letter drive mapped to the network share (Z:) and receive the same result. When I run this script on Windows 10 alone without the VM or the ESXi I am able to open the network share without problems. I have tried to use the net use command to designate a letter M: to the network share folder prior to running the script. This did not work for me. One additional avenue I think might work is to use the systreeview321 and _GUICtrlTreeView_FindItem to step through the tree looking for the network share. Once found, double click on it and see if that opens the shared network folder. I can click inside the VM with my mouse on the network share and it opens just fine. Not sure if running up against GUI issues, or permission issues, or what? Thanks in advance, Davida Crozier TestNetworkShare.au3 This script is a subset of a much larger program, but it illustrates what I am dealing with.
  3. Hi everyone, GUICtrlSetState Function example ,i found $GUI_DROPACCEPTED isn't working in windows10 x64(windows_10_enterprise_2016_ltsb_x64). if the example put to windows10 x86 or windows xp, the $GUI_DROPACCEPTED is effective, the AutoIt Edition is v3.3.14.2. any ideas? thanks you. #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Example() Func Example() ; Create a GUI with various controls. Local $hGUI = GUICreate("Example", 420, 200, -1, -1, -1, $WS_EX_ACCEPTFILES) ; Create a label and set the state as drop accepted. Local $idLabel = GUICtrlCreateLabel("Drop a file on this label.", 10, 10, 400, 40, $WS_BORDER) GUICtrlSetState($idLabel, $GUI_DROPACCEPTED) ; Create an input and set the state as drop accepted. Local $idInput = GUICtrlCreateInput("", 10, 60, 400, 22) GUICtrlSetState($idInput, $GUI_DROPACCEPTED) Local $idOK = GUICtrlCreateButton("OK", 310, 170, 85, 25) ; Display the GUI. GUISetState(@SW_SHOW, $hGUI) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idOK ExitLoop Case $GUI_EVENT_DROPPED ; If the value of @GUI_DropId is $idLabel, then set the label of the dragged file. If @GUI_DropId = $idLabel Then GUICtrlSetData($idLabel, @GUI_DragFile) EndSwitch WEnd ; Delete the previous GUI and all controls. GUIDelete($hGUI) EndFunc ;==>Example
  4. Hey Guys, So, the functions work, where primarygui() accurately determines the evaluation of the status of the checkboxes - the msgbox picks this up. However, later on, when we re-enter a 'for $i = 0 to ubound($checkbox)' loop, then in the 'batchinitial' function it doesn't picked up that the status&$i = 1, so it jumps out, then within the While 1 loop, it exits the loop in the first row, again because the status& $i= 0 The "assign" line within the primarygui funtion, is this only a local assignment? if so, how can I make it cross function? Thank in adv for your help Func excelsheetlist() $i = 0 Global $aWorkSheets = _Excel_SheetList($oWorkbook1) If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_SheetList Example 1", "Error listing Worksheets." & @CRLF & "@error = " & @error & ", @extended = " & @extended) ;_ArrayDisplay($aWorkSheets, "Excel UDF: _Excel_SheetList Example 1") ;_ArrayDisplay($aWorkSheets, "Array") Global $iRows = UBound($aWorkSheets, $UBOUND_ROWS) ; Total number of rows. In this example it will be 10. Global $iCols = UBound($aWorkSheets, $UBOUND_COLUMNS) ; Total number of columns. In this example it will be 20. Global $iDimension = UBound($aWorkSheets, $UBOUND_DIMENSIONS) ; The dimension of the array e.g. 1/2/3 dimensional. MsgBox($MB_SYSTEMMODAL, "", "The array is a " & $iDimension & " dimensional array with " & _ $iRows & " row(s) & " & $iCols & " column(s).") Dim $checkbox[$iRows] EndFunc ;==>excelsheetlist Func primarygui() ; Create a GUI with various controls. Local $hGUI = GUICreate("Script Controller", 300, ($iRows * 24)) ; Create a checkbox control. ;Local $idCheckbox = GUICtrlCreateCheckbox("Standard Checkbox", 10, 10, 185, 25) Local $Button2 = GUICtrlCreateButton("Close", 210, 200, 85, 25) Local $Button3 = GUICtrlCreateButton("Run", 210, 170, 85, 25) Local $Button1 = GUICtrlCreateButton("Discharge", 210, 140, 85, 25) For $i = 0 To UBound($checkbox) - 1 $checkbox[$i] = GUICtrlCreateCheckbox($aWorkSheets[$i][0], 8, 0 + ($i * 24)) ;, 81, 17) Next ; Display the GUI. GUISetState(@SW_SHOW, $hGUI) ; Loop until the user exits. While 1 $nMsg = GUIGetMsg() Select Case $nMsg = $GUI_EVENT_CLOSE Exit Case $nMsg = $Button2 ;Close Exit Case $nMsg = $Button1 MsgBox(0, "Discharge Button not configured", "Now Exiting") Exit Case $nMsg = $Button3 ;Run $fSelection = False For $i = 0 To UBound($checkbox) - 1 If BitAND(GUICtrlRead($checkbox[$i]), $GUI_CHECKED) Then $fSelection = True ExitLoop EndIf Next If $fSelection Then For $i = 0 To UBound($checkbox) - 1 Assign("status" & $i, GUICtrlRead($checkbox[$i])) Next $batchcount = 0 For $i = 0 To UBound($checkbox) - 1 If Eval("status" & $i) = 1 Then $batchcount = $batchcount + 1 ;Call ("o" & $i & "copy") ; if you want to call the functions directly, remove ; before the call and comment or delete the following DirCopy statement MsgBox(0, "Checking", "Checking that: " & $checkbox[$i] & " no, with title: " & $aWorkSheets[$i][0] & " was selected, Batch count: " & $batchcount) ; if you need only the DirCopy EndIf Next ExitLoop Else MsgBox(48, 'No Items Selected', 'You have not selected any Patients to Load, Please select from the list') EndIf EndSelect WEnd ; Delete the previous GUI and all controls. GUIDelete($hGUI) EndFunc ;==>primarygui Func _IsChecked($idControlID) Return BitAND(GUICtrlRead($idControlID), $GUI_CHECKED) = $GUI_CHECKED EndFunc ;==>_IsChecked Func batchinitial() If Eval("status" & $i) = 1 Then debugbox() $oWorkbook1.Sheets(1).Activate $bigloop = $bigloop + 1 $sheet = $aWorkSheets[$i][0] $oWorkbook1.Sheets($sheet).Activate debugbox() EndIf EndFunc ;==>batchinitial OpenExcel() excelsheetlist() primarygui() For $i = 0 To UBound($checkbox) - 1 batchinitial() While 1 If Eval("status" & $i) = 0 Then ExitLoop ;all the rest of my script loops etc WEnd Next
  5. Hello everyone ! While writing a sample of code to test ping to my internet box, I got stuck.. While the code is Pinging with let say.. 5000ms of timeout, I need to update a progress bar from 0 to 5000 ms at the same time but I don't know how could I do this.. Is there a way or something that could get around the pause of the ping like in InetGet -> InetGetInfo?
  6. MS Splash Screens The office 2016/17 office suite has made many people turn heads with its functions and especially their splash screen. I now present to you, the MS Style Splash Screen. For Rookies, Novices and anyone who wants a ready made splash screen for your gui application. You can now download it and also try it out yourself. You have three colors to choose from: Blue Red Green All three colours are from the famous programs. I also included the KODA form to you can have freedom with this splash screen. Note: the KODA form does not have the three colours as well as the correct blue. Have fun and enjoy. Note: I will update the splash to add the automated 3 dots animation at a later stage.
  7. Hello Guys this is my gui and i need the numeric value typed in the highlighted inputbox. if this value is greater than 1 i need to perform some operations \ Here is the summary about that field which i got from wininfo tool i tried writing the code as shown below.. but the msgbox is popping up empty value..when the same code is pasted under some button action i am able to access the value present in the field..but when placed alone as written in the attached script i am unable to fetch it... here i am using the valu present in the field can you guys tell me what's wrong??? or how can i get that value? My_GUI.au3
  8. Here are two functions to provide pixel-accurate height and width dimensions for a given string. The more commonly-used _GDIPlus_GraphicsMeasureString built-in UDF is problematic because it returns the width padded by roughly one en-space (for reasons related to the various ways Windows produces anti-aliased fonts). These are AutoIt translations of Pierre Arnaud's C# functions, described in his CodeProject article "Bypass Graphics.MeasureString limitations" The first is an all-purpose version that takes a window handle, string, font family, font size (in points), style, and (optionally) width of the layout column (in pixels) as parameters. The second, more efficient version is intended for applications where GDI+ fonts are already in use, and takes handles to the existing graphics context, string, font, layout and format as parameters. Both functions return a two-row array with the exact width [0] and height [1] of the string (in pixels). EDIT: (Note that some of the same anti-aliasing measurement issues still apply. I did my best to work around them, but the output of the function may still be off by a pixel or two. Buyer beware.) #include <GDIPlus.au3> #include <GUIConstantsEx.au3> ; #FUNCTION# ==================================================================================================================== ; Name ..........: _StringInPixels ; Description ...: Returns a pixel-accurate height and width for a given string using a given font, style and size. ; Syntax ........: _StringInPixels($hGUI, $sString, $sFontFamily, $fSize, $iStyle[, $iColWidth = 0]) ; Parameters ....: $hGUI - Handle to the window. ; $sString - The string to be measured. ; $sFontFamily - Full name of the font to use. ; $fSize - Font size in points (half-point increments). ; $iStyle - Combination of 0-normal, 1-bold, 2-italic, 4-underline, 8-strikethrough ; $iColWidth - [optional] If word-wrap is desired, column width in pixels ; Return values .: 2-row array. [0] is width in pixels; [1] is height in pixels. ; Author ........: Tim Curran; adapted from Pierre Arnaud's C# function ; Modified ......: ; Remarks .......: This version is longer and less efficient but works for all purposes. ; Related .......: <> ; Link ..........: ; Example .......: Example-StringInPixels.au3 ; =============================================================================================================================== #include <GDIPlus.au3> #include <GUIConstantsEx.au3> Func _StringInPixels($hGUI, $sString, $sFontFamily, $fSize, $iStyle, $iColWidth = 0) _GDIPlus_Startup() Local $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) ;Create a graphics object from a window handle Local $aRanges[2][2] = [[1]] $aRanges[1][0] = 0 ;Measure first char (0-based) $aRanges[1][1] = StringLen($sString) ;Region = String length Local $hFormat = _GDIPlus_StringFormatCreate() Local $hFamily = _GDIPlus_FontFamilyCreate($sFontFamily) Local $hFont = _GDIPlus_FontCreate($hFamily, $fSize, $iStyle) _GDIPlus_GraphicsSetTextRenderingHint($hGraphic, $GDIP_TEXTRENDERINGHINT_ANTIALIASGRIDFIT) _GDIPlus_StringFormatSetMeasurableCharacterRanges($hFormat, $aRanges) ;Set ranges Local $aWinClient = WinGetClientSize($hGUI) If $iColWidth = 0 Then $iColWidth = $aWinClient[0] Local $tLayout = _GDIPlus_RectFCreate(10, 10, $iColWidth, $aWinClient[1]) Local $aRegions = _GDIPlus_GraphicsMeasureCharacterRanges($hGraphic, $sString, $hFont, $tLayout, $hFormat) ;get array of regions Local $aBounds = _GDIPlus_RegionGetBounds($aRegions[1], $hGraphic) Local $aWidthHeight[2] = [$aBounds[2], $aBounds[3]] ; Clean up resources _GDIPlus_FontDispose($hFont) _GDIPlus_RegionDispose($aRegions[1]) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_Shutdown() Return $aWidthHeight EndFunc ;==>_StringInPixels ; #FUNCTION# ==================================================================================================================== ; Name ..........: _StringInPixels_gdip ; Description ...: Returns a pixel-accurate height and width for a given string using a GDI+ font, layout and format ; Syntax ........: _StringInPixels_gdip($hGraphic, $sString, $hFont, $tLayout, $hFormat) ; Parameters ....: $hGraphic - Handle to a GDI+ graphics object. ; $sString - The string to be measured. ; $hFont - Handle to a GDI+ font. ; $tLayout - A $tagGDIPRECTF structure that bounds the string. ; $hFormat - Handle to a GDI+ string format. ; Return values .: 2-row array. [0] is width in pixels; [1] is height in pixels. ; Author ........: Tim Curran; adapted from Pierre Arnaud's C# function ; Modified ......: ; Remarks .......: This much more efficient version is for use with GDI+ fonts ; Related .......: ; Link ..........: <> ; Example .......: Example-StringInPixels.au3 ; =============================================================================================================================== #include <GDIPlus.au3> #include <GUIConstantsEx.au3> Func _StringInPixels_gdip($hGraphic, $sString, $hFont, $tLayout, $hFormat) Local $aRanges[2][2] = [[1]] $aRanges[1][0] = 0 ;Measure first char (0-based) $aRanges[1][1] = StringLen($sString) ;Region = String length _GDIPlus_GraphicsSetTextRenderingHint($hGraphic, $GDIP_TEXTRENDERINGHINT_CLEARTYPEGRIDFIT) _GDIPlus_StringFormatSetMeasurableCharacterRanges($hFormat, $aRanges) ;Set ranges Local $aRegions = _GDIPlus_GraphicsMeasureCharacterRanges($hGraphic, $sString, $hFont, $tLayout, $hFormat) ;get array of regions Local $aBounds = _GDIPlus_RegionGetBounds($aRegions[1], $hGraphic) Local $aWidthHeight[2] = [$aBounds[2], $aBounds[3]] _GDIPlus_RegionDispose($aRegions[1]) Return $aWidthHeight EndFunc ;==>_StringInPixels_gdip _StringInPixels.au3 Example-StringInPixels.au3
  9. Hello, I have a script which uses a GUI with two buttons. It gets shown and hidden., and pressing the buttons (including their hotkeys) highlights the button, making you able to press enter the next time. However, I don't want that. I've tried using WinActivate() to make enter do things on another program, but the enter is still tied to the AutoIT GUI (which still has the button highlighted). Here's the important part of my code: $MY_GUI = GUICreate("Check.exe", 400, 300, ((@DesktopWidth / 2) - 200), -500) WinSetOnTop($MY_GUI, "", 1) ;Keeps the window on the top. $Button1 = GUICtrlCreateButton("Pass (Ctrl+P)", 40, 250, 120, 40, $WS_GROUP) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") $Button2 = GUICtrlCreateButton("Fail (Ctrl+F)", 240, 250, 120, 40, $WS_GROUP) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") $GUIText = GUICtrlCreateLabel("", 20, 10, 360, 230) GUICtrlSetFont(-1, 13, 400, 0, "MS Sans Serif") GUICtrlSetData($GUIText, Execute($stepMessage[$step])) $showGUI = "True" GUISetState(@SW_SHOW) While($showGUI = "True") $buttonPressed = GUIGetMsg() Switch $buttonPressed Case $Button1 ;Pass $pass = "True" $buttonPressed = 0 $showGUI = "False" GUISetState(@SW_HIDE) Case $Button2 ;Fail $buttonPressed = 0 $showGUI = "False" GUISetState(@SW_HIDE) While($message = "") $message = InputBox("Check.exe", "Please enter the reason the step failed." & @CRLF, "", "", 300, 200, ((@DesktopWidth / 2) - 150), -400) WEnd Return $message EndSwitch WEnd Local $pass = "False" ;Whether "Pass" or "Fail" was pressed. Local $failLog = xxxfunc($pass) ;Returns a message to log if the step failed. ##THIS CALLS THE CODE SNIPPET ABOVE## FileWrite($file, _Now() & ": Step " & $step & getStatus($pass) & "and took " & Ceiling(TimerDiff($timer) / 1000) & " seconds." & @CRLF) If($failLog <> "") Then FileWrite($file, "Logged comment: " & $failLog & @CRLF) EndIf WinActivate("[TITLE:ProgramName]") ;Hotkeys: HotKeySet("^{p}", "pressPass") HotKeySet("^{f}", "pressFail") Func pressPass() $buttonPressed = $Button1 EndFunc Func pressFail() $buttonPressed = $Button2 EndFunc The GUI's button/hotkey pressing works correctly. The same WinActivate code works in another script of mine. Together, WinActivate is not take "Active" away from the GUI's last-pressed button. How do I fix this? Thank you in advance.
  10. Hello. Drag option works only on parent window but as we can see on the parent gui is showed up child gui (on the right side with the color). Desired action is when we want to drag whole program we can also drag child gui and child gui will drag with parent gui. How to do this? #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Array.au3> GUIRegisterMsg($WM_NCHITTEST, "_NCHITTEST") $hGUI = GUICreate("Test", 500, 500, -1, -1) $cButton_0 = GUICtrlCreateButton("Child 0", 10, 10, 80, 30) $cButton_1 = GUICtrlCreateButton("Child 1", 10, 50, 80, 30) $cButton_2 = GUICtrlCreateButton("Child 2", 10, 90, 80, 30) GUISetState(@SW_SHOW, $hGUI) ; guis Global $hChild_[3] Global $countGUI = UBound($hChild_) - 1 ;MsgBox("","",$countGUI) ; licznik dla GUI Global $gui = 0 $hChild_[0] = GUICreate("Child 0", 350, 300, 150, 0, $WS_POPUP, $WS_EX_MDICHILD, $hGUI) GUISetBkColor(0xFF0000) GUISetState(@SW_SHOW, $hChild_[0]) $hChild_[1] = GUICreate("Child 1", 350, 300, 150, 0, $WS_POPUP, $WS_EX_MDICHILD, $hGUI) GUISetBkColor(0x00FF00) GUISetState(@SW_HIDE, $hChild_[1]) $hChild_[2] = GUICreate("Child 2", 350, 300, 150, 0, $WS_POPUP, $WS_EX_MDICHILD, $hGUI) GUISetBkColor(0x0000FF) GUISetState(@SW_HIDE, $hChild_[2]) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cButton_0 _All_Hide() GUISetState(@SW_SHOW, $hChild_[0]) $gui = 0 Case $cButton_1 _All_Hide() GUISetState(@SW_SHOW, $hChild_[1]) $gui = 1 Case $cButton_2 _All_Hide() GUISetState(@SW_SHOW, $hChild_[2]) $gui = 2 EndSwitch WEnd Func _All_Hide() GUISetState(@SW_HIDE, $hChild_[0]) GUISetState(@SW_HIDE, $hChild_[1]) GUISetState(@SW_HIDE, $hChild_[2]) EndFunc Func _NCHITTEST($hWnd, $uMsg, $wParam, $lParam) If $hWnd = $hGUI Then Local $aPos = WinGetPos($hWnd) If Abs(BitAND(BitShift($lParam, 16),0xFFFF)- $aPos[1]) < 500 Then Return $HTCAPTION EndIf Return $GUI_RUNDEFMSG EndFunc
  11. Splash Screen GUI - MS Office Style

    Version 1.1.0


    A gui splash screen. Themed after the famous MS Office Suite. Three colours to choose from, Red, Blue and Green. You can change the labels to your own application. Also bundled with this is the KODA form. So you can open up and see the basic structure of this splash screen. Splash Screen
  12. Dear AutoIT Community. I am currently working on a program that will display lots of images in a scroll down GUI. I create the GUI based on the number of images, which works fine. But all images I place using GuiCtrlCreatePic above a threshold of around 32000 pixels (cant say exactly) are placed at negative locations and finally will reach 0 again and will then populate on top of the images placed there before. For $i = 1 To $Images[0] ; Get picture dimensions $hImage = _GDIPlus_ImageLoadFromFile($ImgRep & $Images[$i]) $iX = _GDIPlus_ImageGetWidth($hImage) $iY = _GDIPlus_ImageGetHeight($hImage) _GDIPlus_ImageDispose($hImage) ; Resize & place images in GUI $Pic[$i] = GUICtrlCreatePic($ImgRep & $Images[$i], $Spacer, Round($yPos, 0), $MaxImgWidth, $MaxImgWidth * ($iY / $iX)) $yPos = $yPos + $MaxImgWidth * ($iY / $iX) + $Spacer $log = $log & "|" & $yPos $currentlut = $Images[1] Next I have found a limit at 32767 pixels for some GUI elements when googling around. Can someone tell me how to circumvent that? thanks! cheers Felix
  13. Hello Is there anyway to store word documents in Autoit GUI? For example I have a instruction sheet that I want to bundle up with the exe. So a user simply clicks the icon and the stored document will launch (Something like how you can add objects like excel sheets in word documents ) (I Know we can launch word files from script directory)
  14. Not sure if this is possible or if someone has already tackled this. Is it possible to embed PowerShell into a GUI? Autoit is great for quick function but sometime I need to run a command thru PowerShell. It be great to have PowerShell console embedded into the gui.
  15. Ahoy Autoit Community! After many trials and errors I am unable to solve a problem I am facing and would appreciate any kind of input or better yet a solution The Premise: An embeded slideshow viewer that runs after double-clicking an item in a ListView (each item will generate a different slideshow images). The Setup: GUI with a ListView Control and a simple exit button. The Issue: Once double clicked the slide plays however the GUI "locks"/non responsive until the slide is over. Same thing if I click on the "Test" button. The Culprit: I believe since it's in the images loop it can't accept any other commands until that loop is over. The Wish: I want to be able to use the GUI functions (selecting other items, clicking on button etc.) while the slideshow plays. The Code (stripped and simplified as much as I could): #include <GuiListView.au3> #include <File.au3> #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) HotKeySet("{Esc}", "_Exit") Global $c=0 Global $ssGDI[3], $ssGraphic[2], $ssImage Global Const $bg_color = "000000" Global Const $ssW = 480, $ssH = 320 Global $aFiles = _FileListToArrayRec("d:\testStage\", "*.jpg;*.png;*.bmp;*.gif;*.JPG;*.PNG;*.BMP;*.GIF", $FLTAR_FILES, $FLTAR_NORECUR ,$FLTAR_SORT ,$FLTAR_FULLPATH ) $guiW = 1200 $guiH = 726 $mainWindow = GUICreate("Slideshow Viewer", $guiW, $guiH, -1, -1, $WS_POPUP) $Button1 = GUICtrlCreateButton("Exit", 0, 0, 50, 50) GUICtrlSetOnEvent($Button1, "_Exit") $Button1 = GUICtrlCreateButton("Test", 60, 0, 50, 50) GUICtrlSetOnEvent($Button1, "Test") Global $ListView = GUICtrlCreateListView("Entry Name|Category", 5, 75, 195, 280) _GUICtrlListView_SetColumnWidth ($ListView, 0, 100) _GUICtrlListView_SetColumnWidth ($ListView, 1, 100) GUICtrlSendMsg($ListView, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES) GUICtrlSendMsg($ListView, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT) GUICtrlCreateListViewItem("Name 1|Category 1", $ListView) GUICtrlCreateListViewItem("Name 2|Category 2", $ListView) screenshotWidgetInit($ssW,$ssH, 690, 100) GUISetState(@SW_SHOW, $mainWindow) GUIRegisterMsg($WM_NOTIFY, "WM_Notify_Events") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE _Exit() EndSwitch WEnd Func Test() For $k = 1 To UBound($aFiles) - 1 screenshotWidgetTransition($aFiles[$k]) Next EndFunc Func ListView_Click() ConsoleWrite("Left Click") EndFunc Func ListView_DoubleClick() ConsoleWrite("Double Left Click") Test() EndFunc Func WM_Notify_Events($hWndGUI, $MsgID, $wParam, $lParam) #forceref $hWndGUI, $MsgID, $wParam Local $tagNMHDR, $event, $hwndFrom, $code $tagNMHDR = DllStructCreate("int;int;int", $lParam) If @error Then Return $event = DllStructGetData($tagNMHDR, 3) Select Case $wParam = $ListView Select Case $event = $NM_CLICK ListView_Click () Case $event = $NM_DBLCLK ListView_DoubleClick () EndSelect EndSelect Return $GUI_RUNDEFMSG EndFunc Func screenshotWidgetTransition($image, $delay = 0, $speed = 1, $sleep = 2000) Local $a, $d = $c, $iX, $iY $ssImage = _GDIPlus_ImageLoadFromFile($image) $iX = _GDIPlus_ImageGetWidth($ssImage) $iY = _GDIPlus_ImageGetHeight($ssImage) $FDesktop=$ssH/$ssW $Fact =1 If $iX > $ssW And $FDesktop > ($iY/$iX) Then $Fact=$ssW/$iX ElseIf $iY > $ssH Then $Fact=$ssH/$iY EndIf $H1 = Round(($Fact * $iY),0) $W1 = Round(($Fact * $iX),0) _GDIPlus_GraphicsDrawImageRect($ssGraphic[$d], $ssImage,($ssW - $W1)/2, ($ssH - $H1) / 2,$W1,$H1) WinSetTrans($ssGDI[$d], "", 0) WinSetOnTop($ssGDI[$d], "", 1) For $a = 0 To 254 Step $speed WinSetTrans($ssGDI[$d], "", $a) Sleep($delay) Next WinSetTrans($ssGDI[$d], "", 254) WinSetOnTop($ssGDI[Not ($d)], "", 0) WinSetTrans($ssGDI[Not ($d)], "", 0) _GDIPlus_GraphicsClear($ssGraphic[Not ($d)]) $c = 1 - $d _GDIPlus_ImageDispose ($ssImage) ; very important to realease the pics Sleep($sleep) EndFunc ;==>screenshotWidgetTransition Func screenshotWidgetInit($ssW,$ssH,$ssX,$ssY) $ssGDI[2] = GUICreate("", $ssW, $ssH, $ssX, $ssY, $WS_POPUP, $WS_EX_MDICHILD, $mainWindow) $ssGDI[0] = GUICreate("", $ssW, $ssH, 3, 3, $WS_POPUP, $WS_EX_MDICHILD, $ssGDI[2]) $ssGDI[1] = GUICreate("", $ssW, $ssH, 3, 3, $WS_POPUP, $WS_EX_MDICHILD, $ssGDI[2]) ; GUISetBkColor("0x" & $bg_color, $ssGDI[2]) GUISetState(@SW_SHOW, $ssGDI[2]) GUISetState(@SW_SHOW, $ssGDI[0]) GUISetState(@SW_SHOW, $ssGDI[1]) WinSetTrans($ssGDI[0], "", 0) WinSetTrans($ssGDI[1], "", 0) _GDIPlus_Startup() $ssGraphic[0] = _GDIPlus_GraphicsCreateFromHWND($ssGDI[0]) $ssGraphic[1] = _GDIPlus_GraphicsCreateFromHWND($ssGDI[1]) _GDIPlus_GraphicsClear($ssGraphic[0], "0xFF" & $bg_color) _GDIPlus_GraphicsClear($ssGraphic[1], "0xFF" & $bg_color) EndFunc ;==>screenshotWidgetInit Func _Exit() _GDIPlus_ImageDispose($ssImage) _GDIPlus_GraphicsDispose($ssGraphic[0]) _GDIPlus_GraphicsDispose($ssGraphic[1]) GUIDelete($ssGDI[0]) GUIDelete($ssGDI[1]) GUIDelete($ssGDI[2]) _GDIPlus_Shutdown() Exit EndFunc ;==>_Exit I hope someone can shed light on this; perhaps a different approach is needed? Thank you in advance! P.S. The script is patched from different scripts of different users in the forum - thank you again users!
  16. Hello all, I've been trying to figure out how to launch Google Chrome in the background (hidden) but it doesn't seem possible. I've tried the following methods: ShellExecute("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe", "", "", "", @SW_HIDE) Also I've tried: ShellExecute(@ComSpec, "/c start chrome.exe","","",@SW_HIDE) Lastly I tried: RunWait('"'&@ProgramFilesDir&'\Google\Chrome\Application\chrome.exe" --silent-launch',@ScriptDir) But all of them launch my chrome browser without hiding it. Does anyone know a workaround for this or if AutoIT just can't Chrome? Bonus points if you know how to make it launch chrome hidden and make it go to Thank you, Brian
  17. I have a working program currently driven largely through menu selections. I would like to add a toolbar where most of the tollbar button actions are basically the same as menu items, but quicker to access. I have been wading around in toolbar examples, MSDN pages etc, it's clearly going to be a bit of a slog to get everything right, including tooltips etc. I thought I would start with something simple to prove the principle. Using bits from the help file examples I have a small program that successfully displays a toolbar. However, what seemed like the most elegant way to deal with the button commands does not seem to work. My understanding was that a toolbar button fires a WM_COMMAND message, with the command Id set by the second parameter in the call to _GUICtrlToolbar_AddButton ( $hWnd, $iID, $iImage) so I though it would be a good idea to set this Id to the same value as my menu item Id; then it would run the same task which is what I wanted. This did not work. I am using message loop mode and would like to stick with this because some of my scripts run hardware at the same time as the gui; it is easier if I don't have to worry about code being interrupted with the hardware in an unknown state . So I added a handler for WM_COMMAND, with some cribbed display code to try and see why. The toolbar button defintely fired a WM_COMMAND message and the Id looked the same, so no explanation there. I guess the issue is with GUIGetMsg() which may be constructed to ignore all but a limited number of control handles, i.e. those made with the GuiCtrlCreate... commands; this is speculation. I would dearly love to find a tidy way to get around this. Having some controls handled in the message loop and some in a WM_COMMAND handler, performing the same task, feels ugly. I would be very grateful for further insight from someone experienced with handling a toolbar. Perhaps I should be trying to fire the menu item. I have attached a code snippet to try and illustrate the issue. ToolbarTrial.au3
  18. Hello all, I've been working on 4 standalone scripts. They each have their own GUI and are now independent .exe's. But instead of having 4 separate icons on my computer, is it possible to put them all together into one .exe? What I want is one interface with tabs. Each script's GUI would be on their own respective tab. Is this possible? The different scripts don't need to communicate with one another. I just want them all in one .exe. I can't find this anywhere... Any help would be greatly appreciated. Thank you!
  19. I have a workplace GUI that has a search field function that pulls up customer records to allow changes. I am attempting to 1)LOGIN 2)Enter Search field, enter a number and then {ENTER} 3)change specific field once customer record loads. I have very limited experience in GUI manipulation but I am able to login using the below: #include <IE.au3> Const $navOpenInNewTab = 0x0800 Dim $oIE = _IECreate('') Call ("RacksheetSignIn") Func RacksheetSignIn () Local $username = _IEGetObjByName ($oIE,"uname") Local $password = _IEGetObjByName ($oIE,"pword") $oIE.Navigate2('',2048) _IEFormElementSetValue ($username, "xxxxxxx") _IEFormElementSetValue ($password, "xxxxxxx") Send('{Enter}') EndFunc However I can't seem to use the _IEGetObjByName or Mouseclick to focus on the search field to allow me to enter my search criteria. When I "inspect element" in the Search field I get the attached: Any help would be MUCH appreciated
  20. I am having difficulties getting updated results from GUICtrlCreateInput. I wrote a small script to demonstrate what I am trying to do. This script reads a text file into an array and displays the Name and Number from the text file. The user can check a name and change the number, and the results are displayed in _ArrayDisplay. Only the Checked names are displayed in their original position. This is necessary for future plumbing. The problem with this script is the original number is returned, not the changed number. I cannot figure out how to get the updated number to be displayed. ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ; ; This script reads a text file into an array and displays the Name and Number from the text file. ; The user can check a name and change the number, and the results are displayed in _ArrayDisplay. ; Only the Checked names are displayed in their original position. This is necessary for future ; plumbing. ; ; The problem with this script is the original number is returned, not the changed number. I cannot ; figure out how to get the updated number to be displayed. ; ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #include-once #include <MsgBoxConstants.au3> #include <array.au3> #include <Date.au3> #include <WinAPIFiles.au3> #include <AutoItConstants.au3> #include <Misc.au3> #include <File.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> Local $iMax = 6 ;Default number of Videos - 1 for the array counter Dim $aTextFile[$iMax][2] ; [start with 5 entries][Name, Number] Don't get confused! [Row][Column] Local $i = 0 Local $iLeft = 30 Local $iTop = 30 Local $sName Local $sNumber Local $aArray Local $iMaxCol = 5 Local $iRow = 0 Local $iCol = 0 Local $aNumberCount[$iMaxCol][2] $aArray1 = ReadFile() $aNamesNumbers = DisplayNames($aArray1) _ArrayDisplay($aNamesNumbers) ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ; ; ReadFile() places the contents of the NameNumber.txt file in an array ; ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Func ReadFile() Local $sFileData = @ScriptDir & "\NameNumber.txt" Local $iStrReturn = 0 Local $aArrayFile Local $aTextFile[$iMaxCol][2] Local $aName Local $sCheckBox1 Const $iL = 10 ; Count from Left for GUI so all buttons line up Local $sFill Local $iA = 0, $iN = 0 ; Put the Names into an Array _FileReadToArray($sFileData, $aArrayFile) For $iA = 0 To $aArrayFile[0] ; Step through the array looking for Names If StringInStr($aArrayFile[$iA], "Name:") Then $aName = StringSplit($aArrayFile[$iA],":") $sFill = $aName[2] If UBound($aTextFile) <= $iRow Then ; Resize the array when $iRow is equal to the element count in the array to prevent subscript error ReDim $aTextFile[UBound($aTextFile) + 1][$iMaxCol] EndIf $aTextFile[$iRow][$iCol] = $sFill $iRow += 1 EndIf Next $iCol = 1 $iRow = 0 $sFill = "" For $iA = 1 To $aArrayFile[0] ; Step through the array looking for Numbers If StringInStr($aArrayFile[$iA], "Number:") Then $aName = StringSplit($aArrayFile[$iA],":") $sFill = $aName[2] If UBound($aTextFile) <= $iRow Then ; Resize the array when $iRow is equal to the element count in the array to prevent subscript error ReDim $aTextFile[UBound($aTextFile) + 1][$iMaxCol] EndIf $aTextFile[$iRow][$iCol] = $sFill $iRow += 1 EndIf Next Return $aTextFile EndFunc ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ; ; Display the Name and Number ; ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Func DisplayNames($aArray1) Local $aName[$iMax] Local $aNumbers[$iMax] $iMMCount = UBound($aArray1) $iMMCount -=1 Local $iWidth = 300 Local $iLength = 300;$iMMCount * 30 GUISetFont(12) $hGUI = GUICreate("Edit / Update Number Test", $iWidth, $iLength, -1, -1) GUICtrlCreateLabel(" Name Number",1,5) ;$iTop += 30 ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ; ; Display Name with a Checkbox. Only Checked Names should be saved. ; ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ For $i = 0 to $iMMCount Step 1 $sNameText = $aArray1[$i][0] $iNameLength = StringLen($sNameText) $aName[$i] = GUICtrlCreateCheckbox($sNameText,$iLeft, $iTop) $iTop += 30 Next ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ; ; Display the number from the text file below each name. Allow the user to change the number and display the ; new number. ; ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ $iLeft = 60 GUIStartGroup() $iTop = 28 For $i = 0 to $iMMCount Step 1 $sNumberText = $aArray1[$i][1] $aNumberCount[$i][1] = $sNumberText $aNumberCount[$i][0] = GUICtrlCreateInput($sNumberText,$iLeft, $iTop, 50,18, $GUI_DOCKAUTO) GUICtrlSetPos($aNumberCount[$i][0],200) $iTop += 30 Next ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ; ; Read the checked names and (possibly updated) number ; ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ $iMMCount = UBound($aNumberCount) $iMMNewCount = $iMMCount - 1 Local $aGUICheckbox[$iMMCount] Local $aCheckedNameNumber[$iMMCount][2] $iLeft = 30 Local $idCloseGUI = GUICtrlCreateButton("Close",$iLeft, $iTop) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $idCloseGUI For $i = 0 To $iMMNewCount Step 1 Switch GUICtrlRead($aName[$i]) Case $GUI_CHECKED $aCheckedNameNumber[$i][0] = $aArray1[$i][0] Case $GUI_UNCHECKED EndSwitch Switch GUICtrlRead($aNumberCount[$i][0]) Case $aCheckedNameNumber[$i][1] = GUICtrlRead($aNumberCount[$i][1]) EndSwitch Next ExitLoop EndSwitch WEnd For $i = 0 to $iMMNewCount step 1 GUICtrlRead($aNumberCount[$i][0]) If $aCheckedNameNumber[$i][0] <> "" Then $aCheckedNameNumber[$i][1] = $aNumberCount[$i][1] EndIf Next GUIDelete($hGUI) Return $aCheckedNameNumber EndFunc This is the text file I am reading. If you want to try this out put the NameNumber.txt file in your script directory. It's attached to the post. * This is a dummy file with a Name and Number * The only purpose of this file is to read the updated Number. Name:Taggart Number:916 Name:Mongo Number:90 Name:Hedley Lamarr Number:22 Name:Bart Number:9999 Name:The Waco Kid Number:2244 If I change the number, the original number is displayed at the end, not the updated/modified number. I need the modified number to be displayed. Thanks in advance for any assistance! Jibberish NameNumber.txt
  21. Hello, As I was searching this forum I came along something intresting what was new to me. CUI/GUI hybrid. Whish sounds very usefull to me to compile it all into 1 script. So i was fideling around whit it but couldn't get it to work. In the real script (not this simplified version) i got a lot of functions whish i can use whan talking to it by commandline and switches. I could not get this to work and hope somebody could give me some pointers on how to make it work. Also I was hoping iff somebody could help me whit the /? function? (I don't know how to output the help text back to the commandline or the function that can help me do it) please advice and thanks in advanced. #AutoIt3Wrapper_UseUpx=n #AutoIt3Wrapper_UseX64=n #AutoIt3Wrapper_Change2CUI=y #include <Process.au3> #include <Array.au3> If $CmdLine[0] = 0 Then If _ProcessGetName(ProcessGetParent(@AutoItPID)) = "cmd.exe" Then ;ConsoleWrite("Program was started in CMD" & @CRLF) If Mod($CmdLine[0], 2) <> 0 Then Exit MsgBox(16, $sTitle, "Invalid number of parameters! has to be a multiple of 2!") If $CmdLine[0] = 0 Then Exit MsgBox(16, $sTitle, "No parameters passed!") For $i = 1 To $CmdLine[0] Step 2 If $CmdLine[$i] = "/switch" Then MsgBox(64, "Passed Parameters", "/switch is " & $CmdLine[$i+1]) If $CmdLine[$i] = "/?" Then MsgBox(64, "Passed Parameters", "/? " ) Next _ArrayDisplay($CmdLine) Else #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 239, 65, 192, 124) $Button1 = GUICtrlCreateButton("Button1", 32, 24, 75, 25) $Button2 = GUICtrlCreateButton("Button2", 120, 24, 75, 25) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 button1() Case $button2 button2() EndSwitch WEnd EndIf EndIf Exit Func button1() MsgBox(16, "title", "button1()!") EndFunc Func button2() MsgBox(16, "title", "button1()!") EndFunc Func ProcessGetParent($i_PID) ;get PID from parent process done by SmOke_N Local $TH32CS_SNAPPROCESS = 0x00000002 Local $a_tool_help = DllCall("Kernel32.dll", "long", "CreateToolhelp32Snapshot", "int", $TH32CS_SNAPPROCESS, "int", 0) If IsArray($a_tool_help) = 0 Or $a_tool_help[0] = -1 Then Return SetError(1, 0, $i_PID) Local $tagPROCESSENTRY32 = _ DllStructCreate( _ "dword dwsize;" & _ "dword cntUsage;" & _ "dword th32ProcessID;" & _ "uint th32DefaultHeapID;" & _ "dword th32ModuleID;" & _ "dword cntThreads;" & _ "dword th32ParentProcessID;" & _ "long pcPriClassBase;" & _ "dword dwFlags;" & _ "char szExeFile[260]" _ ) DllStructSetData($tagPROCESSENTRY32, 1, DllStructGetSize($tagPROCESSENTRY32)) Local $p_PROCESSENTRY32 = DllStructGetPtr($tagPROCESSENTRY32) Local $a_pfirst = DllCall("Kernel32.dll", "int", "Process32First", "long", $a_tool_help[0], "ptr", $p_PROCESSENTRY32) If IsArray($a_pfirst) = 0 Then Return SetError(2, 0, $i_PID) Local $a_pnext, $i_return = 0 If DllStructGetData($tagPROCESSENTRY32, "th32ProcessID") = $i_PID Then $i_return = DllStructGetData($tagPROCESSENTRY32, "th32ParentProcessID") DllCall("Kernel32.dll", "int", "CloseHandle", "long", $a_tool_help[0]) If $i_return Then Return $i_return Return $i_PID EndIf While @error = 0 $a_pnext = DllCall("Kernel32.dll", "int", "Process32Next", "long", $a_tool_help[0], "ptr", $p_PROCESSENTRY32) If DllStructGetData($tagPROCESSENTRY32, "th32ProcessID") = $i_PID Then $i_return = DllStructGetData($tagPROCESSENTRY32, "th32ParentProcessID") If $i_return Then ExitLoop $i_return = $i_PID ExitLoop EndIf WEnd DllCall("Kernel32.dll", "int", "CloseHandle", "long", $a_tool_help[0]) Return $i_return EndFunc ;==>ProcessGetParent
  22. Hello Forum, As said in the title, I'm searching a way to disable all tabstops in a GUI. My GUI includes 15 buttons and 3 edit controls. My questions: - is there a way to disable all tabstops at a time - is there a way to list all controls of a GUI and then disable tabstops one by one - or should I use the following line after each button creation: _WinAPI_SetWindowLong(GUICtrlGetHandle(-1), $GWL_STYLE, BitAND(_WinAPI_GetWindowLong(GUICtrlGetHandle(-1), $GWL_STYLE), BitNOT($WS_TABSTOP))) Thanks in advance for your valuable help! Thoms Edit: or maybe disable TAB key? I don't remember how to do!
  23. Hello, I have used this forum to get help many times. I thought it was time to (hopefully) help others. I created a script that reads a text file with a list of videos, displays the videos in a GUI with checkboxes next to the names, and displays the selected videos. This will become a part of a larger script I am creating to test a video player. The tough part for me was creating the GUI and Dynamic list of videos. I had a lot of trouble finding samples to help me, but finally found one written by Melba23. The link is in the code, so he gets credit for helping! I also have not used arrays much and they are very picky about looping through the arrays without getting the dreaded error " Array variable has incorrect number of subscripts or subscript dimension range exceeded." However diligence paid off! To run this code, take the video names commented below and create a videos.txt file in your script execution directory. You can put however many video names in this list. Thus the dynamic features of the code. Cheers! Jibberish #include <MsgBoxConstants.au3> #include <StringConstants.au3> #include <array.au3> #include <File.au3> #include <GUIConstantsEx.au3> Local $sMediaFile = @ScriptDir & "\videos.txt" ;~ Videos in videos.txt are: ;~ bbb_1080_60s.mp4 ;~ bbb_1080_60s_1.mp4 ;~ bbb_1080_60s_2.mp4 ;~ tos_4K_60s_HEVC.mp4 ;~ tos_4K_60s_HEVC_1.mp4 ;~ tos_4K_60s_HEVC_2.mp4 ;~ ;~ Additional videos can be added to this list. The functions are Dynamic. Dim $aMediaManifest Local $aArrayFile Local $aVideos Local $sVideoName Local $i ; MAIN ; Put the Video File Names into an Array _FileReadToArray($sMediaFile, $aArrayFile) Local $iVideoCount = UBound($aArrayFile) -1 ; Get the number of videos - 1 to prevent errors _ArrayDelete($aArrayFile, 0) ;Counter just gets in the way ; Move backwards through the array deleting the blank lines For $i = $iVideoCount - 1 To 0 Step -1 If $aArrayFile[$i] = "" Then _ArrayDelete($aArrayFile, $i) EndIf Next $aVideos = DisplayVideos($aArrayFile) $iVideoCount = UBound($aArrayFile) -1 _ArrayDisplay($aVideos) ; Display the checked videos ;~ End of MAIN ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ; ; GUI to display Videos in checkboxes ; ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Func DisplayVideos($aArrayFile) Local $iTop = -1 Local $iLeft = -1 Local $iWidth Local $iHeight = $iVideoCount * 30 Local $iL = 10 Local $iT = 10 Local $iRow = 0 Local $aVideo Local $iA = 0, $iB = 0 Local $sFill = "" $iMMCount = UBound($aArrayFile) $iMMNewCount = $iMMCount - 1 Local $aGUICheckbox[$iMMCount] Local $aCheckedVideos[$iMMCount] ; Put the Video File Names into an Array $hGUI = GUICreate("Video Checkbox", $iLeft, $iTop, $iWidth, $iHeight) GUICtrlCreateLabel("Videos", 180, $iT) $iT = $iT + 30 ; This is a great example of using arrays to create GUI check boxes or radio buttons For $i = 0 To $iMMNewCount Step 1 $sMP4Text = $aArrayFile[$i] $aGUICheckbox[$i] = GUICtrlCreateCheckbox($sMP4Text, 30, $iT) $iT += 30 Next $idClose1 = GUICtrlCreateButton("Start", $iL, $iT) GUISetState(@SW_SHOW) ; This section reads the checkboxes and puts the video names in an array in their original position ; in case this is important (as it is to me) ; This was the toughest part to code, and I found no samples online until I saw Melba23's sample here: ; ; I got this working with only a little modification. THANK YOU MELBA23 While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $idClose1 For $i = 0 To $iMMNewCount Step 1 Switch GUICtrlRead($aGUICheckbox[$i]) Case $GUI_CHECKED $aCheckedVideos[$i] = $aArrayFile[$i] Case $GUI_UNCHECKED EndSwitch Next ExitLoop EndSwitch WEnd GUIDelete($hGUI) Return $aCheckedVideos EndFunc ;==>DisplayVideos
  24. Hello m trying to learn python m interested in knowing if there is koda like gui designer for python please also help me what all additional modules i require like ones which are famous i have already done with 1.Scrapy 2.Openpyxl 3.twister 4.selenium 5.Requests 6.pdfrw
  25. Hi, I am automating the testing of a video player. I search a file for ".mp4" and want to create a GUI with radio buttons to select what video to play. The number of videos can change based on the user's library so this must be created automatically. I have searched for how to accomplish this and there are several posts out there that help a little but I can't figure out the solution. I pulled the offending code from my main script and created the file below to make this easier to read. I am sure one of our experts here can help! #include <MsgBoxConstants.au3> #include <StringConstants.au3> #include <array.au3> #include <File.au3> #include <GUIConstantsEx.au3> Local $sMediaFile = "D:\MediaFiles\MediaFiles.txt" Local $iStrReturn = 0 Local $aText Local $aArrayFile Local $iMax = 6 ;Default number of Videos - 1 for the array counter Local $aVideoName[$iMax] = [0] Local $sCheckBox1 Local $iT = 0, $iVideoCount = 0, $iCount Local $ix = 0 Local $iy = 0 Local $idClose1 Const $iL = 10 ; Count from Left for GUI so all buttons line up ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ; ; Read a list of video file names and create a GUI with Radio Buttons to select a single video. ; Problem: We don't know how many video names will be in the text file, so we can't hard code Case Statements & their variables ; Put the Video File Names into an Array _FileReadToArray($sMediaFile, $aArrayFile) For $a = 1 To $aArrayFile[0] ; Step through the array looking for .mp4 If StringInStr($aArrayFile[$a], ".mp4") Then $iVideoCount = $iVideoCount + 1 $aText = StringSplit($aArrayFile[$a],"\\") ; This video player reads double backslashes For $a1 = 1 to $aText[0] ; Check that the array is big enough If StringInStr($aText[$a1], ".mp4") Then ;MsgBox(0,"","Video is " & $aText[$a1]) If UBound($aVideoName) = $iVideoCount Then ; Resize the array when $iCount is equal to the element count in the array to prevent subscript error ReDim $aVideoName[$aVideoName[0] + $iMax] EndIf $aVideoName[$iVideoCount] = $aText[$a1]; add data to new index element $aVideoName[0] = $a1 ; update the index count for future reference ; The idea is to create a GUI width to accommodate long video file names $it = StringLen($aVideoName[$iVideoCount]) If $iT > $ix Then $ix = $iT EndIf EndIf Next EndIf Next ; Move backwards through the array deleting blank rows For $iCount = UBound($aVideoName) - 1 To 0 Step -1 If $aVideoName[$iCount] = "" Then _ArrayDelete($aVideoName, $iCount) EndIf Next ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ; ; Create the GUI - Names and Radio Button counts will vary - How do I do this? ; ;_ArrayDisplay($aVideoName) ;Local $aVarName[$aVideoName[0]] Local $iRows = UBound($aVideoName, $UBOUND_ROWS) $iRows = $iRows -1 $aVideoName[0] = $iRows ; Prep the GUI to display the FileNames with Radio Buttons - Can only select one at a time. $a = 0 $ix = $ix + 200 $iy = ($aVideoName[0] * 30) + 60 $hGUI = GUICreate("Videos", $ix, $iy) ;$iT = $iT+30 ; Create the variable names for the Case statement - Video count may change so Video Names displayed and GUICtrlCreateRadio count may change. ;~ For $a = 1 to $aVarName[0] ;~ If UBound($aVarName) = $aVarName Then ;~ ; Resize the array when $iCount is equal to the element count in the array to prevent subscript error ;~ ReDim $aVarName[$aVarName[0] + $iMax] ;~ EndIf ;~ Assign("$bVideoName" & $a, $a) ;~ Local $aVarName[$a] = Eval($bVideoName[$a]) ;~ ; $aVarName[$a] = GUICtrlCreateRadio($aVarName[$a], $iL, $iT) ;~ Next $iCount = 1 ;MsgBox(0,"","VideoName[0] is "&$aVideoName[0]) ;_ArrayDisplay($aVideoName) Local $bVideoName1 If $iCount < $aVideoName[0] Then $bVideoName1 = GUICtrlCreateRadio($aVideoName[$iCount], $iL, $iT) GUICtrlSetState($bVideoName1, $GUI_CHECKED) $iT = $iT+30 EndIf $iCount = $iCount + 1 If $iCount <= ($aVideoName[0]) Then Local $bVideoName2 = GUICtrlCreateRadio($aVideoName[$iCount],$iL,$iT) $iT = $iT+30 EndIf $iCount = $iCount + 1 If $iCount <= ($aVideoName[0]) Then Local $bVideoName3 = GUICtrlCreateRadio($aVideoName[$iCount],$iL,$iT) $iT = $iT+30 EndIf $iCount = $iCount + 1 If $iCount <= ($aVideoName[0]) Then Local $bVideoName4 = GUICtrlCreateRadio($aVideoName[$iCount],$iL,$iT) $iT = $iT+30 EndIf $iCount = $iCount + 1 If $iCount <= ($aVideoName[0] -1) Then Local $bVideoName5 = GUICtrlCreateRadio($aVideoName[$iCount],$iL,$iT) $iT = $iT+30 EndIf $iCount = $iCount + 1 If $iCount <= ($aVideoName[0] -1) Then Local $bVideoName6 = GUICtrlCreateRadio($aVideoName[$iCount],$iL,$iT) $iT = $iT+30 EndIf $iCount = $iCount + 1 If $iCount <= ($aVideoName[0] -1) Then Local $bVideoName7 = GUICtrlCreateRadio($aVideoName[$iCount],$iL,$iT) $iT = $iT+30 EndIf $iT = $iT + 30 $idClose1 = GUICtrlCreateButton("Go!", $iL, $iT) GUISetState(@SW_SHOW) ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ; ; Switch Statement ; ;Local $nMsg = "" While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $bVideoName1 Case $bVideoName2 Case $bVideoName3 Case $bVideoName4 Case $bVideoName5 ;Case $bVideoName6 <- Fails because there are only 5 videos - Need variable $bVideoNames ;Case $bVideoName7 <- Fails because there are only 5 videos Case $idClose1 $bVideoName1 = GUICtrlRead($bVideoName1) $bVideoName2 = GUICtrlRead($bVideoName2) $bVideoName3 = GUICtrlRead($bVideoName3) $bVideoName4 = GUICtrlRead($bVideoName4) $bVideoName5 = GUICtrlRead($bVideoName5) ;$bVideoName6 = GUICtrlRead($bVideoName6) ;$bVideoName7 = GUICtrlRead($bVideoName7) ExitLoop EndSwitch WEnd GUIDelete($nMsg) MsgBox(0,"","Case " & $nMsg & " was selected.") ; Always returns 8. ??? This is the "MediaFiles.txt" file I am reading: D:\\MediaFiles\\BigBuckBunny.mp4 D:\\MediaFiles\\BigBuckBunny60fps.mp4 D:\\MediaFiles\\Sintel.mp4 D:\\MediaFiles\\sintel-2048-surround.mp4 D:\\MediaFiles\\TearsOfSteel.mp4 D:\\MediaFiles\\tearsofsteel_4K.mp4 I'm sure I have several mistakes (or poor coding methods) in my AutoIt file.