Jump to content

Search the Community

Showing results for tags 'control'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • 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

Categories

  • 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

Categories

  • Forum
  • AutoIt

Calendars

  • Community Calendar

Found 38 results

  1. An application is there which is created using vc++,mostly mfc. DOn't know the details completely. WHen I try to automate the control clicks for testing the UI. THe below control is not detected. As you can see, during UI operations I can click the elements one by one. But all the elements is selected as a whole set, when I use the Windowinfo tool. How to click this using AutoIT.? Please suggest.
  2. Hi dear This is the first include file I designed This work is especially directed to NVDA free screen reader users It contains a set of functions that enable you to control the program Such as forcing the program to read a custom text Force it to stop talking Find out if the program is running And show custom text in the Braille screen Available functions are _nvdaControllerClient_Load() to load the dll file _nvdaControllerClient_free() to UnLoad the dll file _nvdaControllerClient_SpeakText() to speak a custom text _nvdaControllerClient_brailleMessage() to show custom text in the Braille screen _nvdaControllerClient_cancelSpeech() to Force the NVDA to stop talking _nvdaControllerClient_testIfRunning() to check if the NVDA is running important note : All of these functions depend on a nvdaControllerClient32.dll I've added it in the attachments, as well as a file for examples, and other files As the source and examples in other languages For those who wanted to download the free screen reader, this is the download link from the official website https://www.nvaccess.org/download/ i hope you like this topic I hope you will try it and give me your opinions Thank you all members and administrators for their help now with the Attachments nvdaControllerClient_UDF.zip
  3. I wrote a script a few months ago that was working at the time. When I tried it today it wouldn't retrieve any controls. The application successfully launches, but I cannot figure out how to retrieve the control from the window that is launched. I'm on a windows 10 machine using AutoIt v3.3.14.2. The only thing I can think of that has changed is windows updates? Code is below, any help is greatly appreciated. ; Notes: ; HandleError( handleToCheck, MsgToLogOnFailure, terminateAutoItOnFail ) : function that simply checks the handle and quits AutoIt if not present ; all of this works well FileChangeDir( $CLIENT_APPLICATION_DIR ); Run( "Client.exe" ) Local $hClient = WinWaitActive( $CLIENT_TITLE, "", 10 ) $terminateOnFail = 1 HandleError( $hClient, "LaunchClient::Error: Failed to launch client. Either timed-out or failed.", $terminateOnFail ) LogToFile( "Client launched, waiting for system to ready." ) Sleep( 5000 ) ; this part does not work ; $SYSTEM_INDICATOR is a global variable. I have tried these values: "SystemIndicatorWindow" (Text), "Qt5QWindowIcon101" (ClassNN), and ; "[CLASS:Qt5QWindowIcon; INSTANCE:101]" Local $hStatusIndicator = ControlGetHandle( $hClient, "", $SYSTEM_INDICATOR ) HandleError( $hStatusIndicator, "CheckStatus::Error: couldn't retrieve control: " & $SYSTEM_INDICATOR, $terminateOnFail ) This is what the spy reveals: Edit: I just tried this code and it works for notepad++. FileChangeDir( "C:\Program Files\Notepad++\" ); Run( "notepad++.exe" ) Local $hNotePad = WinWaitActive( "new 1 - Notepad++", "", 10 ) If $hNotePad = 0 Or $hNotePad = -1 Then MsgBox( $MB_SYSTEMMODAL, "Error", "Error getting app handle." ) EndIf Sleep( 1000 ) Local $hNewFileBtn = ControlGetHandle( $hNotePad, "", "[CLASS:ToolbarWindow32; INSTANCE:1]" ) If $hNewFileBtn = 0 Or $hNewFileBtn = -1 Then MsgBox( $MB_SYSTEMMODAL, "Error", "Error getting button handle." ) EndIf MsgBox( $MB_SYSTEMMODAL, "Success", "Success." )
  4. 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.
  5. Hello all! I have had some issues reading text from different types of windows, occasionally, specifically with controlgettext. **Before I begin, I know there are better ways to do what I attempt in the example below. That's not the point of this post. The point is my issues with controlgettext. I am about to cite an example with an application you may be familiar with called SpeedFan (v4.52). My problem is not specific to speedfan, it is simply the most recent and easily reproducible example I can think of. So, the goal of the script below is to get a string of text containing the current fan RPMs from the highlighted control in the screenshot below (see "speedfan_control_details.png"). Now, here's a simple script for grabbing the window handle and reading the text from that control: $wintitle = "SpeedFan 4.52" $controlID = "197934" ;will be reformatted as "[ID:######]" $hwnd = wingethandle($wintitle) if @error<>0 then msgbox(0, "WinGetHandle", "FAILURE. @error="&@error) Exit EndIf $text = ControlGetText($hwnd, "", "[ID:"&$controlID&"]") if @error=1 then msgbox(0, "ControlGetText", "FAILURE. @error="&@error) ;failure returns "" and @error=1 Exit EndIf msgbox (0, "ControlGetText", "SUCCESS. @error="&@error &@CRLF& "$text="&$text) ;success returns string and @error=0 You'll see that the ControlGetText operation runs without error, however it does not capture any text from the control. If you explore the other controls in this one window, you'll find mixed results across the board. Neither the temps nor voltages can be read, while the log field and some other elements can be read. Even when you read the text from the whole window, those elements are not included in the visible nor hidden texts. I have run into this issue many times in the past- inconsistencies in the ability of autoit to interact with certain controls. What is it which makes this text different than any other readable texts? Is there an alternate method of reading the text in the window/control which could work? Any and all info to help me solve this mystery and satisfy my curiosity would be greatly appreciated. Thanks -Rob C PS: Running Autoit v3.3.14.2 on Win7 Ultimate x64
  6. Volume Control

    Hi Guys, So with me working in my Virtual Machines in full screen, I often have my Host OS playing music. Now the issue I had was trying to control the Host OS without having to minimise the Guest OS. So I thought of this small program. I call it the Volume Control. It resides in the bottom right hand corner of your screen just above the system clock. I'm still working on getting the volume buttons to increase/decrease when you hold down the button. Currently, you will need to tap on the volume buttons numerous times to decrease/increase the volume. Any other improvements let me know. The source code, icon and compiled program are already in the zip. Volume Controlv1.zip Screenshot.bmp
  7. Hi, I have created a bit of code to enable a script to find named controls on a userform, even though the MS CLASS description changes between machines. e.g. The CLASS "WindowsForms10.EDIT.app.0.24b689f_r14_ad1" for a text box on one PC is different on another. The below code, (a cut-down version of the code from jdelaney original post) loops through all the controls and finds the first one with the desired string in the control class name - in this case "EDIT". This name is then usable for setting the text using ControlSetText. #include <array.au3> WinActivate("Edit Part Rule") $TheClassName = GetAllWindowsControls(WinGetHandle("Edit Part Rule"), "EDIT") ;Sleep(500) ControlSetText("Edit Part Rule", "", "[CLASS:" & $TheClassName & "; INSTANCE:3]", $CmdLine[1]) ControlSetText("Edit Part Rule", "", "[CLASS:" & $TheClassName & "; INSTANCE:4]", $CmdLine[2]) Func GetAllWindowsControls($hCallersWindow, $sStringIncludes) ; Get all list of controls $sClassList = WinGetClassList($hCallersWindow) ; Create array $aClassList = StringSplit($sClassList, @CRLF, 2) ; Sort array _ArraySort($aClassList) _ArrayDelete($aClassList, 0) ; Loop For $i = 0 To UBound($aClassList) - 1 If StringInStr($aClassList[$i], $sStringIncludes) Then Return $aClassList[$i] EndIf Next EndFunc ;==>GetAllWindowsControls If anyone has any suggestions to improve it, or a better way to achieve the same thing, please let me know.
  8. Just wanted to share my functions for managing a GUI with lots of controls and many screens. I personally feel that it is very efficient and keeps line count to a minimum. And if it's not, I'll learn a better solution! Note: There are some conditional veriables such as $changes and $cont that are modified by the main loop in this particular script; they are meant as an example, please don't try too hard to understand why they're used. *Usage* This allows you to re-state a handful of buttons in one line when doing slight GUI changes: ToggleCTRL($GUI_DISABLE, $dALO, $dAAF, $dRLA) (A few buttons on a certain screen) ToggleCTRL($GUI_DISABLE, $dSAV, $dCAN) (Save/Cancel buttons) AND A single line solution to switching a GUI "screen": GuiMod("MAIN", $GUI_HIDE) GuiMod("DETAILS", $GUI_SHOW) GuiMod("PLANS", $GUI_HIDE) Another way I've used this to my advantage is as follows: Say a GUI has 3 or 4 main screens, and 3 or 4 "form" screens. When switching to a form screen, save the main screen that it was on to a variable; then once the user is done with the form, either submitting or cancelling, you can call the variable to revert back to the main screen it was on. Func _GuiMod($i, $tog, $act = True) Switch $i Case "MAIN" If $tog = $GUI_SHOW And $changes Then $changes = False ControlClick($GUI, "", $LOGfg) Else EndIf If $tog = $GUI_SHOW Then WinMove($GUI, "", Default, Default, 535, 445) _ToggleCTRL($tog, $TAB, $LOGfl, $LOGfc, $LOGfi, $LOGfg, $LOGta, $LOGvd) _ToggleCTRL($tog, $LOGtp, $LOGse) Case "DETAILS" If $tog = $GUI_SHOW Then WinMove($GUI, "", Default, Default, 535, 475) Local $cont = True If $tog = $GUI_SHOW And $act Then If Not UpdateDetails() Then $cont = False _GuiMod("MAIN", $GUI_SHOW) EndIf EndIf If $cont Then _ToggleCTRL($tog, $dUID, $dICU, $dACC, $dCOF, $dNAM, $dCO2, $dIPW, $dEMA, $dEDI, $dLOG, $dMOD) _ToggleCTRL($tog, $dUPD, $dINP, $dAPL, $dALO, $dAAF, $dPLL, $dLOL, $dAFL, $dSAV, $dCAN, $dRPL) _ToggleCTRL($tog, $dRLA, $dACT, $dAC2, $dRET, $dDEL, $dADD, $dMQC) EndIf Case "ADD-INPUT" _ToggleCTRL($tog, $nCOMi, $nCO2i, $nNAMi, $nNAMb, $nEMAi, $nPREc, $nACCc, $nICUi, $nADDi, $nNOTi) _ToggleCTRL($tog, $nAPLb, $nALOb, $nAAFb, $nPLAl, $nLOCl, $nAFFl, $nRPLb, $nRLAb, $nADDb, $nCLEb) Case "PLANS" If $tog <> $GUI_SHOW Or Not $changing Then If $act Then _ToggleCTRL($tog, $dMOD, $dLOG, $dUPD, $dDEL) _ToggleCTRL($tog, $dINP, $dAPL, $dALO, $dAAF, $dPLL, $dLOL, $dAFL, $dSAV, $dCAN, $dRPL, $dRLA) EndIf Case "CHANGE" _ToggleCTRL($tog, $dITL, $dITC, $dAML, $dAMC, $dSCB, $dCCB, $dEAB) If $tog = $GUI_SHOW Then GUICtrlSetState($dRET, $GUI_DISABLE) Else GUICtrlSetState($dRET, $GUI_ENABLE) EndIf Case "NEW" If $tog = $GUI_SHOW Then WinMove($GUI, "", Default, Default, 465, 475) _ToggleCTRL($tog, $TAB, $nCOMl, $nCOMi, $nCO2l, $nCO2i, $nNAMl, $nNAMi, $nEMAl, $nEMAi, $nPREl, $nPREc) _ToggleCTRL($tog, $nACCl, $nACCc, $nPAEb, $nICUl, $nICUi, $nADDi, $nAPLb, $nALOb, $nAAFb, $nPLAl, $nLOCl) _ToggleCTRL($tog, $nAFFl, $nRPLb, $nNOTl, $nNOTi, $nADDb, $nCLEb, $nLAST) Case "ACCESS" If $tog = $GUI_SHOW Then WinMove($GUI, "", Default, Default, 465, 330) _ToggleCTRL($tog, $ACCd1, $ACCd2, $TYPla, $TYPli, $TYPad, $TYPde, $TYPmu, $TYPmd, $ACCla, $ACCli) _ToggleCTRL($tog, $ACCde, $ACCmu, $ACCmd, $ACCdl, $ACCdi, $ACCal, $ACCai, $ACCaa, $taRET) Case "TPi" _ToggleCTRL($tog, $tpOPEb, $tpCREr, $tpLINr, $tpCO2i, $tpEMAi, $tpEMAl, $tpCREb, $tpCOPb, $tpCOPi, $tpCTOi, $tpCGOb) _ToggleCTRL($tog, $tpUFLi, $tpUFLb, $tpICUi, $tpPLAi, $tpLINb, $tpDLIb, $tpUFMi, $tpSCAl, $tpCFAr, $tpCBAr) Case "TPC" If $tog = $GUI_SHOW Then _GuiMod("TPL", $GUI_HIDE) _GuiMod("TPH", $GUI_HIDE) _GuiMod("TPD", $GUI_HIDE) EndIf _ToggleCTRL($tog, $tpCO2l, $tpCO2i, $tpCOPl, $tpCOPi, $tpCREb, $tpCOPb, $tpSEPl, $tpCTOl, $tpCTOi, $tpCGOb, $tpLAST) _ToggleCTRL($tog, $tpIDNl, $tpIDNi, $tpIDNn, $tpSCAl, $tpEMAi, $tpEMAl, $tpCFAr, $tpCBAr) Case "TPL" If $tog = $GUI_SHOW Then _GuiMod("TPC", $GUI_HIDE) _GuiMod("TPH", $GUI_HIDE) _GuiMod("TPD", $GUI_HIDE) EndIf _ToggleCTRL($tog, $tpUFLl, $tpUFLi, $tpUFLb, $tpICUl, $tpICUi, $tpPLAl, $tpPLAi, $tpLINb, $tpDLIb, $tpUFMl, $tpUFMi, $tpIMAb, $tpIMRb) Case "TPH" If $tog = $GUI_SHOW Then _GuiMod("TPC", $GUI_HIDE) _GuiMod("TPL", $GUI_HIDE) _GuiMod("TPD", $GUI_HIDE) EndIf _ToggleCTRL($tog, $tpUFLl, $tpUFLi, $tpUFLb, $tpUFMl, $tpUFMi, $tpCOCl, $tpCOCi, $tpCOGb) Case "TPD" If $tog = $GUI_SHOW Then _GuiMod("TPC", $GUI_HIDE) _GuiMod("TPL", $GUI_HIDE) _GuiMod("TPH", $GUI_HIDE) EndIf _ToggleCTRL($tog, $tpDIDl, $tpDIDi, $tpDIDb) EndSwitch EndFunc Func _ToggleCTRL($tog, $c0 = 0, $c1 = 0, $c2 = 0, $c3 = 0, $c4 = 0, $c5 = 0, $c6 = 0, $c7 = 0, $c8 = 0, $c9 = 0, $c10 = 0, $c11 = 0, $c12 = 0) For $i = 0 To @NumParams GUICtrlSetState(Eval("c" & $i), $tog) Next EndFunc
  9. A UDF with Extended Functions for Window Management Notes: Fixes WinGetClassList's barbaric returning of a @LF separated string instead of an array. Potential Uses: Automating applications that change their controls' handles/classes on each launch (e.g. half of Cisco's programs) Functions: _WinGetClassList _WinGetClassNNList _WindowGetHandleList _WindowGetHandleListFromPos Download: WindowEx.zip (v0.4) Changelog: 10/04/2016 (v0.4): _WinGetClassNNList Fixed : Not Returning an Index when using $2D_ARRAY _WinGetClassNNList Fixed : Not Properly returning $aArray[x][1] on Classes with instances > 9 when using $2D_ARRAY 10/03/2016 (v0.3): _WinGetClassList Added : Exactly the same as WinGetClassList but returns a more civilized Array _WinGetClassNNList Added : Returns Classes and their instances in either a 1D or 2D array depending on Flags _WindowGetHandleList Renamed: _WinGetHandleList SCRIPT BREAKING! _WindowGetHandleListFromPos Renamed: _WinGetHandleListFromPos SCRIPT BREAKING! 10/01/2016 (v0.2): WindowsExConstants.au3 Added : Flags in _WindowGetHandleListFromPos _WindowGetHandleListFromPos Removed: ConsoleWrite left in during debug _WindowGetHandleListFromPos Added : Flag for if part of a Control is at $X, $Y return it as well. 10/01/2016 (v0.1): _WindowGetHandleList Added : Retrieves the handles of classes from a window. _WindowGetHandleListFromPos Added : Retrieves the handles of classes at a specific position from a window. Known and Reported Bugs: None reported To Do: To Be Decided. Opinions welcome! Upcoming Changes: To Be Decided.
  10. Hi guys, Trying to map my mouse button 4 (I'm pretty sure it's 4 rather than 5, but I can experiment) to click the back button in a program (screenshot attached). In terms of positioning it sits in the middle of 3 screens if that makes a difference. I assume I can use something like (though I prob don't need the 1st two lines if using ControlClick?): WinActivate("ConnectWise v2016.4 (41139)", "Chrome Legacy Window") WinWaitActive("ConnectWise v2016.4 (41139)", "Chrome Legacy Window") ControlClick("ConnectWise v2016.4 (41139)", "Chrome Legacy Window", "[CLASS:Chrome_RenderWidgetHostHWND; INSTANCE:1]", "Left", 1, 0, 30) When I hover my mouse over the button I get the following information in Window Info >>>> Window <<<< Title: ConnectWise v2016.4 (41139) Class: TabBrowser_MainFrame Position: -8, -8 Size: 1696, 1026 Style: 0x17CF0000 ExStyle: 0x00040100 Handle: 0x0000000000010C56 >>>> Control <<<< Class: Chrome_RenderWidgetHostHWND Instance: 1 ClassnameNN: Chrome_RenderWidgetHostHWND1 Name: Advanced (Class): [CLASS:Chrome_RenderWidgetHostHWND; INSTANCE:1] ID: 315622768 Text: Chrome Legacy Window Position: 0, 30 Size: 1680, 957 ControlClick Coords: 81, 138 Style: 0x56300000 ExStyle: 0x00000020 Handle: 0x0000000000040AC6 >>>> Mouse <<<< Position: 81, 191 Cursor ID: 0 Color: 0x004E7F >>>> StatusBar <<<< >>>> ToolsBar <<<< >>>> Visible Text <<<< ConnectWise: My Calendar Chrome Legacy Window >>>> Hidden Text <<<< Chrome Legacy Window
  11. I turned to Autoit from AHK just because it support WinForm Application so well. The problem often haunts me that all the application in my job is WinForm. And it indeed help my work so much. Great thanks in advance. However, I can't get the ToolTip text in the application of my company. Specifically´╝înow I want to get the information about some data, however the information is all displayed in the tooltip on the scatter diagram which is made of those data. Is there any advice ? Relative topics I have searched can't get any information about the winform tooltip...
  12. Hi, i'm not a very educated guy when it comes to dll calls.. can someone help me do this: DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", false) for only one control?
  13. Hi All, I'm wanting to learn how to use ControlSend or ControlClick to be able to click a button when prompted, part of the problem is the button text changes. The button I want to click displays "NO (XX)" where XX is a countdown each second from 90 - image attached. I've not done Control based code before, so the below code may be wrong lol, but this is what I've got so far: While 1 If WinExists("System", "reboot") Then Local $hWnd = WinWait("System", "reboot", 5) Local $iPID = WinGetProcess($hWnd) ControlClick($hWnd, "", "[CLASS:Button; Text: NO"] ;ProcessClose($iPID) EndIf Sleep(10000) WEnd Thanks!
  14. This is an small script to Control Android Devices by USB using adb, you can use it with phones with a Cracked Screen or not working Touch Screen. What it Does: - Show your Android Screen on your Desktop. - Allow you to Swipe or Tap on the screen. - Allow you to send BACK button event. - Allow you to send WakeUp event. - Allow you to move in List Menu using Swipe gestures or Mouse Wheel Forward or Backward. - Refresh Screen with Wheel Click(Wheel Down)(To update your device screen on your desktop view). - Allow you to unlock your Device with Pattern only 3 points pattern for now. What it does not: - Complex Unlock Pattern not supported yet I'm working on that. - Complex Swipe gesture not supported yet, only straight lines. - PC Keyboard to write SMS or Email not Supported yet, I'm working on that. - Volume UP or Down not supported yet I will add it soon. - No configuration interface or file yet, keys and actions are pre set on script code. I will change that. What it Requires: - In order to Compile the Script you need 3 files: adb.exe, AdbWinApi.dll, AdbWinUsbApi.dll - In order to use the script without these files or without compile it you need to copy that files to user Temp Dir, or windows Temp dir I mean @TempDir. Keys Used and Notes: - Left Click will tap on the screen. - Keep Left Click down, move the mouse and release it with perform a Swipe operation.(Mouse Drag = Swipe). - Right Click will go back. - Enter on the keyboard will send WakeUp event(Power Button) - Wheel Down will Refresh the screen on your desktop, also F5.(Take last pictures of your android device screen) IMPORTANT: There is an $scale variable on the script that scale down your Phone screenshot image to a good resolution to show on your Desktop, I use 1.5 of scale factor because my phone resolution is 480x800 and my Desktop Screen is 1366x768 and that scale factor is good enough for me.(I will calculate that in the future to make it automatic). IMPORTANT 2: If you feel is very slow feel free to decrease Sleep() values from 400 to 200, that will be faster but you will need to Refresh with Wheel Click after you perform certain actions. Thanks and Credits: UDFs\MouseControl.au3 Base on Low Level Mouse Hook by @_Kurt all credits to him. UDFs\GUICtrlPicPNG.au3 Based on PNG work around by @UEZ from the help file, All credits to him. Kind Regards Alien. AndroidControl.zip
  15. Hello there, after i updated to the newest version of Autoit, every GUI control (buttons, checkboxes, radiobuttons, etc. ) that is currently focused has a dotted border (sorry, dont know the proper name) around it, and i don`t know how to disable it. I have tried setting exStyle of GUICreate to 0, that worked for one run and then it was back. I have tried setting style of GUICreate to 0, didn`t help at all. Am i missing something very obvious here? Please do help, it`s driving me crazy Thanks
  16. Hello guys, I have a problem here and needed your help. I need this script to be looping when pressed a button joystick, and then loose the button to perform a function in the case when pressed any button on the joystick enter the loop and when you release the button to appear the message. thank you. #Include <GUIConstants.au3> Local $Joystick, $coor, $h, $s, $msg Local $num = 0 $Joystick = _JoyInit() Dim $labels_text[8] = ['X', 'Y', 'Z', 'R', 'U', 'V', 'POV', 'Buttons'] Dim $labels_no = UBound($labels_text) Dim $labels[$labels_no] Dim $labels_value[$labels_no] ; Find the max length of the longest label $label_len = 0 For $text In $labels_text $len = StringLen($text) If $len > $label_len Then $label_len = $len EndIf Next $label_len *= 6 ; GUI GUICreate('Joystick Test', 200, 200) GUICtrlCreateLabel('Joystick', 40, 20, 100, 20) For $i = 0 To $labels_no - 1 GUICtrlCreateLabel($labels_text[$i]&':', 10, 60 + $i * 12, $label_len, 12) $labels[$i] = GUICtrlCreateLabel('', 10 + $label_len, 60 + $i * 12, 70, 12) $labels_value[$i] = '' Next GUISetState() While 1 $coord = _GetJoy($Joystick, 0) For $i = 0 To UBound($coord) - 1 If $coord[$i] <> $labels_value[$i] Then GUICtrlSetData($labels[$i], $coord[$i]) $labels_value[$i] = $coord[$i] ;----------------------------------------------------- While $coord[7] Sleep(10) WEnd MsgBox(0, "Joy", "loose button", 1) ;---------------------------------------------------- EndIf Next Sleep(10) $msg =GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd $lpJoy=0 ; Joyclose ; _JoyInit() Func _JoyInit() Local $Joystick Global $JOYINFOEX_struct = "dword[13]" $Joystick=DllStructCreate($JOYINFOEX_struct) If @Error Then Return 0 DllStructSetData($Joystick, 1, DllStructGetSize($Joystick), 1);dwSize = sizeof(struct) DllStructSetData($Joystick, 1, 255, 2) ;dwFlags = GetAll Return $Joystick EndFunc ;====================================== ; _GetJoy($lpJoy,$iJoy) ; $lpJoy Return from _JoyInit() ; $iJoy Joystick # 0-15 ; Return Array containing X-Pos, Y-Pos, Z-Pos, R-Pos, U-Pos, V-Pos,POV ; Buttons down ; ; *POV This is a digital game pad, not analog joystick ; 65535 = Not pressed ; 0 = U ; 4500 = UR ; 9000 = R ; Goes around clockwise increasing 4500 for each position ;====================================== Func _GetJoy($lpJoy, $iJoy) Local $coor,$ret Dim $coor[8] DllCall("Winmm.dll","int","joyGetPosEx", "int",$iJoy, "ptr",DllStructGetPtr($lpJoy)) If NOT @Error Then $coor[0] = DllStructGetData($lpJoy,1,3) ; X Axis $coor[1] = DllStructGetData($lpJoy,1,4) ; Y Axis $coor[2] = DllStructGetData($lpJoy,1,5) ; Z Axis $coor[3] = DllStructGetData($lpJoy,1,6) ; R Axis $coor[4] = DllStructGetData($lpJoy,1,7) ; U Axis $coor[5] = DllStructGetData($lpJoy,1,8) ; V Axis $coor[6] = DllStructGetData($lpJoy,1,11); POV Value $coor[7] = DllStructGetData($lpJoy,1,9) ; Buttons Mask EndIf Return $coor EndFunc Edit: contrary to what you might think is not automation games, but a mechanical arm controlled by a joystick (analog) only by pressing the function assigned to it is called several times, even giving a touch very quickly on the button. I do not know if it violates the rules of the forum, anyway thanks.
  17. I would like to choose a window from a list, gather all the controls on that window, then select a control from the resulting list and "highlight" it on the original window much like is done in either the AutoIT Info Tool or Yashied's Control Viewer. The issues that I am having are: Identifying when the ListView is clicked and what row is clickedThen highlighting the field on the original windowThe reason for this script is not just for visualizing the controls, but to help identify specific pixel positions and colors for controls that require ControlClick such as a list of CheckBoxes in a List that does not list specific control IDs for each. So far I have the code below, I have also attached the non-standard (not out of the box) UDFs I am using: ; ====================================================================================================================================================== ; = Resize A Window Script = ; ====================================================================================================================================================== #Region ; Script ChangeLog ; ====================================================================================================================================================== Dim $Script_ChangeLog[3][2] $Script_ChangeLog[1][0] = "Version" $Script_ChangeLog[1][1] = "ChangeLog" $Script_ChangeLog[2][0] = "15.10.28" $Script_ChangeLog[2][1] = "Original Script." $Script_ChangeLog[0][0] = UBound($Script_ChangeLog) - 1 $Script_ChangeLog[0][1] = "Entries" _ArraySort($Script_ChangeLog, 1, 2, 0, 0) ; ====================================================================================================================================================== #EndRegion ; Script ChangeLog ; ====================================================================================================================================================== #Region ; Necessary Options ; ====================================================================================================================================================== Opt("GUICloseOnESC", 0) ; 0=ESC Won't Close, 1=ESC Closes Opt("TrayIconHide", 1) ; 1=Hides Icon, 0=Shows Icon Opt("TrayMenuMode", 1) ; Default tray menu items (Script Paused/Exit) will not be shown. ; ================================================================================================================================================== Global $Script_Name = FileGetVersion(@ScriptFullPath, "ProductName") Global $Script_Version = FileGetVersion(@ScriptFullPath, "ScriptVersion") Global $Script_FileName = FileGetVersion(@ScriptFullPath, "OriginalFileName") ; ====================================================================================================================================================== #EndRegion ; Necessary Options ; ====================================================================================================================================================== #Region ; Necessary Includes ; ====================================================================================================================================================== $Script_Exists = ProcessList(@ScriptName) If $Script_Exists[0][0] > 1 Then ; MsgBox(64, $Script_Name & ' Warning', 'An instance of this application is already running.') If WinExists($Script_Name & " " & $Script_Version) Then WinActivate($Script_Name & " " & $Script_Version) Else Send("^!w") EndIf Exit EndIf ; ================================================================================================================================================== #Region ; JB2_SplashScreen Dependencies ; ================================================================================================================================================== Global Const $JB2_SplashScreen_AC_SRC_ALPHA = 1 #Include <Resources.au3> #Include <GUIConstantsEx.au3> #Include <StaticConstants.au3> #Include <WindowsConstants.au3> ; ================================================================================================================================================== #EndRegion ; JB2_SplashScreen Dependencies ; ================================================================================================================================================== JB2_SplashScreen("On") JB2_SplashScreen("Update", "Loading Dependencies...") #Include <Array.au3> #Include <ShowMonitorInfo.au3> #Include <TrayMenuIcons.au3> #Include <WinAPI.au3> ; ================================================================================================================================================== #Region ; GUI Includes ; ================================================================================================================================================== #Include <ButtonConstants.au3> #Include <Constants.au3> #Include <ComboConstants.au3> #Include <EditConstants.au3> #Include <GDIPlus.au3> #Include <GuiButton.au3> #Include <GuiEdit.au3> #Include <GUIExtender.au3> #Include <GuiListBox.au3> #Include <GuiListView.au3> #include <ListboxConstants.au3> #Include <ListviewConstants.au3> #Include <Misc.au3> #Include <ScrollBarConstants.au3> ; ================================================================================================================================================== #EndRegion ; GUI Includes ; ====================================================================================================================================================== #EndRegion ; Necessary Includes ; ====================================================================================================================================================== #Region ; Necessary Variables ; ====================================================================================================================================================== HotKeySet("^!p", "Pixels2Table_GUI") HotKeySet("^!q", "_OnExitWithMsg") ; ====================================================================================================================================================== If StringInStr(@OSVersion, "7") Then $Taskbar_Specs = ControlGetPos("[Class:Shell_TrayWnd]", "", "ToolbarWindow321") Else $Taskbar_Specs = ControlGetPos("[Class:Shell_TrayWnd]", "", "ToolbarWindow322") EndIf If $Taskbar_Specs[3] = "" Then $Taskbar_Specs[3] = 22 EndIf Global $Progress_Top = Number(@DesktopHeight - Number(138 + $Taskbar_Specs[3])); Progress Window Default Height Is 128 Offset By 10 For Effect & 46 For TaskBar Global $Progress_Left = Number(@DeskTopWidth - 316); Progress Window Default Width Is 306 Offset By 10 For Effect ; ====================================================================================================================================================== Global $WindowList = '' Global $RWG_GUI = 'Closed' Global $RWG_OpenWindow_List = '' Global $RWG_OpenWindow_List_Content = '' Global $RWG_OpenWindow_List_CurrentContent = '' Global $RWG_WindowTitle_Edit = '' Global $RWG_WindowStart_Edit = '' Global $RWG_WindowResolution_Edit = '' Global $RWG_WindowState_Edit = '' Global $RWG_WindowMonitor_Edit = '' Global $RWG_WindowMonitorResolution_Edit = '' Global $RWG_WindowControlVisible_CheckBox = '' Global $RWG_WindowControlVisible = True Global $RWG_WindowControl_ListView = '' ; ====================================================================================================================================================== Global $P2T_FileName = @TempDir & '\P2T_Layout.html' Global $P2T_Header = '<!DOCTYPE html>' & @CRLF & _ '<html>' & @CRLF & _ @TAB & '<head>' & @CRLF & _ @TAB & @TAB & '<title>Pixel To Table</title>' & @CRLF & _ @TAB & @TAB & '<meta charset="UTF-8">' & @CRLF & _ @TAB & @TAB & '<style>' & @CRLF & _ @TAB & @TAB & @TAB & 'td' & @CRLF & _ @TAB & @TAB & @TAB & '{' & @CRLF & _ @TAB & @TAB & @TAB & @TAB & 'position: relative;' & @CRLF & _ @TAB & @TAB & @TAB & @TAB & 'color: rgb(0,0,0);' & @CRLF & _ @TAB & @TAB & @TAB & @TAB & 'height: 35px;' & @CRLF & _ @TAB & @TAB & @TAB & @TAB & 'width: 35px;' & @CRLF & _ @TAB & @TAB & @TAB & @TAB & 'font-family: Calibri, Arial, sans-serif;' & @CRLF & _ @TAB & @TAB & @TAB & @TAB & 'font-size: xx-small;' & @CRLF & _ @TAB & @TAB & @TAB & @TAB & 'text-align: center;' & @CRLF & _ @TAB & @TAB & @TAB & @TAB & 'text-decoration: none;' & @CRLF & _ @TAB & @TAB & @TAB & @TAB & 'z-index: 20;' & @CRLF & _ @TAB & @TAB & @TAB & '}' & @CRLF & @CRLF & _ @TAB & @TAB & @TAB & 'td span.cellcontent' & @CRLF & _ @TAB & @TAB & @TAB & '{' & @CRLF & _ @TAB & @TAB & @TAB & @TAB & 'display: block;' & @CRLF & _ @TAB & @TAB & @TAB & @TAB & 'min-width: 35px;' & @CRLF & _ @TAB & @TAB & @TAB & '}' & @CRLF & @CRLF & _ @TAB & @TAB & @TAB & 'td:hover' & @CRLF & _ @TAB & @TAB & @TAB & '{' & @CRLF & _ @TAB & @TAB & @TAB & @TAB & 'z-index: 30; ' & @CRLF & _ @TAB & @TAB & @TAB & '}' & @CRLF & @CRLF & _ @TAB & @TAB & @TAB & 'td span.hoverbox' & @CRLF & _ @TAB & @TAB & @TAB & '{' & @CRLF & _ @TAB & @TAB & @TAB & @TAB & 'display: none;' & @CRLF & _ @TAB & @TAB & @TAB & '}' & @CRLF & @CRLF & _ @TAB & @TAB & @TAB & 'td:hover span.hoverbox' & @CRLF & _ @TAB & @TAB & @TAB & '{ ' & @CRLF & _ @TAB & @TAB & @TAB & @TAB & 'display: block;' & @CRLF & _ @TAB & @TAB & @TAB & @TAB & 'position: absolute;' & @CRLF & _ @TAB & @TAB & @TAB & @TAB & 'top: 30px; ' & @CRLF & _ @TAB & @TAB & @TAB & @TAB & 'left: 30px; ' & @CRLF & _ @TAB & @TAB & @TAB & @TAB & 'width: 200px; /* auto */' & @CRLF & _ @TAB & @TAB & @TAB & @TAB & 'padding: 10px;' & @CRLF & _ @TAB & @TAB & @TAB & @TAB & 'color: rgb(255,255,255);' & @CRLF & _ @TAB & @TAB & @TAB & @TAB & 'font-family: Cambria, Times New Roman, serif;' & @CRLF & _ @TAB & @TAB & @TAB & @TAB & 'font-size: 24px;' & @CRLF & _ @TAB & @TAB & @TAB & @TAB & 'font-weight: bold;' & @CRLF & _ @TAB & @TAB & @TAB & @TAB & 'text-align: left;' & @CRLF & _ @TAB & @TAB & @TAB & @TAB & 'line-height: 28px;' & @CRLF & _ @TAB & @TAB & @TAB & @TAB & 'border: 1px solid rgb(51,51,51);' & @CRLF & _ @TAB & @TAB & @TAB & @TAB & 'background-color: rgb(102,102,102);' & @CRLF & _ @TAB & @TAB & @TAB & '}' & @CRLF & @CRLF & _ @TAB & @TAB & @TAB & 'span.hoverboxbody' & @CRLF & _ @TAB & @TAB & @TAB & '{' & @CRLF & _ @TAB & @TAB & @TAB & @TAB & 'font-family: Calibri, Arial, sans-serif;' & @CRLF & _ @TAB & @TAB & @TAB & @TAB & 'font-size: 20px; ' & @CRLF & _ @TAB & @TAB & @TAB & @TAB & 'font-weight: normal;' & @CRLF & _ @TAB & @TAB & @TAB & @TAB & 'line-height: 22px;' & @CRLF & _ @TAB & @TAB & @TAB & '}' & @CRLF & @CRLF & _ @TAB & @TAB & '</style>' & @CRLF & _ @TAB & '</head>' & @CRLF & _ @TAB & '<body>' & @CRLF & _ @TAB & @TAB & '<table style="border-collapse: collapse;">' & @CRLF Global $P2T_Footer = @TAB & @TAB & '</table>' & @CRLF & _ @TAB & '</body>' & @CRLF & _ '</html>' & @CRLF & @CRLF ; ====================================================================================================================================================== #EndRegion ; Necessary Variables ; ====================================================================================================================================================== JB2_SplashScreen("Off") ; ====================================================================================================================================================== #Region ; Script Body ; ====================================================================================================================================================== $RWG_GUI = GUICreate($Script_Name & " " & $Script_Version, 780, 680, -1, -1, BitXOR($GUI_SS_DEFAULT_GUI, $WS_MINIMIZEBOX)) ; ================================================================================================================================== #Region ; Menu Section ; ================================================================================================================================== $RWG_File_Menu = GUICtrlCreateMenu('&File') $RWG_Exit_MenuItem = GUICtrlCreateMenuItem('E&xit' & @TAB & 'Ctrl+Alt+Q', $RWG_File_Menu) $RWG_View_Menu = GUICtrlCreateMenu('&View') $RWG_RefreshWindowList_MenuItem = GUICtrlCreateMenuItem('&Refresh Window List...', $RWG_View_Menu) $RWG_Help_Menu = GUICtrlCreateMenu('&Help') $RWG_ChangeLog_MenuItem = GUICtrlCreateMenuItem('View Change &Log...', $RWG_Help_Menu) GUICtrlCreateMenuItem('', $RWG_Help_Menu) $RWG_About_MenuItem = GUICtrlCreateMenuItem('&About...', $RWG_Help_Menu) ; ================================================================================================================================== #EndRegion ; Menu Section ; ================================================================================================================================== $RWG_OpenWindow_Label = GUICtrlCreateLabel("Select A Window To Resize:", 10, 10, 600, 20, $SS_CENTER) $RWG_OpenWindow_List = GUICtrlCreateList("", 10, 30, 600, 300) Refresh_WindowList(0) $RWG_WindowInfo_Label = GUICtrlCreateLabel("Window Information:", 620, 10, 150, 20, $SS_CENTER) GUICtrlCreateGroup('', 620, 23, 150, 260) $RWG_WindowMonitor_Label = GUICtrlCreateLabel("Located On:", 630, 40, 130, 20, $SS_CENTER) GUICtrlSetBkColor($RWG_WindowMonitor_Label, $GUI_BKCOLOR_TRANSPARENT) $RWG_WindowMonitor_Edit = GUICtrlCreateEdit("", 630, 60, 130, 22, BitOR($ES_READONLY, $ES_CENTER)) $RWG_WindowStart_Label = GUICtrlCreateLabel("Start Position (Left x Top):", 630, 85, 130, 20, $SS_CENTER) GUICtrlSetBkColor($RWG_WindowStart_Label, $GUI_BKCOLOR_TRANSPARENT) $RWG_WindowStart_Edit = GUICtrlCreateEdit("", 630, 105, 130, 22, BitOR($ES_READONLY, $ES_CENTER)) $RWG_WindowResolution_Label = GUICtrlCreateLabel("Current Resolution:", 630, 130, 130, 20, $SS_CENTER) GUICtrlSetBkColor($RWG_WindowResolution_Label, $GUI_BKCOLOR_TRANSPARENT) $RWG_WindowResolution_Edit = GUICtrlCreateEdit("", 630, 150, 130, 22, BitOR($ES_READONLY, $ES_CENTER)) $RWG_WindowState_Label = GUICtrlCreateLabel("Maximized Or Minimized:", 630, 180, 130, 20, $SS_CENTER) GUICtrlSetBkColor($RWG_WindowState_Label, $GUI_BKCOLOR_TRANSPARENT) $RWG_WindowState_Edit = GUICtrlCreateEdit("", 630, 200, 130, 22, BitOR($ES_READONLY, $ES_CENTER)) $RWG_WindowMonitorResolution_Label = GUICtrlCreateLabel("Monitor Resolution:", 630, 225, 130, 20, $SS_CENTER) GUICtrlSetBkColor($RWG_WindowMonitorResolution_Label, $GUI_BKCOLOR_TRANSPARENT) $RWG_WindowMonitorResolution_Edit = GUICtrlCreateEdit("", 630, 245, 130, 22, BitOR($ES_READONLY, $ES_CENTER)) GUICtrlCreateGroup("", -99, -99, 1, 1) $RWG_Process_Button = GUICtrlCreateButton('Process Pixels', 620, 293, 150, 30, $BS_DEFPUSHBUTTON) $RWG_WindowControl_Label = GUICtrlCreateLabel("Window Controls:", 10, 330, 600, 20, $SS_CENTER) $RWG_WindowControlVisible_CheckBox = GUICtrlCreateCheckbox("Show Only Visible Controls", 625, 325) GUICtrlSetState($RWG_WindowControlVisible_CheckBox, $GUI_CHECKED) $RWG_WindowControl_ListView = GUICtrlCreateListView("Control Handle|Class|Instance|ID|Visible|Left (X)|Top (Y)|Width|Height|Control Text", 10, 350, 760, 300, BitOr($LVS_NOSORTHEADER, $LVS_SINGLESEL), BitOr($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES, $WS_EX_CLIENTEDGE)) _GUICtrlListView_SetColumnWidth($RWG_WindowControl_ListView, 0, 112) _GUICtrlListView_JustifyColumn($RWG_WindowControl_ListView, 0, 2) _GUICtrlListView_SetColumnWidth($RWG_WindowControl_ListView, 2, 63) _GUICtrlListView_JustifyColumn($RWG_WindowControl_ListView, 2, 2) _GUICtrlListView_SetColumnWidth($RWG_WindowControl_ListView, 4, 56) _GUICtrlListView_JustifyColumn($RWG_WindowControl_ListView, 4, 2) _GUICtrlListView_SetColumnWidth($RWG_WindowControl_ListView, 5, 56) _GUICtrlListView_JustifyColumn($RWG_WindowControl_ListView, 5, 2) _GUICtrlListView_SetColumnWidth($RWG_WindowControl_ListView, 6, 56) _GUICtrlListView_JustifyColumn($RWG_WindowControl_ListView, 6, 2) _GUICtrlListView_SetColumnWidth($RWG_WindowControl_ListView, 7, 56) _GUICtrlListView_JustifyColumn($RWG_WindowControl_ListView, 7, 2) _GUICtrlListView_SetColumnWidth($RWG_WindowControl_ListView, 8, 56) _GUICtrlListView_JustifyColumn($RWG_WindowControl_ListView, 8, 2) GUICtrlSetBkColor($RWG_WindowControl_ListView, $GUI_BKCOLOR_LV_ALTERNATE) Get_WindowInfo(GUICtrlRead($RWG_OpenWindow_List)) Get_WindowControls(GUICtrlRead($RWG_OpenWindow_List), $RWG_WindowControlVisible) GUISetState() _GUICtrlListView_ClickItem($RWG_WindowControl_ListView, 0) WinSetOnTop($RWG_GUI, '', 1) While 1 $RWG_Msg = GUIGetMsg() Switch $RWG_Msg Case $GUI_EVENT_CLOSE, $RWG_Exit_MenuItem _OnExit() Case $RWG_RefreshWindowList_MenuItem Refresh_WindowList(0) Get_WindowControls(GUICtrlRead($RWG_OpenWindow_List), $RWG_WindowControlVisible) Case $RWG_About_MenuItem GUISetState(@SW_DISABLE, $RWG_GUI) JB2_ThankYou(0, $RWG_GUI, $Script_Name, $Script_Version) GUISetState(@SW_ENABLE, $RWG_GUI) Case $RWG_ChangeLog_MenuItem GUISetState(@SW_DISABLE, $RWG_GUI) JB2_ChangeLog($RWG_GUI, $Script_Name, $Script_Version) GUISetState(@SW_ENABLE, $RWG_GUI) Case $RWG_OpenWindow_List Get_WindowInfo(GUICtrlRead($RWG_OpenWindow_List)) Get_WindowControls(GUICtrlRead($RWG_OpenWindow_List), $RWG_WindowControlVisible) Case $RWG_WindowControlVisible_CheckBox If BitAND(GUICtrlRead($RWG_WindowControlVisible_CheckBox), $GUI_CHECKED) = $GUI_CHECKED Then $RWG_WindowControlVisible = True Else $RWG_WindowControlVisible = False EndIf Get_WindowControls(GUICtrlRead($RWG_OpenWindow_List), $RWG_WindowControlVisible) Case $RWG_WindowControl_ListView MsgBox(4096, 'Test', _GUICtrlListView_GetSelectedIndices($RWG_WindowControl_ListView), -1, $RWG_GUI) Case $RWG_Process_Button $RWG_PB_CurrentSelection = _GUICtrlListView_GetSelectionMark($RWG_WindowControl_ListView) $RWG_PB_CurrentSelection_List = _GUICtrlListView_GetItemTextArray($RWG_WindowControl_ListView, $RWG_PB_CurrentSelection) $hFrame = _WinAPI_GetParent($RWG_PB_CurrentSelection_List[1]) #CS GUISetState(@SW_HIDE, $RWG_GUI) Pixels2Table(GUICtrlRead($RWG_OpenWindow_List)) GUISetState(@SW_SHOW, $RWG_GUI) #CE EndSwitch WEnd ; ====================================================================================================================================================== #EndRegion ; Script Body ; ====================================================================================================================================================== #Region ; Necessary Supporting Functions ; ====================================================================================================================================================== #Region ; Get_WindowList Function ; ================================================================================================================================================== Func Get_WindowList() $WindowList = '' $Temp_WindowList = WinList() $Temp_WindowList_Content = '' Dim $WindowList[$Temp_WindowList[0][0]+1][3] ; Declared Globally At The Beginning $WindowList[0][0] = $Temp_WindowList[0][0]+1 For $w = 1 To $Temp_WindowList[0][0] ; Windows To Ignore, Both Windows Without A Title And A Windows That Are Not Actually Visible If $Temp_WindowList[$w][0] = '' Or $Temp_WindowList[$w][0] = $Script_Name & " " & $Script_Version Or $Temp_WindowList[$w][0] = 'BBar' Or $Temp_WindowList[$w][0] = 'ICA Seamless Host Agent' Or $Temp_WindowList[$w][0] = 'Message' Or $Temp_WindowList[$w][0] = 'OLEChannelWnd' Or $Temp_WindowList[$w][0] = 'Program Manager' Or $Temp_WindowList[$w][0] = 'Splash GUI' Or $Temp_WindowList[$w][0] = 'Start' Or StringRight($Temp_WindowList[$w][0], 5) = 'Toast' Then ContinueLoop ; Gets The Handle of The Current Window $Temp_WindowState = WinGetState($Temp_WindowList[$w][1]) #CS ; Filtering Windows Based On Window State ConsoleWrite($aWindows[$i][0] & ': ') If BitAND($Temp_WindowState, 1) = 1 Then ConsoleWrite(' exists') If BitAND($Temp_WindowState, 2) = 2 Then ConsoleWrite(' visible') If BitAND($Temp_WindowState, 4) = 4 Then ConsoleWrite(' enabled') If BitAND($Temp_WindowState, 8) = 8 Then ConsoleWrite(' active') If BitAND($Temp_WindowState, 16) = 16 Then ConsoleWrite(' minimized') If BitAND($Temp_WindowState, 32) = 32 Then ConsoleWrite(' maximized') ConsoleWrite(@CRLF) #CE If BitAND($Temp_WindowState, 2) = 2 Then $WindowList[$w][0] = $Temp_WindowList[$w][0] $WindowList[$w][1] = $Temp_WindowList[$w][1] If BitAND($Temp_WindowState, 8) = 8 Then $WindowList[$w][2] &= 'Active / ' If BitAND($Temp_WindowState, 16) = 16 Then $WindowList[$w][2] &= 'Minimized / ' If BitAND($Temp_WindowState, 32) = 32 Then $WindowList[$w][2] &= 'Maximized' If StringRight($WindowList[$w][2], 3) = ' / ' Then $WindowList[$w][2] = StringTrimRight($WindowList[$w][2], 3) If StringInStr($Temp_WindowList[$w][0], '|') Then $Temp_WindowList[$w][0] = StringReplace($Temp_WindowList[$w][0], '|', '[JB' & Chr(178) & ']') $Temp_WindowList_Content &= $Temp_WindowList[$w][0] & '|' EndIf Next _ArraySort($WindowList, 0, 1, 0, 0) $WindowList = JB2_DeleteEmpty2DArrayRows($WindowList) ; Column Structure: 0 = WindowTitle / 1 = WindowHandle $WindowList[0][0] = UBound($WindowList) - 1 If StringRight($Temp_WindowList_Content, 1) = '|' Then $Temp_WindowList_Content = StringTrimRight($Temp_WindowList_Content, 1) Return $Temp_WindowList_Content EndFunc ; ================================================================================================================================================== #EndRegion ; Get_WindowList Function ; ================================================================================================================================================== #Region ; Get_WindowInfo Function ; ================================================================================================================================================== Func Get_WindowInfo($GWL_Title) GUICtrlSetData($RWG_WindowTitle_Edit, '') GUICtrlSetData($RWG_WindowStart_Edit, '') GUICtrlSetData($RWG_WindowResolution_Edit, '') GUICtrlSetData($RWG_WindowState_Edit, '') GUICtrlSetData($RWG_WindowMonitor_Edit, '') GUICtrlSetData($RWG_WindowMonitorResolution_Edit, '') $GWL_TempState = '' If StringInStr($GWL_Title, '[JB' & Chr(178) & ']') Then $GWL_Title = StringReplace($GWL_Title, '[JB' & Chr(178) & ']', '|') $GWL_CurrentWindow_ListPosition = _ArraySearch($WindowList, $GWL_Title) $GWL_Handle = $WindowList[$GWL_CurrentWindow_ListPosition][1] If StringInStr($WindowList[$GWL_CurrentWindow_ListPosition][2], 'Maximized') Then $GWL_State = 'Maximized' ElseIf StringInStr($WindowList[$GWL_CurrentWindow_ListPosition][2], 'Minimized') Then $GWL_State = 'Minimized' Else $GWL_State = 'No' EndIf _GetMonitors() If $GWL_State = 'Minimized' Then WinSetState($GWL_Handle, '', @SW_RESTORE) $GWL_TempState = WinGetState($GWL_Handle) ; To Determine If The Minimized Window Is Maximized If Restored. $Temp_WinInfo = WinGetPos($GWL_Handle) WinSetState($GWL_Handle, '', @SW_MINIMIZE) Else $Temp_WinInfo = WinGetPos($GWL_Handle) EndIf If IsArray($Temp_WinInfo) Then If UBound($Temp_WinInfo) = 4 Then If $GWL_State = 'Maximized' Or BitAND($GWL_TempState, 32) = 32 Then $Temp_WinInfo[0] += 8 $Temp_WinInfo[1] += 8 EndIf $GWL_Monitor = _GetMonitorFromPoint($Temp_WinInfo[0], $Temp_WinInfo[1]) GUICtrlSetData($RWG_WindowStart_Edit, $Temp_WinInfo[0] & 'x' & $Temp_WinInfo[1]) GUICtrlSetData($RWG_WindowResolution_Edit, $Temp_WinInfo[2] & 'x' & $Temp_WinInfo[3]) GUICtrlSetData($RWG_WindowState_Edit, $GWL_State) GUICtrlSetData($RWG_WindowMonitor_Edit, 'Monitor ' & $GWL_Monitor) GUICtrlSetData($RWG_WindowMonitorResolution_Edit, $__MonitorList[$GWL_Monitor][5] & 'x' & $__MonitorList[$GWL_Monitor][6]) Else Refresh_WindowList(1, 'The selected window is no longer available.') Get_WindowInfo(GUICtrlRead($RWG_OpenWindow_List)) EndIf Else Refresh_WindowList(1, 'The selected window is no longer available.') Get_WindowInfo(GUICtrlRead($RWG_OpenWindow_List)) EndIf EndFunc ; ================================================================================================================================================== #EndRegion ; Get_WindowInfo Function ; ================================================================================================================================================== #Region ; Get_WindowControls Function ; ================================================================================================================================================== Func Get_WindowControls($GWC_Title, $GWC_Visible = True) _GUICtrlListView_BeginUpdate($RWG_WindowControl_ListView) _GUICtrlListView_DeleteAllItems($RWG_WindowControl_ListView) $RWG_WindowControl_ListView_1Width = 13 $RWG_WindowControl_ListView_3Width = 7 $RWG_WindowControl_ListView_9Width = 12 If StringLen($GWC_Title) > $RWG_WindowControl_ListView_9Width Then $RWG_WindowControl_ListView_9Width = StringLen($GWC_Title) If StringInStr($GWC_Title, '[JB' & Chr(178) & ']') Then $GWC_Title = StringReplace($GWC_Title, '[JB' & Chr(178) & ']', '|') $GWC_CurrentWindow_ListPosition = _ArraySearch($WindowList, $GWC_Title) $GWC_Handle = $WindowList[$GWC_CurrentWindow_ListPosition][1] $Temp_WinInfo = WinGetPos($GWC_Handle) _GUICtrlListView_AddItem($RWG_WindowControl_ListView, $GWC_Handle, 0) _GUICtrlListView_AddSubItem($RWG_WindowControl_ListView, 0, 'Entire Window', 1) _GUICtrlListView_AddSubItem($RWG_WindowControl_ListView, 0, 0, 2) _GUICtrlListView_AddSubItem($RWG_WindowControl_ListView, 0, 0, 3) _GUICtrlListView_AddSubItem($RWG_WindowControl_ListView, 0, 1, 4) _GUICtrlListView_AddSubItem($RWG_WindowControl_ListView, 0, $Temp_WinInfo[0], 5) _GUICtrlListView_AddSubItem($RWG_WindowControl_ListView, 0, $Temp_WinInfo[1], 6) _GUICtrlListView_AddSubItem($RWG_WindowControl_ListView, 0, $Temp_WinInfo[2], 7) _GUICtrlListView_AddSubItem($RWG_WindowControl_ListView, 0, $Temp_WinInfo[3], 8) _GUICtrlListView_AddSubItem($RWG_WindowControl_ListView, 0, $GWC_Title, 9) $GWC_ControlList = JB2_GetWindowControls($GWC_Handle, $GWC_Visible) For $li = 1 To $GWC_ControlList[0][0] If StringLen($GWC_ControlList[$li][1]) > $RWG_WindowControl_ListView_1Width Then $RWG_WindowControl_ListView_1Width = StringLen($GWC_ControlList[$li][1]) If StringLen($GWC_ControlList[$li][3]) > $RWG_WindowControl_ListView_3Width Then $RWG_WindowControl_ListView_3Width = StringLen($GWC_ControlList[$li][3]) If StringLen($GWC_ControlList[$li][9]) > $RWG_WindowControl_ListView_9Width Then $RWG_WindowControl_ListView_9Width = StringLen($GWC_ControlList[$li][9]) Assign("$RWG_WindowControl_ListView_Row" & Number($li),GUICtrlCreateListViewItem($GWC_ControlList[$li][0] & "|" & $GWC_ControlList[$li][1] & "|" & $GWC_ControlList[$li][2] & "|" & $GWC_ControlList[$li][3] & "|" & $GWC_ControlList[$li][4] & "|" & $GWC_ControlList[$li][5] & "|" & $GWC_ControlList[$li][6] & "|" & $GWC_ControlList[$li][7] & "|" & $GWC_ControlList[$li][8] & "|" & $GWC_ControlList[$li][9], $RWG_WindowControl_ListView)) GUICtrlSetBkColor(-1, 0xcccccc) Next _GUICtrlListView_SetColumnWidth($RWG_WindowControl_ListView, 1, Number(($RWG_WindowControl_ListView_1Width + 1) * 8)) ; 8px average width of characters at 8pt font. _GUICtrlListView_JustifyColumn($RWG_WindowControl_ListView, 1) _GUICtrlListView_SetColumnWidth($RWG_WindowControl_ListView, 3, Number(($RWG_WindowControl_ListView_3Width + 1) * 7)) ; 7px average width of characters at 8pt numeric font. _GUICtrlListView_JustifyColumn($RWG_WindowControl_ListView, 3, 2) _GUICtrlListView_SetColumnWidth($RWG_WindowControl_ListView, 9, Number(($RWG_WindowControl_ListView_9Width + 1) * 8)) ; 8px average width of characters at 8pt font. _GUICtrlListView_JustifyColumn($RWG_WindowControl_ListView, 9) _GUICtrlListView_EndUpdate($RWG_WindowControl_ListView) _GUICtrlListView_ClickItem($RWG_WindowControl_ListView, 0) EndFunc ; ================================================================================================================================================== #EndRegion ; Get_WindowControls Function ; ================================================================================================================================================== #Region ; Pixels2Table Function ; ================================================================================================================================================== Func Pixels2Table($P2T_Window) ProgressOn("Converting Pixels To HTML Table", "", "", $Progress_Left, $Progress_Top, 2) $P2T_CurrentWindow_ListPosition = _ArraySearch($WindowList, $P2T_Window) If StringInStr($WindowList[$P2T_CurrentWindow_ListPosition][2], 'Minimized') Then WinSetState($WindowList[$P2T_CurrentWindow_ListPosition][1], '', @SW_RESTORE) $P2T_CurrentWindow_Position = WinGetPos($WindowList[$P2T_CurrentWindow_ListPosition][1]) If StringLen($P2T_CurrentWindow_Position[2]) >= StringLen($P2T_CurrentWindow_Position[3]) Then $P2T_XYDigits = StringLen($P2T_CurrentWindow_Position[2]) Else $P2T_XYDigits = StringLen($P2T_CurrentWindow_Position[3]) EndIf WinActivate($WindowList[$P2T_CurrentWindow_ListPosition][1]) $ProgressTotalItems = Number($P2T_CurrentWindow_Position[2] * $P2T_CurrentWindow_Position[3]) $ProgressPercentPer = Number(100/$ProgressTotalItems) $ProgressProgress = 0 $ProgressPercent = 0 $ProgressLabel1 = "0 of " & $ProgressTotalItems & " Pixels(s)" $ProgressLabel2 = "0% Completed." ProgressSet($ProgressPercent, $ProgressLabel1 & " / " & $ProgressLabel2) ; ============================================================================================================================================== $P2T_FileHandle = FileOpen($P2T_FileName, 2) FileWrite($P2T_FileHandle, $P2T_Header) ; ============================================================================================================================================== $P2T_Y = 1 ; For $y = 1 To $P2T_CurrentWindow_Position[3] For $y = $P2T_CurrentWindow_Position[1] To Number($P2T_CurrentWindow_Position[1] + $P2T_CurrentWindow_Position[3]) FileWrite($P2T_FileHandle, @TAB & @TAB & @TAB & '<tr>' & @CRLF) ; ========================================================================================================================================== $P2T_X = 1 ; For $x = 1 To $P2T_CurrentWindow_Position[2] For $x = $P2T_CurrentWindow_Position[0] To Number($P2T_CurrentWindow_Position[0] + $P2T_CurrentWindow_Position[2]) ProgressSet($ProgressPercent, $ProgressLabel1 & " / " & $ProgressLabel2, 'Row (Y): ' & StringFormat('%0' & $P2T_XYDigits & 'i', $P2T_Y) & ' / Column (X): ' & StringFormat('%0' & $P2T_XYDigits & 'i', $P2T_X)) $Temp_P2T_Color = '#' & Hex(PixelGetColor($x, $y, $WindowList[$P2T_CurrentWindow_ListPosition][1]) , 6) FileWrite($P2T_FileHandle, @TAB & @TAB & @TAB & @TAB & '<td style="background-color: ' & $Temp_P2T_Color & ';"><span class="cellcontent">' & StringFormat('%0' & $P2T_XYDigits & 'i', $P2T_X) & 'X<br>' & StringFormat('%0' & $P2T_XYDigits & 'i', $P2T_Y) & 'Y</span><span class="hoverbox">Pixel Infomation<br><span class="hoverboxbody">Row (Y Position): ' & $P2T_Y & '<br>Column (X Position): ' & $P2T_X & '<br>Color Code: ' & $Temp_P2T_Color & '</span></span></td>' & @CRLF) $ProgressProgress += 1 $ProgressPercent += $ProgressPercentPer $ProgressLabel1 = $ProgressProgress & " of " & $ProgressTotalItems & " Pixrls(s)" $ProgressLabel2 = Round($ProgressPercent, 0) & "% Completed." $P2T_X += 1 Next ; ========================================================================================================================================== FileWrite($P2T_FileHandle, @TAB & @TAB & @TAB & '</tr>' & @CRLF) $P2T_Y += 1 Next ; ============================================================================================================================================== FileWrite($P2T_FileHandle, $P2T_Footer) FileClose($P2T_FileHandle) $ProgressLabel2 = "100% Completed." ProgressSet(100, $ProgressLabel1 & " / " & $ProgressLabel2, "Software Installation Complete") Sleep(5000) ProgressOff() ; ============================================================================================================================================== ShellExecute($P2T_FileName) EndFunc ; ================================================================================================================================================== #EndRegion ; Pixels2Table Function ; ================================================================================================================================================== #Region ; Refresh_WindowList Function ; ================================================================================================================================================== Func Refresh_WindowList($RWL_TrayTip, $RWL_MsgContent = '') ; $RWL_TrayTip : 0 = Off / 1 = On If $RWL_MsgContent <> '' And StringRight($RWL_MsgContent, 1) <> ' ' Then $RWL_MsgContent &= ' ' If $RWL_TrayTip = 1 Then TrayTip('Resize-A-Window...', $RWL_MsgContent & 'Refreshing window list.', 10, 2) $RWG_OpenWindow_List_Content = Get_WindowList() $RWG_OpenWindow_List_CurrentContent = '' For $a = 1 To $WindowList[0][0] If StringInStr($WindowList[$a][2], 'Active') Then $RWG_OpenWindow_List_CurrentContent = $WindowList[$a][0] Next If $RWG_OpenWindow_List_CurrentContent = '' Then $RWG_OpenWindow_List_CurrentContent = $WindowList[1][0] GUICtrlSetData($RWG_OpenWindow_List, '', '') GUICtrlSetData($RWG_OpenWindow_List, $RWG_OpenWindow_List_Content, $RWG_OpenWindow_List_CurrentContent) EndFunc ; ================================================================================================================================================== #EndRegion ; Refresh_WindowList Function ; ================================================================================================================================================== #Region ; JB2_GetWindowControls Function ; ============================================================================================================================================================ ; = Name.............: JB2_GetWindowControls = ; = Description......: Returns all or a specified subset of controls for a given window. = ; = Required Includes: Array.au3 & WinAPI.au3 = ; = Syntax...........: JB2_GetWindowControls($GWC_WindowHandle[, $GWC_VisibleOnly = False[, $GWC_ControlTextContains = ''[, $GWC_GetSpecificClasses = '']]]) = ; = Parameters ......: $GWC_WindowHandle - The handle (hWnd) of the window to get the controls from. = ; = $GWC_VisibleOnly - Optional: True - Retrieves only visible controls or False - Retrieves all controls. = ; = $GWC_ControlTextContains - Optional: Text that a control must contain to be returned. = ; = $GWC_GetSpecificClasses - Optional: A specific class to return. (i.e. Button, ComboBox, Edit, Static, Etc.) = ; = Return values....: Success - Returns an array containing window control information. = ; = Failure - 0 = ; = Author...........: jdelaney = ; = Modified.........: Joshua Barnette, JBSquaredDesigns.com (2015-10-26) = ; = Retrieved From...: https://www.autoitscript.com/forum/topic/164226-get-all-windows-controls/ = ; = Remarks..........: If only the window handle is given all window controls are returned. = ; = = ; = The array returned is two-dimensional and is made up as follows: = ; = $aArray[0][0] = Number of controls returned = ; = $aArray[1][0] = 1st control handle (hWnd) = ; = $aArray[1][1] = 1st control class = ; = $aArray[1][2] = 1st control class instance = ; = $aArray[1][3] = 1st control ID = ; = $aArray[1][4] = 1st control visibility (1 - Visible, 0 - Not Visible) = ; = $aArray[1][5] = 1st control X position realtive to window = ; = $aArray[1][6] = 1st control Y position realtive to window = ; = $aArray[1][7] = 1st control width = ; = $aArray[1][8] = 1st control height = ; = $aArray[1][9] = 1st control text = ; = ... = ; = $aArray[n][0] = nth control handle (hWnd) = ; = $aArray[n][1] = nth control class = ; = $aArray[n][2] = nth control class instance = ; = $aArray[n][3] = nth control ID = ; = $aArray[n][4] = nth control visibility (1 - Visible, 0 - Not Visible) = ; = $aArray[n][5] = nth control X position realtive to window = ; = $aArray[n][6] = nth control Y position realtive to window = ; = $aArray[n][7] = nth control width = ; = $aArray[n][8] = nth control height = ; = $aArray[n][9] = nth control text = ; = = ; ============================================================================================================================================================ Func JB2_GetWindowControls($GWC_WindowHandle, $GWC_VisibleOnly = 0, $GWC_ControlTextContains = '', $GWC_GetSpecificClass = '') If Not IsHWnd($GWC_WindowHandle) Then ; MsgBox(16, $Script_Name & ' Error', 'To retrieve all window controls, you must provide a valid window handle (hwnd).') Return 0 EndIf $GWC_GetClassList = WinGetClassList($GWC_WindowHandle) ; Create array $GWC_ClassList = StringSplit($GWC_GetClassList, @CRLF, 2) ; Sort array _ArraySort($GWC_ClassList) _ArrayDelete($GWC_ClassList, 0) Dim $GWC_WindowControlList[UBound($GWC_ClassList) + 1][10] $GWC_WindowControlList[0][0] = UBound($GWC_ClassList) + 1 ; Loop $GWC_CurrentClass = '' $GWC_CurrentClassCount = 1 $GWC_TotalCounter = 1 If StringLen($GWC_GetSpecificClass) > 0 Then For $sc = UBound($GWC_ClassList)-1 To 0 Step - 1 If $GWC_ClassList[$sc] <> $GWC_GetSpecificClass Then _ArrayDelete($GWC_ClassList, $sc) EndIf Next EndIf For $cl = 0 To UBound($GWC_ClassList) - 1 If $GWC_ClassList[$cl] = $GWC_CurrentClass Then $GWC_CurrentClassCount += 1 Else $GWC_CurrentClass = $GWC_ClassList[$cl] $GWC_CurrentClassCount = 1 EndIf $GWC_ControlHandle = ControlGetHandle($GWC_WindowHandle, "", "[CLASSNN:" & $GWC_CurrentClass & $GWC_CurrentClassCount & "]") $GWC_ControlText = StringRegExpReplace(ControlGetText($GWC_WindowHandle, "", $GWC_ControlHandle), "[\n\r]", "{@CRLF}") $GWC_ControlPosition = ControlGetPos($GWC_WindowHandle, "", $GWC_ControlHandle) $GWC_CurrentClassID = _WinAPI_GetDlgCtrlID($GWC_ControlHandle) $GWC_ControlVisibility = ControlCommand($GWC_WindowHandle, "", $GWC_ControlHandle, "IsVisible") If $GWC_VisibleOnly And Not $GWC_ControlVisibility Then ; $GWC_TotalCounter += 1 ContinueLoop EndIf If StringLen($GWC_ControlTextContains) > 0 Then If Not StringInStr($GWC_ControlText, $GWC_ControlTextContains) Then ; $GWC_TotalCounter += 1 ContinueLoop EndIf EndIf $GWC_WindowControlList[$GWC_TotalCounter][0] = $GWC_ControlHandle $GWC_WindowControlList[$GWC_TotalCounter][1] = $GWC_ClassList[$cl] $GWC_WindowControlList[$GWC_TotalCounter][2] = $GWC_CurrentClassCount $GWC_WindowControlList[$GWC_TotalCounter][3] = $GWC_CurrentClassID $GWC_WindowControlList[$GWC_TotalCounter][4] = $GWC_ControlVisibility If IsArray($GWC_ControlPosition) Then $GWC_WindowControlList[$GWC_TotalCounter][5] = $GWC_ControlPosition[0] $GWC_WindowControlList[$GWC_TotalCounter][6] = $GWC_ControlPosition[1] $GWC_WindowControlList[$GWC_TotalCounter][7] = $GWC_ControlPosition[2] $GWC_WindowControlList[$GWC_TotalCounter][8] = $GWC_ControlPosition[3] EndIf $GWC_WindowControlList[$GWC_TotalCounter][9] = $GWC_ControlText If Not WinExists($GWC_WindowHandle) Then ExitLoop $GWC_TotalCounter += 1 Next $GWC_WindowControlList = JB2_DeleteEmpty2DArrayRows($GWC_WindowControlList) $GWC_WindowControlList[0][0] = UBound($GWC_WindowControlList) - 1 Return $GWC_WindowControlList EndFunc ;==>GetAllWindowsControls ; ============================================================================================================================================================ ; = Author...........: jdelaney = ; = Modified.........: Joshua Barnette, JBSquaredDesigns.com (2015-10-26) = ; = Retrieved From...: https://www.autoitscript.com/forum/topic/164226-get-all-windows-controls/ = ; ============================================================================================================================================================ #EndRegion ; JB2_GetWindowControls Function ; ================================================================================================================================================== #Region ; OnExit Functions ; ================================================================================================================================================== Func _OnExit() GUIDelete($RWG_GUI) Exit EndFunc ; ================================================================================================================================================== Func _OnExitWithMsg() GUIDelete($RWG_GUI) JB2_ThankYou(2000) Exit EndFunc ; ================================================================================================================================================== #EndRegion ; OnExit Functions ; ================================================================================================================================================== #Region ; JB2_DeleteEmpty2DArrayRows Function ; ================================================================================================================================================== ; = Written By: WeaponX ; = Retrieved From : http://www.autoitscript.com/forum/topic/97637-remove-empty-rows-in-2d-array/ ; = Modified By: Joshua Barnette, JBSquaredDesigns.com (2014-05-28) ; ============================================================================================================================================== Func JB2_DeleteEmpty2DArrayRows($JB2_DeleteEmpty2DArrayRows_Array) Local $JB2_DeleteEmpty2DArrayRows_Rows = Ubound($JB2_DeleteEmpty2DArrayRows_Array,1) Local $JB2_DeleteEmpty2DArrayRows_Cols = Ubound($JB2_DeleteEmpty2DArrayRows_Array,2) Local $JB2_DeleteEmpty2DArrayRows_Temp[$JB2_DeleteEmpty2DArrayRows_Rows][$JB2_DeleteEmpty2DArrayRows_Cols] Local $JB2_DeleteEmpty2DArrayRows_NotEmpty Local $JB2_DeleteEmpty2DArrayRows_Count = 0 ;Loop through rows For $Y = 0 to $JB2_DeleteEmpty2DArrayRows_Rows - 1 $JB2_DeleteEmpty2DArrayRows_NotEmpty = 0 ;Loop through columns For $X = 0 to $JB2_DeleteEmpty2DArrayRows_Cols - 1 ;Copy all columns to temp array even if they are all empty $JB2_DeleteEmpty2DArrayRows_Temp[$JB2_DeleteEmpty2DArrayRows_Count][$X] = $JB2_DeleteEmpty2DArrayRows_Array[$Y][$X] ;If even one column contains data, make sure it doesn't get deleted If $JB2_DeleteEmpty2DArrayRows_Array[$Y][$X] <> "" Then $JB2_DeleteEmpty2DArrayRows_NotEmpty = BitOr($JB2_DeleteEmpty2DArrayRows_NotEmpty, 1) Next ;If the row has any data, increment, else keep overwriting last row until it contains something If $JB2_DeleteEmpty2DArrayRows_NotEmpty Then $JB2_DeleteEmpty2DArrayRows_Count += 1 Next Redim $JB2_DeleteEmpty2DArrayRows_Temp[$JB2_DeleteEmpty2DArrayRows_Count][$JB2_DeleteEmpty2DArrayRows_Cols] $JB2_DeleteEmpty2DArrayRows_Temp[0][0] = UBound($JB2_DeleteEmpty2DArrayRows_Temp) - 1 Return $JB2_DeleteEmpty2DArrayRows_Temp EndFunc ; ================================================================================================================================================== #EndRegion ; JB2_DeleteEmpty2DArrayRows Function ; ================================================================================================================================================== #Region ; JB2_SplashScreen & Supporting Functions ; ================================================================================================================================================== #Region ; JB2_SplashScreen ; ============================================================================================================================================== Func JB2_SplashScreen($JB2_SplashScreen_Status, $JB2_SplashScreen_Status_Message = "") If $JB2_SplashScreen_Status = "On" Then Global $JB2_SplashScreen_Image = _ResourceGetAsImage("JB2_SplashScreen_Image", $RT_RCDATA) ; Extract image width and height from PNG Global $JB2_SplashScreen_Width = _GDIPlus_ImageGetWidth($JB2_SplashScreen_Image) Global $JB2_SplashScreen_Height = _GDIPlus_ImageGetHeight($JB2_SplashScreen_Image) ; Create layered window Global $JB2_SplashScreen_GUI = GUICreate("Splash GUI", $JB2_SplashScreen_Width, $JB2_SplashScreen_Height, -1, -1, $WS_POPUP, $WS_EX_LAYERED, WinGetHandle(AutoItWinGetTitle())) JB2_SplashScreen_SetBitmap($JB2_SplashScreen_GUI, $JB2_SplashScreen_Image, 0) GUISetState(@SW_SHOW) ;fade in png background For $i = 0 To 255 Step 17 JB2_SplashScreen_SetBitmap($JB2_SplashScreen_GUI, $JB2_SplashScreen_Image, $i) Sleep(50) Next ; create child MDI gui window to hold controls Global $JB2_SplashScreen_GUI_Child = GUICreate("Splash GUI Child", $JB2_SplashScreen_Width-20, 17, 10, $JB2_SplashScreen_Height+5, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $JB2_SplashScreen_GUI) ; child window transparency is required to accomplish the full effect, so $WS_EX_LAYERED above, and ; I think the way this works is the transparent window color is based on the image you set here: GUICtrlCreatePic("", 0, 0, $JB2_SplashScreen_Width-20, 17) GUICtrlSetState(-1, $GUI_DISABLE) Global $JB2_SplashScreen_GUI_Message = GUICtrlCreateLabel("", 0, 0, $JB2_SplashScreen_Width-20, 17) GUICtrlSetFont(-1, 9, 800) If StringInStr(@OSVersion, "WIN_XP") Then GUICtrlSetColor(-1, 0x000066) GUICtrlSetBKColor(-1, 0x000000) Else GUICtrlSetColor(-1, 0x000066) GUICtrlSetBKColor(-1, 0xFFFFFF) EndIf GUISetState(@SW_SHOW) ElseIf $JB2_SplashScreen_Status = "Update" Then GUICtrlSetData($JB2_SplashScreen_GUI_Message, $JB2_SplashScreen_Status_Message) ElseIf $JB2_SplashScreen_Status = "Off" Then GUIDelete($JB2_SplashScreen_GUI_Child) For $i = 255 To 0 Step -17 JB2_SplashScreen_SetBitmap($JB2_SplashScreen_GUI, $JB2_SplashScreen_Image, $i) Sleep(50) Next GUIDelete($JB2_SplashScreen_GUI) _WinAPI_DeleteObject($JB2_SplashScreen_Image) EndIf EndFunc ; ============================================================================================================================================== #EndRegion ; JB2_SplashScreen ; ============================================================================================================================================== #Region ; JB2_SplashScreen_SetBitmap ; ============================================================================================================================================== Func JB2_SplashScreen_SetBitmap($JB2_SplashScreen_hGUI, $JB2_SplashScreen_hImage, $JB2_SplashScreen_iOpacity) Local $JB2_SplashScreen_hScrDC, $JB2_SplashScreen_hMemDC, $JB2_SplashScreen_hBitmap, $JB2_SplashScreen_hOld, $JB2_SplashScreen_pSize, $JB2_SplashScreen_tSize, $JB2_SplashScreen_pSource, $JB2_SplashScreen_tSource, $JB2_SplashScreen_pBlend, $JB2_SplashScreen_tBlend $JB2_SplashScreen_hScrDC = _WinAPI_GetDC(0) $JB2_SplashScreen_hMemDC = _WinAPI_CreateCompatibleDC($JB2_SplashScreen_hScrDC) $JB2_SplashScreen_hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($JB2_SplashScreen_hImage) $JB2_SplashScreen_hOld = _WinAPI_SelectObject($JB2_SplashScreen_hMemDC, $JB2_SplashScreen_hBitmap) $JB2_SplashScreen_tSize = DllStructCreate($tagSIZE) $JB2_SplashScreen_pSize = DllStructGetPtr($JB2_SplashScreen_tSize) DllStructSetData($JB2_SplashScreen_tSize, "X", _GDIPlus_ImageGetWidth($JB2_SplashScreen_hImage)) DllStructSetData($JB2_SplashScreen_tSize, "Y", _GDIPlus_ImageGetHeight($JB2_SplashScreen_hImage)) $JB2_SplashScreen_tSource = DllStructCreate($tagPOINT) $JB2_SplashScreen_pSource = DllStructGetPtr($JB2_SplashScreen_tSource) $JB2_SplashScreen_tBlend = DllStructCreate($tagBLENDFUNCTION) $JB2_SplashScreen_pBlend = DllStructGetPtr($JB2_SplashScreen_tBlend) DllStructSetData($JB2_SplashScreen_tBlend, "Alpha", $JB2_SplashScreen_iOpacity) DllStructSetData($JB2_SplashScreen_tBlend, "Format", $JB2_SplashScreen_AC_SRC_ALPHA) _WinAPI_UpdateLayeredWindow($JB2_SplashScreen_hGUI, $JB2_SplashScreen_hScrDC, 0, $JB2_SplashScreen_pSize, $JB2_SplashScreen_hMemDC, $JB2_SplashScreen_pSource, 0, $JB2_SplashScreen_pBlend, $ULW_ALPHA) _WinAPI_ReleaseDC(0, $JB2_SplashScreen_hScrDC) _WinAPI_SelectObject($JB2_SplashScreen_hMemDC, $JB2_SplashScreen_hOld) _WinAPI_DeleteObject($JB2_SplashScreen_hBitmap) _WinAPI_DeleteDC($JB2_SplashScreen_hMemDC) EndFunc ; ============================================================================================================================================== #EndRegion ; JB2_SplashScreen_SetBitmap ; ================================================================================================================================================== #EndRegion ; JB2_SplashScreen & Supporting Functions ; ================================================================================================================================================== #Region ; JB2_ChangeLog Function ; ================================================================================================================================================== Func JB2_ChangeLog($JB2_ChangeLog_GUIWindow = '', $JB2_ChangeLog_Script_Title = '', $JB2_ChangeLog_Script_Version = '') $JB2_ChangeLog_ListView_0Width = 0 $JB2_ChangeLog_ListView_1Width = 0 If $JB2_ChangeLog_Script_Title = '' Then $JB2_ChangeLog_GUI_Title = 'Change Log' Else $JB2_ChangeLog_GUI_Title = $JB2_ChangeLog_Script_Title & ' Change Log' EndIf $JB2_ChangeLog_GUI = GUICreate($JB2_ChangeLog_GUI_Title, 600, 550, -1, -1, BitXOR($GUI_SS_DEFAULT_GUI, $WS_MINIMIZEBOX), -1, $JB2_ChangeLog_GUIWindow) $JB2_ChangeLog_AppLogo = GUICtrlCreatePic("", 15, 15, 256, 256) GUICtrlSetBkColor($JB2_ChangeLog_AppLogo, $GUI_BKCOLOR_TRANSPARENT) _ResourceSetImageToCtrl($JB2_ChangeLog_AppLogo, "JB2_SplashScreen_Image") GUICtrlCreateLabel($JB2_ChangeLog_Script_Title, 296, 25, 300, 25, $SS_CENTER) GUICtrlSetFont (-1, 14, 800) If $JB2_ChangeLog_Script_Version <> "" Then GUICtrlCreateLabel("Version: " & $JB2_ChangeLog_Script_Version, 296, 50, 300, 20, $SS_CENTER) GUICtrlSetFont (-1, 10, 600) EndIf GUICtrlCreateLabel("Copyright © 2014-" & @YEAR & ", JBSquaredDesigns.com." & @CRLF & "All Rights Reserved.", 296, 75, 300, 30, $SS_CENTER) $JB2_ChangeLog_Logo = GUICtrlCreatePic("", 382, 105, 128, 128) GUICtrlSetBkColor($JB2_ChangeLog_Logo, $GUI_BKCOLOR_TRANSPARENT) _ResourceSetImageToCtrl($JB2_ChangeLog_Logo, "JB2_128PNG_Logo") GUICtrlCreateGroup("", 10, 276, 580, 265) GUICtrlCreateLabel("Change Log", 20, 288, 560, 30, $SS_CENTER) GUICtrlSetFont (-1, 14, 800) $JB2_ChangeLog_ListView = GUICtrlCreateListView("Date|Changes", 20, 316, 560, 215, BitOr($LVS_NOSORTHEADER, $LVS_SORTASCENDING), BitOr($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES, $WS_EX_CLIENTEDGE)) GUICtrlSetBkColor($JB2_ChangeLog_ListView, $GUI_BKCOLOR_LV_ALTERNATE) For $li = 2 To $Script_ChangeLog[0][0] If StringLen($Script_ChangeLog[$li][0]) > $JB2_ChangeLog_ListView_0Width Then $JB2_ChangeLog_ListView_0Width = StringLen($Script_ChangeLog[$li][0]) If StringLen($Script_ChangeLog[$li][1]) > $JB2_ChangeLog_ListView_1Width Then $JB2_ChangeLog_ListView_1Width = StringLen($Script_ChangeLog[$li][1]) Assign("$JB2_ChangeLog_ListView_Row" & Number($li - 1),GUICtrlCreateListViewItem($Script_ChangeLog[$li][0] & "|" & $Script_ChangeLog[$li][1], $JB2_ChangeLog_ListView)) GUICtrlSetBkColor(-1, 0xcccccc) Next _GUICtrlListView_SetColumnWidth($JB2_ChangeLog_ListView, 0, Number(($JB2_ChangeLog_ListView_0Width + 2) * 8)) ; 8px average width of characters at 8pt font. _GUICtrlListView_JustifyColumn($JB2_ChangeLog_ListView, 0, 2) _GUICtrlListView_SetColumnWidth($JB2_ChangeLog_ListView, 1, Number(($JB2_ChangeLog_ListView_1Width + 1) * 8)) ; 8px average width of characters at 8pt font. _GUICtrlListView_JustifyColumn($JB2_ChangeLog_ListView, 1) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState() While 1 $JB2_ChangeLog_iMsg = GUIGetMsg() Switch $JB2_ChangeLog_iMsg Case $GUI_EVENT_CLOSE GUIDelete($JB2_ChangeLog_GUI) Return EndSwitch WEnd EndFunc ; ================================================================================================================================================== #EndRegion ; JB2_ChangeLog Function ; ================================================================================================================================================== #Region ; JB2_ThankYou Function ; ================================================================================================================================================== Func JB2_ThankYou($JB2_ThankYou_SleepTimer, $JB2_ThankYou_GUIWindow = '', $JB2_ThankYou_Script_Title = '', $JB2_ThankYou_Script_Version = '') If $JB2_ThankYou_SleepTimer <> 0 Then $JB2_ThankYou_GUI = GUICreate("Thank You For Choosing:", 280, 280, -1, -1, BitXOR($GUI_SS_DEFAULT_GUI, $WS_MINIMIZEBOX), -1, $JB2_ThankYou_GUIWindow) $Logo = GUICtrlCreatePic("", 15, 15, 250, 250, $SS_SUNKEN) _ResourceSetImageToCtrl($Logo, "JB2_Logo") GUISetState() Sleep($JB2_ThankYou_SleepTimer) Else If $JB2_ThankYou_Script_Title = "" Then $JB2_ThankYou_GUI_Title = "About" Else $JB2_ThankYou_GUI_Title = "About " & $JB2_ThankYou_Script_Title EndIf $JB2_ThankYou_GUI = GUICreate($JB2_ThankYou_GUI_Title, 560, 280, -1, -1, BitXOR($GUI_SS_DEFAULT_GUI, $WS_MINIMIZEBOX), -1, $JB2_ThankYou_GUIWindow) $Logo = GUICtrlCreatePic("", 15, 15, 250, 250, $SS_SUNKEN) _ResourceSetImageToCtrl($Logo, "JB2_Logo") GUICtrlCreateLabel($JB2_ThankYou_Script_Title, 290, 25, 260, 25, $SS_CENTER) GUICtrlSetFont (-1, 14, 800) If $JB2_ThankYou_Script_Version <> "" Then GUICtrlCreateLabel("Version: " & $JB2_ThankYou_Script_Version, 290, 50, 260, 20, $SS_CENTER) GUICtrlSetFont (-1, 10, 600) EndIf GUICtrlCreateLabel("Copyright © 2014-" & @YEAR & ", JBSquaredDesigns.com." & @CRLF & "All Rights Reserved.", 290, 75, 260, 200, $SS_CENTER) GUISetState() While 1 $JB2_ThankYou_iMsg = GUIGetMsg() Switch $JB2_ThankYou_iMsg Case $GUI_EVENT_CLOSE GUIDelete($JB2_ThankYou_GUI) Return EndSwitch WEnd EndIf EndFunc ; ================================================================================================================================================== #EndRegion ; JB2_ThankYou Function ; ====================================================================================================================================================== #EndRegion ; Necessary Supporting Functions ; ====================================================================================================================================================== TrayMenuIcons.au3 ShowMonitorInfo.au3
  18. Hello, I need some help with my gui, when I click on button 2 it call a MsgBox 2, but when I click on button 1 then button 2 it call a MsgBox 1. I tear appart my code to minimal function then the error occur again ... Here the script : The error : Run my script, click on "OUVRIR" then click on "View" and click on "GO" you get a message : "L'URL ne semble pas valide." Now close the view menu, click on "Add entry" , close this menu , click on "View" and click on "GO" you get another message : "Les mots de passe ================================= sont diff├ęrents." This message must only appear when you click on "Validate" in the "Add entry" menu .... I had the same problem on another PC with AutoIT 3.3.14.0 I've changed my variable, add another button , etc... The problem occur only with this two menus and this button. Can you test it ? If you don't have this error perhaps my AutoIT package (installer form AutoIT fr) have a problem. Thank you.
  19. Hello, I need help, I have created couple small pictures(about 200) in one GUI, I need to move them fast about 1-5 pixels every picture somehow. There are only pictures in GUI, no other controls. I tried this, but it's too slow: Global Const $AC_SRC_ALPHA = 1 For $ii = 0 To $size For $iii = 0 To $size GUICtrlSetPos(_ArrayGet($data, $ii, $iii, 1), ControlGetPos($GUI, "", _ArrayGet($data, $ii, $iii, 1))[0] + 2, ControlGetPos($GUI, "", _ArrayGet($data, $ii, $iii, 1))[1] + 2) Next Next Func _ArrayGet(ByRef $aArray, $i1, $i2 = 0, $i3 = 0, $i4 = 0, $i5 = 0, $i6 = 0, $i7 = 0, $i8 = 0, $i9 = 0, $i10 = 0, $i11 = 0, $i12 = 0, $i13 = 0, $i14 = 0, $i15 = 0, $i16 = 0, $i17 = 0, $i18 = 0, $i19 = 0, $i20 = 0) ;Function made by ProgAndy Local $iDims = UBound($aArray, 0) #forceref $i1, $i2, $i3, $i4, $i5, $i6, $i7, $i8, $i9, $i10, $i11, $i12, $i13, $i14, $i15, $i16, $i17, $i18, $i19, $i20 Local $NULL If Not IsArray($aArray) Then Return SetError(1, 1, $NULL) Local $sAccess = "$aArray" For $i = 1 To $iDims Local $iIndex = Int(Eval("i" & $i)) If $iIndex >= UBound($aArray, $i) Then Return SetError(3, $i, $NULL) $sAccess &= '[' & $iIndex & ']' Next If @NumParams - 1 > $iDims Then For $i = $iDims - 1 To @NumParams $sAccess &= ", $i" & $i Next Local $vResult = Execute("_ArrayGet(" & $sAccess & ")") If @error Then SetError(@error, @extended + $iDims) Return $vResult Else Return Execute($sAccess) EndIf EndFunc ;==>_ArrayGetI didn't wrote all script, becouse it's huge. It took about 1200 - 1600 milisecounds, I need that pictures would move much faster. It's possible to make it much faster, that it would took about 2-10 milisecounds? Thanks.
  20. Hi Mate. Some times we need to launch a control panel item to users. So I Implemented an IOpenControlPanel Interface. It allows to launch control panel items easily. #include "ControlPanelConstants.au3" Global Const $sCLSID_OpenControlPanel = "{06622D85-6856-4460-8DE1-A81921B41C4B}" Global Const $sIID_IOpenControlPanel = "{D11AD862-66DE-4DF4-BF6C-1F5621996AF1}" Global Const $sTagIOpenControlPanel= "Open hresult(wstr;wstr;ptr);GetPath hresult(wstr;wstr;uint);GetCurrentView hresult(int*)" Local $oOpenControlPanel = ObjCreateInterface($sCLSID_OpenControlPanel, $sIID_IOpenControlPanel, $sTagIOpenControlPanel) $oOpenControlPanel.Open($MicrosoftAdministrativeTools,"",Null) $oOpenControlPanel.Open($MicrosoftDateAndTime,$AdditionalClocks,Null) $oOpenControlPanel.Open($MicrosoftDefaultPrograms,$pageDefaultProgram,Null) $oOpenControlPanel.Open($GUID_MicrosoftDeviceManager,"",Null) $oOpenControlPanel.Open($GUID_MicrosoftDevicesAndPrinters,"",Null) $oOpenControlPanel.Open($MicrosoftHomeGroup,"",Null) $oOpenControlPanel.Open($MicrosoftInternetOptions,$Connections,Null) $oOpenControlPanel.Open($MicrosoftPersonalization,$pageWallpaper,Null) $oOpenControlPanel=0;Free ControlPanelConstants.au3 Saludos
  21. Hi I making a small tool that create wifi Hotspot use netsh cmd All command is ok But only sharing option that i dont know how to control That list all network for choice one network to share Then set properties Sharing I find any infomation about 2hour but i cant find anything I thinking about control click but it will not right for all windows version Please. Help me! Have you some ideas?
  22. IE Embedded Control Versioning Use IE 9+ and HTML5 features inside a GUI This UDF allows the use of embedded IE controls which support IE versions greater than IE 7. By default, all embedded IE controls default to IE 7 compatibility mode (unless for some reason somebody has IE 6 installed!), so its not possible to use most of the HTML5 features available today. Fortunately, IE 9 and greater allow the use of HTML5, and the embedded IE control actually supports it. The problem is convincing Windows to let your program actually use those features! There are Registry branches that modify how an IE control works in specific programs. Those branches are: HKCU\Software\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION HKLM\SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION In at least one of these branches, the executable name needs to appear as a value name ("autoit.exe" for example), and the value data needs to indicate what IE version to 'emulate'. The value data is actually dependent on the version and whether quirks-mode is enabled. See Web Browser Control - Specifying the IE Version for more information. Note that a 64-bit O/S needs adjustments to the HKLM paths. Also, prefer the HKCU branch unless the program needs to enable access across all user accounts. HTML5 Canvas Element Example Anyway, all the complexity of setting the right value with the right name with the right 32/64-bit branch is handled for you in this UDF. Enabling support for IE9+, and new HTML5 features, is as simple as making one call to _IE_EmbeddedSetBrowserEmulation(). _IE_EmbeddedSetBrowserEmulation() takes an executable name (@AutoItExe if none is provided), and checks the Registry for an entry for it. If it doesn't find one, it will create one and enable support for later versions of IE. The full parameters to the function are as follows: _IE_EmbeddedSetBrowserEmulation($nIEVersion, $bIgnoreDOCTYPE = True, $bHKLMBranch = False, $sExeName = @AutoItExe) The parameter passed in $nIEVersion can be anything from 8 to 11 [or 12+ in the future], or just the current version of IE, which is available also through a call to _IE_EmbeddedGetVersion(). $bIgnoreDOCTYPE controls when IE will go into quirks mode based on any "<!DOCTYPE>" declarations on webpages. This mode can cause major problems, so by default it is set to ignore it (set this to False to enable it). $bHKLMBranch controls where in the registry the Browser Emulation Mode setting will be stored. If you wish to store the mode for ALL users, set this parameter to True. Note, however, that elevated privileges are required for modifying the HKLM branch! If the call to _IE_EmbeddedSetBrowserEmulation() is successful, then you can enable a (more) HTML5 compliant IE browser control in a GUI. The complete set of functions in the UDF: _IE_EmbeddedGetVersion() ; Gets version of IE Embeddable Control (from ieframe.dll or Registry) _IE_EmbeddedGetBrowserEmulation() ; Gets Browser Emulation Version for given Executable (or 0 if not found) _IE_EmbeddedSetBrowserEmulation() ; Sets Browser Emulation Version. NOTE: HKLM branch REQUIRES ELEVATED PRIVILEGES! _ IMPORTANT: Setting the embedded browser object to a newer version of IE may alter the behavior of some things. See documenation for the HTMLDocumentEvents2 interface and HTMLAnchorEvents2 interface for example. Also, there is at least one difference in behavior noted by mesale0077 in working with IE10 (and possibly other versions of IE) - clicks for elements inside an <a> anchor tag will register as the actual internal element rather than the surrounding anchor. For example, an <img> element wrapped by an <a> anchor will only send the click to the <img> element and not propagate it any further. A workaround for this is to check the parentNode to see if it is an <a> element. See the discussion in the >ObjEvent dont work thread. It could be that there's some other reason for this behavior, but nothing has come to light yet. As an aside, also see trancexx's response in >ObjEvent usage for more techniques for capturing IE events. History: An example of HTML5 use, which has a little interactive Canvas, follows (requires IE9 or higher!): #include "IE_EmbeddedVersioning.au3" ; =============================================================================================================================== ; <IE_EmbeddedHTML5Example.au3> ; ; Example of using 'IE_EmbeddedVersioning' UDF ; ; This example 1st attempts to set the Browser Emulation information in the registry, then ; creates an embedded IE control with an interactive HTML5 Canvas element. ; ; Author: Ascend4nt ; =============================================================================================================================== #Region IE_CANVAS_EXAMPLE #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <IE.au3> ; ----------- ; GLOBALS ; ----------- Global $bMouseDown = False, $iLastX1 = 0, $iLastY1 = 0 Global $g_oCanvas, $g_oCtx Global $hGUI, $ctGUI_ErrMessageLabel Global $GUI_IE_Obj Global $nRet = _WinMain() ; Optionally remove valuename at Exit (not recommended if compiled to executable) ;~ _IE_EmbeddedRemoveBrowserEmulation() Exit $nRet ; ====================================================================================================== ; Embedded IE Browser-Emulation Fix + HTML5 Example ; ====================================================================================================== Func _WinMain() ConsoleWrite("@AutoItX64 = " & @AutoItX64 & ", IsAdmin() = " & IsAdmin() & @CRLF) ;; Get Current IE Embeddable Control Version (from ieframe.dll) Local $sIEVer = _IE_EmbeddedGetVersion(), $nIEVer = @extended ConsoleWrite("Embedded Version = " & $sIEVer & ", as Int: " & $nIEVer & ", @error = " & @error & @CRLF) ; Old IE version w/o HTML5 support? Exit If $nIEVer < 9 Then Return MsgBox(0, "Old IE Version", "IE version is less than 9, HTML5 example will not work") ;; Current Browser Emulation Mode for this executable (if exists) Local $nIEBEVer = _IE_EmbeddedGetBrowserEmulation() ConsoleWrite("GetEmbeddedVersion: " & $nIEBEVer & ", @error = " & @error & ", @extended = " & @extended & @CRLF) ;; Set Browser Emulation Mode for this executable (if not already set or set to a different version) ; HKCU Branch: _IE_EmbeddedSetBrowserEmulation() ; HKLM Branch: ;_IE_EmbeddedSetBrowserEmulation(-1, True, True) If @error Then ; -1 error means trying to access HKLM, so script needs elevation to access the Registry If @error = -1 Then If MsgBox(32 + 3, "Elevation Required", "Elevate script to enable setting Browser Emulation Mode?") = 6 Then Return _ReRunIfNotElevated() Return 1 EndIf Return MsgBox(0, "Error", "Couldn't set Browser Emulation mode") EndIf ;Local $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc") ;; Create Embedded Browser Control and GUI Local $oIE = _IECreateEmbedded() ; GUI (vars are Global) $hGUI = GUICreate("Embedded Web control Test", 460, 360, -1, -1, $WS_OVERLAPPEDWINDOW + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN) $GUI_IE_Obj = GUICtrlCreateObj($oIE, 10, 10, 440, 340) $ctGUI_ErrMessageLabel = GUICtrlCreateLabel("", 100, 500, 500, 30) GUICtrlSetColor(-1, 0xff0000) GUISetState(@SW_SHOW) ;Show GUI ; Doesn't work (at least for keyboard focus): ;~ ControlFocus($hGUI, '', $GUI_IE_Obj) ;; Initialize Embedded Control and write some HTML5 data to it _IENavigate($oIE, 'about:blank' ) ; Basic Near-Empty HTML (with minimal CSS styling for Canvas element) Local $sHTML = '<!DOCTYPE html>' & @CR & '<html>' & @CR & '<head>' & @CR & _ '<meta content="text/html; charset=UTF-8" http-equiv="content-type">' & @CR & _ '<title>Experiments</title>' & @CR & _ '<style>canvas { display:block; background-color:white; outline:#00FF00 dotted thin;}</style>' & @CR & _ '</head>' & @CR & '<body>' & @CR & '</body>' & @CR & '</html>' _IEDocWriteHTML($oIE, $sHTML) _IEAction($oIE, "refresh") ;; Setup Event Object Functions Local $oEventsDoc = ObjEvent($oIE.document, "Event_", "HTMLDocumentEvents2") #forceref $oEventsDoc ;~ ConsoleWrite("Obj Name = " & ObjName($oIE) & @CRLF) ;~ ConsoleWrite("Location = " & $oIE.document.location.pathname & @CRLF) ; -------------------------------------------------------------------------------------- ; Create Canvas Element through the DOM (optionally just add it in the HTML5 above) ; ------------------------------------------------- ; Note: Support in browsers, see "Can I use..." ; @ http://caniuse.com/#feat=canvas ; and @ http://caniuse.com/#search=canvas ; ------------------------------------------------- ; IE minimum is version 9+, 10+ has more features, but WebGL support requires version 11+ ; -------------------------------------------------------------------------------------- $g_oCanvas = $oIE.document.createElement("canvas") $g_oCanvas.id = "myCanvas" ;~ ConsoleWrite("Canvas ID = " & $g_oCanvas.id & @CRLF) $oIE.document.body.appendChild($g_oCanvas) ; Optionally, if added already through the HTML5 text: ;Local $g_oCanvas = _IEGetObjById($oIE, "myCanvas") If @error Then Return MsgBox(0, "Error", "Error creating/accessing Canvas") ;; Tweak Canvas Size, Move into View ;~ ConsoleWrite("window innerwidth = " & $oIE.document.parentWindow.innerWidth & @CRLF) ;$oIE.document.parentWindow.scrollTo(0, 10) $g_oCanvas.width = 420 $g_oCanvas.height = 320 ;ConsoleWrite("Canvas item offsetTop = " & $g_oCanvas.offsetTop & @CRLF) $g_oCanvas.scrollIntoView() ;; Grab the Canvas 2D Context $g_oCtx = $g_oCanvas.getContext("2d") ;; Example Drawing: Gradiant Local $oGrad = $g_oCtx.createLinearGradient(0,0,0,60) If IsObj($oGrad) Then $oGrad.addColorStop(0, "red") $oGrad.addColorStop(1, "blue") $g_oCtx.fillStyle = $oGrad EndIf $g_oCtx.fillRect(0,0,419,60) ;; Example Drawing: Text $g_oCtx.font = "30px serif" $g_oCtx.fillStyle = "white" $g_oCtx.textBaseline = "top" $g_oCtx.fillText("HTML5 Canvas Drawing!", 50, 10) ;; Example Drawing: Circle, Line $g_oCtx.beginPath() $g_oCtx.arc(200, 100, 20, 0, ACos(-1) * 2) $g_oCtx.fillStyle = "red" $g_oCtx.fill() $g_oCtx.beginPath() $g_oCtx.lineWidth = "3" $g_oCtx.strokeStyle = "green" $g_oCtx.moveTo(185, 85) $g_oCtx.lineTo(215, 115) $g_oCtx.stroke() ; Waiting for user to close the window While GUIGetMsg() <> $GUI_EVENT_CLOSE Sleep(10) WEnd GUIDelete() EndFunc ; ====================================================================================================== ; IE Event Functions - React to Mouse events with some Canvas graphics ; ====================================================================================================== #Region IE_EVENT_FUNCS ; For right-click, the context menu pops up, UNLESS we change the Event's 'returnValue' property Volatile Func Event_oncontextmenu($oEvtObj) If IsObj($oEvtObj) Then ; Convert to string so that 0 doesn't match EVERY string Local $sId = $oEvtObj.srcElement.id & "" If ($sId = "myCanvas") Then $oEvtObj.returnValue = False EndIf EndFunc Volatile Func Event_onmousedown($oEvtObj) If IsObj($oEvtObj) And IsObj($g_oCtx) Then ; Map click coordinates to Canvas coordinates $iLastX1 = $oEvtObj.x - $g_oCanvas.offsetLeft $iLastY1 = $oEvtObj.y - $g_oCanvas.offsetTop ;~ ConsoleWrite("Downclick recvd at X1: " & $iLastX1 & ", Y1: " & $iLastY1 & ", MouseButton [1 = left, 2 = right, etc] = " & $oEvtObj.button & @CRLF) ; Check if click was in fact within Canvas element If $iLastX1 >= 0 And $iLastX1 < $g_oCanvas.width And $iLastY1 >= 0 And $iLastY1 < $g_oCanvas.height Then ; Signal mouse-down occurred inside Canvas $bMouseDown = 1 ; Make a small square where initial down-click was detected $g_oCtx.fillStyle = "blue" $g_oCtx.fillRect($iLastX1 - 2, $iLastY1 - 2, 3, 3) EndIf EndIf EndFunc Volatile Func Event_onmouseup($oEvtObj) If IsObj($oEvtObj) And IsObj($g_oCtx) Then ;~ ConsoleWrite("MouseUp" & @LF) If $bMouseDown Then Local $iX = $oEvtObj.x - $g_oCanvas.offsetLeft, $iY = $oEvtObj.y - $g_oCanvas.offsetTop ; Random color in "#0f1100" (RGB) string form Local $sColor = "#" & Hex(Random(0, 255, 1), 2) & Hex(Random(0, 255, 1), 2) & Hex(Random(0, 255, 1), 2) ;; Draw either a line or circle depending on where the mouse button is released If $iX = $iLastX1 And $iY = $iLastY1 Then ; Circle if mouse start = mouse end $g_oCtx.beginPath() $g_oCtx.arc($iX, $iY, 8, 0, ACos(-1) * 2) $g_oCtx.fillStyle = $sColor $g_oCtx.fill() Else ; Line if mouse start <> mouse end $g_oCtx.beginPath() $g_oCtx.lineWidth = "3" $g_oCtx.strokeStyle = $sColor $g_oCtx.moveTo($iLastX1, $iLastY1) $g_oCtx.lineTo($iX, $iY) $g_oCtx.stroke() EndIf $bMouseDown = 0 EndIf EndIf EndFunc Volatile Func Event_onkeydown($oEvtObj) If IsObj($oEvtObj) Then ConsoleWrite("Event type: " & $oEvtObj.type & "id (0 is document) = " & $oEvtObj.srcElement.id) ConsoleWrite(", keycode = " & $oEvtObj.keyCode & ", shiftkey = " & $oEvtObj.shiftKey & @CRLF) EndIf EndFunc ; ====================================================================================================== #EndRegion IE_EVENT_FUNCS #EndRegion IE_CANVAS_EXAMPLE #Region UTIL_FUNCS ; ====================================================================================================== ; Func _ReRunIfNotElevated() ; ; Does what it says. (rumored to occasionally say what it does) ; ; Author: Ascend4nt ; ====================================================================================================== Func _ReRunIfNotElevated() If IsAdmin() Then Return 0 Else If @Compiled Then ; If compiled to A3X, we need to execute it as if not compiled. Local $sCmd = (@AutoItExe = @ScriptFullPath) ? "" : ("/AutoIt3ExecuteScript " & @ScriptFullPath) Return ShellExecute(@AutoItExe, $sCmd, @ScriptDir, "runas") Else Return ShellExecute(@AutoItExe,@ScriptFullPath,@ScriptDir,"runas") EndIf EndIf EndFunc #EndRegion UTIL_FUNCS IEEmbeddedVersioning.zip ~prev Downloads: 61 Also, HTML5+Javascript standalone Canvas demo (should run in any browser): HTML5StandaloneCanvasDemo.zip
  23. Hey, Just needed for some projects a side by side control, on the left the binary data on the rigth the string. Nothing more to say here, take a look for yourself. HexControl UDF is licensed under a Creative Commons Attribution 4.0 International License. http://creativecommons.org/licenses/by/4.0/ Greetz, Spider Hex Control.zip
  24. Hi coders, is it possible to put a control on top of an image and have the control still usable? in the help it says that you need to disable the image but i want to use a context menu and some event monitoring on the image so it must be enabled.. thanks in advance
  25. Looking to build a TreeView dynamically from an Array (Array built from excel sheet) Have not made the excel sheet yet, so I'm open to suggestions on layout so as to make it easiest as possible to get it into a treeview. Thinking each row could be a item to add with the columns defining the placement in the trees, Like: Cells(1,1) = "Level 1 Parent Name" Cells(1,2) = "Level 2 Parent Name" Cells(1,3) = "Level 3 Parent Name" Cells(1,4) = "Add this item" Cells(1,5) = "" When value = "" then Create entire branch or any part of it that doesn't already exist. advance to next row For processing speed I'd probably want to work with an array, like: $aExcelData = _ExcelReadSheetToArray($oExcel,2,1,$LastUsedRow,$LastUsedCol) Can someone help me with the loop? or maybe point to tool that may do this?
×