Jump to content

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
    • 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 339 results

  1. Hello my friends I have an inquiry and I hope to find the answer here I want to create a graphical user interface but I want to hide the system menu I mean the window menu Is this possible? If is possible please give me how to do that Thanks in advance
  2. I was playing around with simple GUI creation. I tend to like parameter driven coding (in prior life (years ago) as Clipper/FoxPro/dBase coder). Just wanted to see what I could do with a GUI. #Region options, includes Opt('MustDeclareVars', 1) Opt("GUIOnEventMode", 1) ; Change to OnEvent mode #include <GUIConstantsEx.au3> #EndRegion options, includes Global Const $nCols = 2, $nRows = 6, $nSpacer = 10, $nBtnWidth = 150, $nBtnHeight = 30 Global $xName = 0, $xID = 0 Global $nGUIWidth = ($nCols * $nBtnWidth) + (($nCols + 1) * $nSpacer) Global $nGUIHeight = ($nRows * $nBtnHeight) + (($nRows + 1) * $nSpacer) Global $hMainGUI = GUICreate("Calculated GUI", $nGUIWidth, $nGUIHeight, -1, -1) For $xRows = 1 to $nRows ;in this arrangement, tabbing is left to right, then next row For $xCols = 1 to $nCols ;reverse the order of this line with the prior line for top to bottom tabbing, then next col $xName += 1 $xID += 1 Global $Dummy = GUICtrlCreateButton("Button" & $xName, _ ($nBtnWidth * ($xCols - 1)) + (($xCols - 1) * $nSpacer) + $nSpacer, _ ($nBtnHeight* ($xRows - 1)) + (($xRows - 1) * $nSpacer) + $nSpacer, _ $nBtnWidth, _ $nBtnHeight) GUICtrlSetOnEvent($xID+2, "Handler") Next Next GUISetOnEvent($GUI_EVENT_CLOSE, "CloseApp") GUISetState(@SW_SHOW) While 1 Sleep(10) WEnd Func CloseApp() Exit EndFunc Func Handler() MsgBox(0,0,"Button " & @GUI_CtrlId - 2) EndFunc
  3. For fun, I'm building an app that opens a webpage and refreshes it every 30 seconds. But once the script performs _IEAction($oIE, "refresh"), the GUI closes. Any help is appreciated. #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <WinAPIFiles.au3> #include <Array.au3> #include <File.au3> #include <Excel.au3> #include <DateTimeConstants.au3> #include <MsgBoxConstants.au3> #include <WinAPIShellEx.au3> #include <MsgBoxConstants.au3> #include <Date.au3> #include <ComboConstants.au3> #include <guimenu.au3> #include <IE.au3> HotKeySet("{F4}", "_Exit") ;Open the file(s) in the selected folder $extension = ".txt" $app2openWith = @SystemDir & "\notepad.exe" Func Begin() Global $loopTrick = 0 #Region ### START Koda GUI section ### Form=c:\users\mchu\downloads\autoit\my code\form1.kxf Global $UI = GUICreate("Hit Em Up!", 256, 113, -1, -1) GUISetBkColor(0x000000) $menu = _GUICtrlMenu_GetSystemMenu($UI) _GUICtrlMenu_EnableMenuItem($menu, $SC_CLOSE, 1, False) Global $url = GUICtrlCreateInput("https://www.youtube.com/watch?v=dQw4w9WgXcQ", 81, 8, 160, 21) $Label1 = GUICtrlCreateLabel("Target:", 16, 8, 55, 17) GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x00FF00) Global $StartBut = GUICtrlCreateButton("Start", 16, 40, 67, 25) GUICtrlSetFont(-1, 13, 800, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0x008000) $Label2 = GUICtrlCreateLabel("(Press F4 to Exit)", 96, 40, 8000, 17) GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x00FF00) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $UIfunc = GUIGetMsg() Select Case $UIfunc = $GUI_EVENT_CLOSE _Exit() Case $UIfunc = $StartBut If GUICtrlRead($url) = "" Then MsgBox(48, "Um...", "Give me a target you idiot.") Else GUICtrlSetState($url, $GUI_DISABLE) GUICtrlSetState($StartBut, $GUI_DISABLE) Start() EndIf EndSelect WEnd EndFunc ;==>Begin Func Start() If $loopTrick = 0 Then Global $oIE = _IECreate(GUICtrlRead($url)) _IELoadWait($oIE) Again() ElseIf $loopTrick = 1 Then Sleep(3000) _IEAction($oIE, "refresh") Sleep(3000) Start() EndIf EndFunc ;==>Start Func Again() $loopTrick = 1 Start() EndFunc ;==>Again Func _Exit() Exit EndFunc ;==>_Exit
  4. Hi all, I have a button created with _GUICtrlButton_Create function. I know that this function returns a handle of button instead of an ID. So i have obtain control ID by calling _WinAPI_GetDlgCtrlID function. After that i have tried the GUICtrlSetBkColor function. But it didnt worked. Any suggestions will be appreciated. Thanks in advance. Note : - The window which carries this button is not created with native gui create function. Instead, it is created with CreateWindowEx api function.
  5. The title says it all, really. Is it possible to drag an image from a web browser (say, Chrome) and have it *do* something in my app, aside from a the "Don't Bother" cursor? I could have sworn I had a GUI that accepted drags from browsers but I can't pin it down. My web searching is just as fruitless. Anyone have any clues? ;o) Cor
  6. Hi All, I am a begginer in auto it. I am trying to build simple gui that will show me if for example notepad.exe process is currently running on the system. I have built something like this, but when I execute it shows me message boxes, but I want the results to show in gui. If you can help me start with this. Thanks #include <MsgBoxConstants.au3> #include <GUIConstantsEx.au3> ActiveProcess() Func ActiveProcess() GUICreate("Act") ProcessExists("wuauclt.exe") If ProcessExists("wuauclt.exe") Then MsgBox($MB_SYSTEMMODAL, "", "Windows Upates are running") Else MsgBox($MB_SYSTEMMODAL, "", "Windows Updates are not running") EndIf ;Notepad ProcessExists("notepad.exe") If ProcessExists("notepad.exe") Then MsgBox($MB_SYSTEMMODAL, "", "Notepad is running") ElseMsgBox($MB_SYSTEMMODAL, "", "Notepad is not running")EndIf
  7. Hi all, I am playing with _GUICtrlButton_Create function. How can i change this button's (or the entire form's) font ?. The in-built GUICtrlSetFont function is not working even when i convert the control handle to control ID with _WinAPI_GetDlgCtrlID ( ) function. Do i need to use CreateFont api finction and send WM_SETFONT message ? Or is there any other easy and safe ways to do this ?. Thanks in advance. Note : This window is created by CreateWindowEx function, not by GUICreate function.
  8. This is a magnifier-color-picker thing mostly based on some code I found on Stack Overflow, of all places. At least all the clever bits are from there. I'd love to use this code inside an app I'm working on. But it has an issue. The first time the mag pops up it works perfectly, but the second and subsequent times, it's a boring grey square. One of you smart dudes will probably look at this and go, "Aha!", but I'm stumped. #include <WindowsConstants.au3> #include <WinAPI.au3> #include <StaticConstants.au3> MagWindow() MagWindow() ; Magnifier-Color-Picker.. ; Props to McBarby for the cross-hairs. func MagWindow() global $iMagZoom = 5 global $iMagWidth = Ceiling(100/$iMagZoom) global $iMagHeight = Ceiling(100/$iMagZoom) global $hDCDesk, $hDCZoom, $hPen global $hUser32 = DllOpen("user32.dll") global $hGDI32 = DllOpen("gdi32.dll") global $pixel_color, $mag_open = false local $mX, $mY global $hCross = GUICreate('', 48, 48, -1, -1, $WS_POPUP, $WS_EX_TOPMOST) WinSetTrans($hCross, '', 0) GUISetCursor(3, 1, $hCross) global $hZoom = GUICreate("MagPicker", $iMagWidth * $iMagZoom, $iMagHeight * $iMagZoom, _ MouseGetPos(0), MouseGetPos(1), $WS_POPUP+$WS_BORDER, $WS_EX_TOPMOST) global $mag_label = GUICtrlCreateLabel("placehold", (($iMagHeight * $iMagZoom)/2)+2, ($iMagHeight * $iMagZoom) - 13, _ (($iMagHeight * $iMagZoom)/2)-3, 12, $SS_RIGHT) ; put this after the GUICreate()s so that it will not error on startup with mouse already moving. (now trapped! but we will leave them here.) global $__hMouseProc = DllCallbackRegister("_MouseProc", "long", "int;wparam;lparam") global $__hHook = _WinAPI_SetWindowsHookEx($WH_MOUSE_LL, DllCallbackGetPtr($__hMouseProc), _WinAPI_GetModuleHandle(0)) GUISetState(@SW_SHOW, $hCross) GUISetState(@SW_SHOW, $hZoom) $mag_open = true ; once at start, then from the mouse-callback-function.. _Magnify() while $mag_open Sleep(50) $mX = MouseGetPos(0) $mY = MouseGetPos(1) $pixel_color = Hex(PixelGetColor($mX, $mY), 6) GUICtrlSetData ($mag_label, $pixel_color) wend GUIDelete($hZoom) GUIDelete($hCross) ReleaseHooks() endfunc func _Magnify($_iX=-1, $_iY=-1) local Static $fInit = true if $fInit then $fInit = False $hDCDesk = (DLLCall($hUser32, "int", "GetDC", "hwnd", 0))[0] $hDCZoom = (DLLCall($hUser32, "int", "GetDC", "hwnd", $hZoom))[0] $hPen = (DLLCall($hGDI32, "int", "CreatePen", "int", 0, "int", 3, "int", 0x008b9094))[0] ; 0=PS_SOLID, dark-blue (0x00BBGGRR) DLLCall($hGDI32, "int", "SelectObject", "int", $hDCZoom, "hwnd", $hPen) $_iX = MouseGetPos(0) $_iY = MouseGetPos(1) endif local $iW = $iMagWidth * $iMagZoom, $iH = $iMagHeight * $iMagZoom if not @error then DLLCall($hGDI32, "int", "StretchBlt", "int", $hDCZoom, "int", _ 0, "int", 0, "int", $iW, "int", $iH, "int", $hDCDesk, "int", _ $_iX - $iMagWidth/2, "int", $_iY - $iMagHeight/2, "int", $iMagWidth ,"int", $iMagHeight, _ "long", $SRCCOPY) ; draw the crosshair (start x, start y, end x, end y) _GDI32_DrawLine($hDCZoom, ($iW/2)-2, $iH/8, ($iW/2)-2, 4*($iH/8)-6, $hGDI32) ; vertical top _GDI32_DrawLine($hDCZoom, ($iW/2)-2, 5*($iH/8)-10, ($iW/2)-2, 7*($iH/8), $hGDI32) ; vertical bottom _GDI32_DrawLine($hDCZoom, $iW/8, ($iH/2)-2, (3*($iW/8))+6, ($iH/2)-2, $hGDI32) ; horizontal left _GDI32_DrawLine($hDCZoom, 4*($iW/8)+3, ($iH/2)-2, 7*($iW/8), ($iH/2)-2, $hGDI32) ; horizontal right endif endfunc func _GDI32_DrawLine(ByRef $_hDC, $_iX0, $i_Y0, $_iX1, $i_Y1, $_hDll=-1) If $_hDll = -1 then $_hDll = "gdi32.dll" Local $tCurrent = DllStructCreate("struct; long X;long Y; endstruct") DllCall($_hDll, "int", "MoveToEx", "int", $_hDC, "int", $_iX0, "int", $i_Y0, "ptr", DllStructGetPtr($tCurrent)) DllCall($_hDll, "int", "LineTo", "int", $_hDC, "int", $_iX1, "int", $i_Y1) return $tCurrent endfunc func _MouseProc($_nCode, $_wParam, $_lParam) local $tMSLLHOOKSTRUCT = DllStructCreate("struct; long X;long Y; endstruct; " & _ "DWORD mouseData; DWORD flags; DWORD time; ULONG_PTR dwExtraInfo;endstruct", $_lParam) if $_nCode < 0 Then Return _WinAPI_CallNextHookEx($__hHook, $_nCode, $_wParam, $_lParam) local $iX = $tMSLLHOOKSTRUCT.X, $iY = $tMSLLHOOKSTRUCT.Y switch $_wParam case $WM_LBUTTONDOWN CloseMag() case $WM_MOUSEMOVE if not $mag_open then return WinMove($hCross, "", $iX -24, $iY -24) Local $iXz = ($iX +24 + $iMagWidth*$iMagZoom > @DesktopWidth) ? $iX -(24 + $iMagWidth*$iMagZoom) : $iX +24 Local $iYz = ($iY +24 + $iMagHeight*$iMagZoom > @DesktopHeight) ? $iY -(24 + $iMagHeight*$iMagZoom) : $iY +24 WinMove($hZoom, "", $iXz + $iMagWidth/2, $iYz) _Magnify($iX, $iY) endswitch return _WinAPI_CallNextHookEx($__hHook, $_nCode, $_wParam, $_lParam) endfunc func ReleaseHooks() DLLCall($hUser32, "int", "ReleaseDC", "int", $hDCZoom, "hwnd", $hPen) DLLCall($hUser32, "int", "ReleaseDC", "int", $hDCDesk, "hwnd", 0) DLLCall($hUser32, "int", "ReleaseDC", "int", $hDCZoom, "hwnd", 0) DllClose($hUser32) DllClose($hGDI32) _WinAPI_UnhookWindowsHookEx($__hHook) DllCallbackFree($__hMouseProc) endfunc func CloseMag() ; called by mouse left click $mag_open = false endfunc Thanks for any and all insights! ;o) Cor
  9. We've been able to drag images out of web browsers since forever. Can I drag one into my GUI? Or rather, can I drag an image from my web browser onto my GUI and have my app *do* something with that image? My fingers bleed from searching. Any ideas much appreciated! ;o) Cor
  10. So I'm working on an application and I've hot keyed all the numbers, and for some reason this particular combination doesn't work. All the other numbers with Ctrl+Shift work fine, and all other combinations of modifiers work with 0. Has anyone else encountered this? It's very strange. Guicreate('', 300, 300) $button = GUICtrlCreateButton('Button', 0, 0) Dim $accel = [ [ '^+0', $button ] ] GUIsetaccelerators($accel) Do $gm = guigetmsg()  If $gm = $button then msgbox(0,'','test') Until $gm = - 3 Sorry for the ugly code, i typed this up on my phone. 😅
  11. Hi. For a certain task I need to display a too long grid of controls. As I want to avoid to split this on multiple tabs, I'd like to use a scroll bar on the right hand side, as visible in this "manually faked" GUID below. Is this possible? Looking through the various GuiCtrlCreate*() functions, as well at the controls I can create using the Koda FormDesigner I couldn't see, howto... Regards, Rudi.
  12. Hello All, My first post I know this is pretty noobish but I'm trying to find a way to make this gui working.. searched but as I'm new to autoit I don't understand much... I want to make this gui on top if we press ON TOP button and off on top function when we press on top off.. Created gui with koda ... any help would be appreciated Regards, #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= Global $Form1 = GUICreate("Form1", 353, 209, 192, 114) Global $ONTOPON = GUICtrlCreateButton("ON TOP ON", 32, 40, 137, 65) Global $exit = GUICtrlCreateButton("EXIT", 105, 118, 137, 65) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") Global $ONTOPOFF = GUICtrlCreateButton("ON TOP OFF", 184, 41, 137, 65) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $ONTOPON Case $ONTOPOFF Case $exit Exit EndSwitch WEnd
  13. I've made a form in Koda where I make a list of 3 user definable elements that I want to be able to replicate with a button press so a user can add data that can be used as part of the program. #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form=D:\Carbonite Important\0 - Programing\Scite and Autoit\Koda\Forms\Mileage Estimator.kxf $Form1 = GUICreate("Save Project", 614, 1126, 298, 141) $Location = GUICtrlCreateInput("Location", 40, 112, 345, 21) $Distance = GUICtrlCreateInput("Distance", 400, 112, 89, 21) $AddLocation = GUICtrlCreateButton("AddLocation", 288, 80, 97, 25) $Label1 = GUICtrlCreateLabel("Location", 40, 88, 45, 17) $Label2 = GUICtrlCreateLabel("Distance", 400, 88, 46, 17) $HomeBase = GUICtrlCreateInput("HomeBase", 312, 32, 121, 21) $LeapYear = GUICtrlCreateCheckbox("LeapYear", 464, 32, 17, 17) $Label3 = GUICtrlCreateLabel("Leap Year?", 488, 32, 59, 17) $Variance = GUICtrlCreateInput("Variance", 504, 112, 81, 21) $Label4 = GUICtrlCreateLabel("Variance", 504, 88, 46, 17) $Label5 = GUICtrlCreateLabel("Home Base", 312, 8, 59, 17) $Button1 = GUICtrlCreateButton("Button1", 144, 56, 1, 57) $Save = GUICtrlCreateButton("Save Project", 40, 16, 121, 25) $Load = GUICtrlCreateButton("Load Project", 176, 16, 121, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Form1 Case $AddLocation EndSwitch WEnd I want to press the "add location" button and have the fields {Location, Distance and variance} create a new blank record located under the existing 3 input boxes. Since the fields can number over 30 locations in some examples I am thinking about having these items in a scrolling window. What is the best way to do this and can auto it add a variable while running by pressing a button?
  14. Hi, I made a small blunder with my code. I created the GUI under 1920x1080 resolution however, my user is configured to ONLY 1080x720 and cannot go any further than that. What do you guys think is the best way to correct this one? Resolution mathematics is something that came to mind however I do not have access to his PC to check from time to time if my estimation is correct and the resolution on my PC doesn't go down to 1080x720. Please help. ~XN~
  15. 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.
  16. 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
  17. 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
  18. 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?
  19. 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 .......: <https://www.codeproject.com/Articles/2118/Bypass-Graphics-MeasureString-limitations> ; 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 ..........: <https://www.codeproject.com/Articles/2118/Bypass-Graphics-MeasureString-limitations> ; 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
  20. 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)
  21. 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
  22. 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.
  23. 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
  24. 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
  25. 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)

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.