Jump to content

All Activity

This stream auto-updates     

  1. Past hour
  2. Ah I see your issue you need a controlID I've altered your script to give you the controlID but this is definitely NOT the way to do this as far as speed is concerned #include <ColorConstants.au3> #include <GUIConstantsEx.au3> #include <FontConstants.au3> #include <MsgBoxConstants.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> Example() ;========================================================================================== Func Example() For $iNum = 1 To 3 CreateNewGui($iNum) Next Sleep(5000) DisplayStats(3, CalculateStats()) DisplayStats(1, CalculateStats()) DisplayStats(2, CalculateStats()) MsgBox($MB_OK, "", "CR to continue ...") EndFunc ;==>Example ;========================================================================================== Func CreateNewGui($iNum) Local $hGUI = GUICreate("Title of window " & $iNum, 200, 100, 250 * $iNum, 100) CreateNewLabels($hGUI) GUISetState(@SW_SHOW) EndFunc ;==>CreateNewGui ;========================================================================================== Func CreateNewLabels($hGUI) For $i = 0 To 3 Local $iInt = Int($i / 2) Local $iMod = Mod($i, 2) $hLbl = GUICtrlCreateLabel($i, 15 + $iInt * 90, 15 + $iMod * 30, 80, 20) GUICtrlSetFont($hLbl, 12, $FW_BOLD, $GUI_FONTNORMAL, "Arial") GUICtrlSetColor($hLbl, $COLOR_WHITE) GUICtrlSetBkColor($hLbl, 0x000000) Next EndFunc ;==>CreateNewLabels ;========================================================================================== Func CalculateStats() Local $aInfos[4] $aInfos[0] = Random(0, 1000, 1) $aInfos[1] = Random(0, 1000, 1) $aInfos[2] = Random(0, 1000, 1) $aInfos[3] = Random(0, 1000, 1) Return $aInfos EndFunc ;==>CalculateStats ;========================================================================================== Func DisplayStats($iNum, $aInfos) Local $hGUI = WinGetHandle("Title of window " & $iNum) Local $hCtrl, $idCtrl For $i = 0 To 3 $hCtrl = ControlGetHandle($hGUI, "", "[ClassNN:Static" & ($i + 1) & "]") If $hCtrl Then $idCtrl = _WinAPI_GetDlgCtrlID($hCtrl) ConsoleWrite("$hCtrl = " & $hCtrl & @CRLF) ControlSetText($hGUI, "", $idCtrl, StringFormat("%8s", $aInfos[$i])) Select Case $aInfos[$i] < 333 GUICtrlSetColor($idCtrl, $COLOR_RED) ; <=== Doesn't work ! Case $aInfos[$i] < 666 GUICtrlSetColor($idCtrl, $COLOR_MAROON) ; <=== Doesn't work ! Case Else GUICtrlSetColor($idCtrl, $COLOR_GREEN) ; <=== Doesn't work ! EndSelect Else MsgBox(0, "Error", "Error getting handle " & @error) EndIf Next EndFunc ;==>DisplayStats Instead you could record the ID as they are created to a Global Array Like This.. #include <ColorConstants.au3> #include <GUIConstantsEx.au3> #include <FontConstants.au3> #include <MsgBoxConstants.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> Global $g_Label[32] = [0]; You can have an exact number here or just a resonable amount and Record the count as you add them Example() ;========================================================================================== Func Example()     For $iNum = 1 To 3         CreateNewGui($iNum)     Next     Sleep(5000)     DisplayStats(3, CalculateStats())     DisplayStats(1, CalculateStats())     DisplayStats(2, CalculateStats())     MsgBox($MB_OK, "", "CR to continue ...") EndFunc   ;==>Example ;========================================================================================== Func CreateNewGui($iNum)     Local $hGUI = GUICreate("Title of window " & $iNum, 200, 100, 250 * $iNum, 100)     CreateNewLabels($hGUI)     GUISetState(@SW_SHOW) EndFunc   ;==>CreateNewGui ;========================================================================================== Func CreateNewLabels($hGUI)     For $i = 0 To 3         Local $iInt = Int($i / 2)         Local $iMod = Mod($i, 2)         $hLbl = GUICtrlCreateLabel($i, 15 + $iInt * 90, 15 + $iMod * 30, 80, 20)         GUICtrlSetFont($hLbl, 12, $FW_BOLD, $GUI_FONTNORMAL, "Arial")         GUICtrlSetColor($hLbl, $COLOR_WHITE)         GUICtrlSetBkColor($hLbl, 0x000000)         $g_Label[0] += 1         $g_Label[$g_Label[0]] = $hLbl     Next EndFunc   ;==>CreateNewLabels ;========================================================================================== Func CalculateStats()     Local $aInfos[4]     $aInfos[0] = Random(0, 1000, 1)     $aInfos[1] = Random(0, 1000, 1)     $aInfos[2] = Random(0, 1000, 1)     $aInfos[3] = Random(0, 1000, 1)     Return $aInfos EndFunc   ;==>CalculateStats ;========================================================================================== Func DisplayStats($iNum, $aInfos)     Local $hGUI = WinGetHandle("Title of window " & $iNum)     Local $j = ($iNum - 1) * 4 + 1, $idCtrl     ConsoleWrite("#" & $iNum & " Starting Label = " & $j & @CRLF)     For $i = 0 To 3         If $j <= $g_Label[0] Then             ConsoleWrite("#" & $iNum & " Current Label = " & $j & @CRLF)             $idCtrl = $g_Label[$j]             ControlSetText($hGUI, "", $idCtrl, StringFormat("%8s", $aInfos[$i]))             Select                 Case $aInfos[$i] < 333                     GUICtrlSetColor($idCtrl, $COLOR_RED) ; <=== Doesn't work !                 Case $aInfos[$i] < 666                     GUICtrlSetColor($idCtrl, $COLOR_MAROON) ; <=== Doesn't work !                 Case Else                     GUICtrlSetColor($idCtrl, $COLOR_GREEN) ; <=== Doesn't work !             EndSelect         Else             MsgBox(0, "Error", "Error getting handle " & @error)         EndIf         $j += 1     Next EndFunc   ;==>DisplayStats You could also hold the CtrlIds just like you did $aInfos[] or even as another dimension of $aInfos[1][$i] I just didn't because frankly I didn't feel like all that typing when some math would suffice
  3. Yesterday
  4. Good Day junkew, Thank you for your amazing work. I see that you include a "getvalue" command. However, is there a way to get a "Name" value somehow? my code #include "UIAWrappers.au3" AutoItSetOption("MustDeclareVars", 1) Local $oP4=_UIA_getObjectByFindAll($UIA_oDesktop, "Title:=GOLDCORP - Gold Ore Mining", $treescope_children) _UIA_Action($oP4,"setfocus") Local $oP3=_UIA_getObjectByFindAll($oP4, "Title:=;controltype:=Tab", $treescope_children) _UIA_Action($oP3,"setfocus") Local $oP2=_UIA_getObjectByFindAll($oP3, "Title:=;controltype:=Pane", $treescope_children) _UIA_Action($oP2,"setfocus") Local $oP2=_UIA_getObjectByFindAll($oP3, "Title:=;controltype:=Pane", $treescope_children) _UIA_Action($oP2,"setfocus") Local $oP1=_UIA_getObjectByFindAll($oP2, "Title:=;controltype:=Text;instance:= 4", $treescope_children) _UIA_Action($oP1,"setfocus") local $oUIElement=_UIA_getObjectByFindAll($oP1, "controltype:=Text", $treescope_subtree) Local $string = _UIA_action($oUIElement,"!!! GET NAME !!!") <--------------------------- Thats what i need :( MsgBox($MB_OK,"", $string)
  5. In this topic: there is link for this tool: https://support.arubanetworks.com/ToolsResources/tabid/76/EntryId/109/DMXModule/514/Default.aspx , maybe you can use it to first create wifi profile and then to connect
  6. question about variable

    You can use Assign, for example Assign("Variable" & $aArray[$i], "Variable Value")
  7. Chrome UDF

    ChromeStartUp works fine but when i try to send keys, _chromeeval or any function it doesnt work.
  8. Ok here is the fix for my problem above: Replace this in the udf: Func _XLSAddStyle($file, $name="S21", $font="Arial", $size=11, $fstyle=0, $pcolor="000000", $icolor="", $AlignHor=$XMLXLS_CENTER, $AlignVer=$XMLXLS_BOTTOM, $Border=0) Local $f, $fontfam="Swiss" FileWriteLine($file, ' <Style ss:ID="' & $name &'">') FileWriteLine($file, ' <Alignment ss:Horizontal="' & $AlignHor & '" ss:Vertical="' & $AlignVer &'"/>') With this: Func _XLSAddStyle($file, $name="S21", $font="Arial", $size=11, $fstyle=0, $pcolor="000000", $icolor="", $AlignHor=$XMLXLS_CENTER, $AlignVer=$XMLXLS_BOTTOM, $Border=0, $WrapText=1) Local $f, $fontfam="Swiss" FileWriteLine($file, ' <Style ss:ID="' & $name &'">') FileWriteLine($file, ' <Alignment ss:Horizontal="' & $AlignHor & '" ss:Vertical="' & $AlignVer &'" ss:WrapText="' & $WrapText & '"/>')
  9. #include <ColorConstants.au3> #include <GUIConstantsEx.au3> #include <FontConstants.au3> #include <MsgBoxConstants.au3> #include <WindowsConstants.au3> Example() ;========================================================================================== Func Example() For $iNum=1 To 3 CreateNewGui($iNum) Next Sleep(5000) DisplayStats(3, CalculateStats()) DisplayStats(1, CalculateStats()) DisplayStats(2, CalculateStats()) MsgBox($MB_OK,"", "CR to continue ...") EndFunc ;========================================================================================== Func CreateNewGui($iNum) Local $hGUI = GUICreate("Title of window " & $iNum, 200, 100, 250 * $iNum, 100) CreateNewLabels($hGui) GUISetState(@SW_SHOW) EndFunc ;========================================================================================== Func CreateNewLabels($hGui) For $i = 0 To 3 Local $iInt = Int($i/2) Local $iMod = Mod($i,2) $hLbl = GUICtrlCreateLabel($i, 15 + $iInt * 90, 15 + $iMod * 30, 80, 20) GUICtrlSetFont($hLbl, 12, $FW_BOLD, $GUI_FONTNORMAL, "Arial") GUICtrlSetColor($hLbl, $COLOR_WHITE) GUICtrlSetBkColor($hLbl, 0x000000) Next EndFunc ;========================================================================================== Func CalculateStats() Local $aInfos[4] $aInfos[0] = Random(0, 1000, 1) $aInfos[1] = Random(0, 1000, 1) $aInfos[2] = Random(0, 1000, 1) $aInfos[3] = Random(0, 1000, 1) Return $aInfos EndFunc ;========================================================================================== Func DisplayStats($iNum, $aInfos) Local $hGui = WinGetHandle("Title of window " & $iNum) For $i = 0 To 3 ControlSetText($hGui, "", "Static" & ($i+1), StringFormat("%8s",$aInfos[$i])) Select Case $aInfos[$i] < 333 GUICtrlSetColor("Static" & ($i+1), $COLOR_RED) ; <=== Doesn't work ! Case $aInfos[$i] < 666 GUICtrlSetColor("Static" & ($i+1), $COLOR_MAROON) ; <=== Doesn't work ! Case Else GUICtrlSetColor("Static" & ($i+1), $COLOR_GREEN) ; <=== Doesn't work ! EndSelect Next EndFunc Here is an example
  10. Hi everyone, i am writing to you after a very long struggle i had while trying to figure out how to send a simple click inside a virtual machine running in vmware workstation 14. i have an autoit script running on my host machine watching for the UAC prompt to be displayed in a running vm. Both the host and the guest OS are Windows 10. This script worked perfectly with virtual box. It recognized the UAC prompt and clicked inside and the UAC was accepted. Since i switched to VMware Workstation 14, the script no longer clicks inside the VM successfully. It acts as if it clicks, but it doesn't. I tried sending key combinations instead of a click, so that the VM can grab the input, but it also did not work. Every attempt that i made to send clicks or keys from the host inside the VM did not work. I tried using: MouseClick ControlClick MouseMove _WinAPI_Mouse_Event _WinAPI_Keybd_Event I also noticed that while the cursor moves to the target which has to be cilcked when my vmware worstation window is not focused, it even doesn't do that when i WinActivate the vmware workstation window first. Did anyone experience such an issue, or maybe could give me a hint, what else i could use to send a key combination or a mouse click in a vmware workstation 14 pro guest window? here is my code, which works with virtualbox: #AutoIt3Wrapper_Icon=".\uac.ico" #include <ImageSearchSubrogated.au3> FileInstall(".\ImageSearchDLL.dll", ".\ImageSearchDLL.dll", 0) FileInstall(".\UAC_ginloSetup.bmp", ".\UAC_ginloSetup.bmp", 0) FileInstall(".\UAC_Yes.bmp", ".\UAC_Yes.bmp", 0) ; set global variables for the coordinates, which should be delivered global $x1 = 0, $y1 = 0 global $x2 = 0, $y2 = 0 global $counter1 = 0 global $counter2 = 0 global $sleep = 10000 global $smallSleep = 5000 ; execute the script in a loop, so that it will hopefully recover from some unexpected errors While $counter1 < 1 checkForImage() WEnd #cs ------------ Functions #ce ------------ Func checkForImage() While $counter2 < 1 ; search for the UAC in the entire screen - 2 screens supported local $searchUac = _ImageSearchArea('UAC_ginloSetup.bmp', 1, -2568, -8, 5136, 1440, $x1, $y1, 0) If $searchUac = 1 Then ; if the UAC was found search for the Yes button in a an area 200 x 200 from the middle of the found UAC image local $searchYes = _ImageSearchArea('UAC_Yes.bmp', 1, $x1, $y1, $x1 + 200, $y1 + 200, $x2, $y2, 0) If $searchYes = 1 Then ; if the Yes button was found click it and pause the script for $sleep seconds MouseClick("left", $x2, $y2, 1,0) Sleep($sleep) Else ; if the Yes button was not found retry from the beginning in $smallSleep seconds MsgBox(0, "UAC found error", "UAC was found but the 'Yes' button was not found. Script will retry in " & $smallSleep & " seconds.", $smallSleep) EndIf ; another way to accept the UAC - via shortcut ;Send("{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}") ;Send("!y") Else ; if UAC was not found try again in $sleep seconds Sleep($sleep) EndIf WEnd ; if some error occured which expired the loop, pause the script for $sleep seconds MsgBox(0, "Error", "Some Error expired the timer and the script could not recover. The script will restart in " & $sleep & " seconds.", $sleep) EndFunc
  11. Sorry for my ignorance because I thought it would suffice to send the network name and password to connect and I did not know that I would need an .xml file just to send this data, I will search on how I would create this file since it will not work without this ! I have been researching this about yesterday and I could not make it work but I do not want anyone to do it for me, just tell me what steps I need to take to send the network name and password to connect?
  12. hi guy i want create a variable like this $variable1 , and also $varible2 the number at end of variable is given by content of array , how is possible to do if is possible of course thankz at all
  13. Give that a try first
  14. cmd Unicode text maker

    Hi dear With this script you can print Unicode text in the CMD screen the script is easy to use just you write the text that contains Unicode in the first input and the script automatically reflect the code in the second input you can copy the text to the clipboard or you can try printing the text in the CMD window I apologize to everyone for colors and shape if not appropriate I'm a blind man and I do not see Thank you for your understanding Greetings to all of youCmdUtM.au3
  15. Chrome UDF

    With the examples* provided in the first post.
  16. Chrome UDF

    So... if i dont research before post its a problem, if i research is a problem also... Well, i used this udf in windows server 2012, windows 7, with the same script, also with your examples... But when i try in windows 10 doesnt work... maybe because autoit_chrome_native_messaging_host_install.exe... i dont know why but i tried in two different Windows 10 and doesnt work.
  17. Chrome UDF or IUIAutomation, FAQ 31 also Webdriver stuff posted on this forum
  18. @mikes99, Moved to the appropriate forum, as the DEV forum very clearly states: Jos
  19. I need to know how I can click on a button/link that is embedded into a webpage which opens up a link for a downloaded app on my PC. Below is the code from the webpage for the button I need to click on. <a id="navLink" class="link" data-href-alt="./dist/portal/composerlaunchpad.exe" href="clp://launchurl=https://acmhsraiisa1mpls.noblehosted.com/NobleWebAgent11.1.3.4/Default.aspx" style="margin: 0 auto;">Click Here To Begin</a> When you click on the link this box will appear, then i can script something to click on that. This is the code from AutoIt for the area where that button "click here to begin" is. >>>> Window <<<< Title: Noble Composer (Portal Install) - Google Chrome Class: Chrome_WidgetWin_1 Position: 10, 10 Size: 1339, 937 Style: 0x16CF0000 ExStyle: 0x00000100 Handle: 0x001503A6 >>>> Control <<<< Class: Chrome_RenderWidgetHostHWND Instance: 2 ClassnameNN: Chrome_RenderWidgetHostHWND2 Name: Advanced (Class): [CLASS:Chrome_RenderWidgetHostHWND; INSTANCE:2] ID: 260414112 Text: Chrome Legacy Window Position: 5, 81 Size: 1329, 851 ControlClick Coords: 381, 501 Style: 0x56300000 ExStyle: 0x00000020 Handle: 0x00140022 >>>> Mouse <<<< Position: 396, 592 Cursor ID: 0 Color: 0x84CFEF >>>> StatusBar <<<< >>>> ToolsBar <<<< >>>> Visible Text <<<< Chrome Legacy Window Chrome Legacy Window >>>> Hidden Text <<<< Any suggestions? Thanks!
  20. Again - why are you unwilling to read that second link, wanting someone to spoon feed it all back to you??? You have to use netsh wlan add --- In order to add a new profile, you need an XML file - which the link spells out for you in the comments section. The only additional help anyone can give you is to write the whole thing for you.
  21. What application, exactly, are you trying to automate this tree control? If you were trying to automate windows explorer been good luck. It is extremely unwieldy
  22. Or just create it where you want it. Be it desktop or in a directory or on the Start Menu
  23. OK, you put me in the right direction. Thank you! So for now my best solution is to create the shortcut and then copy the shortcut itself to clipboard, so on the next manual Explorer's "Paste" command the trick is done. #include <Misc.au3> $FileCreateShortcut = FileCreateShortcut("path\to\file", @TempDir & "\shortcut.lnk", @ScriptDir, "", "", "", "") _ClipPutFile(@TempDir & "\shortcut.lnk")
  24. I can connect only on wifi networks that already have the saved password and I want to connect in other networks I want to choose the network and enter the password of it, do I have to create some profile for new network? I guess I'm not sure how to use the _Wlan_Connect () function to send network name and password!
  25. Hi, I am new to AutoIt and am trying my best to improve my skills and also one day hope to return some support to others here. I am currently struggling with an external application that I need to control. So far, I have been able to do some very basic stuff, e.g. launch it, wait for its main window to show up, select a menu item and click it, wait for another window to show up. This second window contains a large treeview control. It has many collapsed items with many sub-items, also collapsed, and then many entries. I was able to identify the control to get its window handle, class name, ID and I was also able to get the correct amount of items and sub-items. The point where I am stuck now is to search for a particular item, click on that item to both select it and return from the treeview window to the main window. Unfortunately, I cannot post an image of the treeview here because I use it at work and atm I am using my private Linux computer on which i cannot use autoit anyway. I am stuck because I do not get any string results, either I get 0 or no entry at all. As I am really quite new I might already be stuck deciding what function I should use to get the text items. Am I right to say that there are _GUI functions that are supposed to work only with autoit-built GUIs, or would all functions provided by autoit work both for internal and external GUIs? How about the admin-issue - would this cure my issue, if I ran autoit as admin (not sure why I get correct results for the number of items though)? Perhaps you can point me to a neat and fool-proof tutorial on how to setup autoit to properly find text in a treeview. Thanks a lot for your help in advance! It is highly appreciated. Marty.
  26. Oh, I thought you meant pasting as shortcut from the clipboard. I don't think copying the file to clipboard what you want to do as it only yields the one result. You can create lnk shortcut files in AutoIt for sure. And since you know the file exists and where it lives, this should not be a lot of problems. Explorer is just creating the .lnk file for you with paste as shortcut. Again, I am sure you can do this programatically with AutoIt. update, found it! FileCreateShortcut here is the sample from that page. #include <MsgBoxConstants.au3> Example() Func Example() ; Create a constant variable in Local scope of the shortcut filepath. Local Const $sFilePath = @DesktopDir & "\FileCreateShortcutExample.lnk" ; Create a shortcut on the desktop to explorer.exe and set the hotkey combination Ctrl+Alt+T or in AutoIt ^!t to the shortcut. FileCreateShortcut(@WindowsDir & "\explorer.exe", $sFilePath, @WindowsDir, "/e,c:\", _ "Tooltip description of the shortcut.", @SystemDir & "\shell32.dll", "^!t", "15", @SW_SHOWMAXIMIZED) ; Retrieve details about the shortcut. Local $aDetails = FileGetShortcut($sFilePath) If Not @error Then MsgBox($MB_SYSTEMMODAL, "", "Path: " & $aDetails[0] & @CRLF & _ "Working directory: " & $aDetails[1] & @CRLF & _ "Arguments: " & $aDetails[2] & @CRLF & _ "Description: " & $aDetails[3] & @CRLF & _ "Icon filename: " & $aDetails[4] & @CRLF & _ "Icon index: " & $aDetails[5] & @CRLF & _ "Shortcut state: " & $aDetails[6] & @CRLF) EndIf ; Delete the shortcut. FileDelete($sFilePath) EndFunc ;==>Example so, since you know where it is, and that it exists, you can just adapt that to your needs as a test mule.
  27. The file exists. I want to copy it to clipboard using AutoIt and THEN be able to MANUALLY "paste as clipboard" using Windows Explorer (or any File Manager). If you copy a file using Explorer after that you have 2 options: "Paste" and "Paste as shortcut". If you copy a file using AutoIt's _ClipPutFile after that you have only one option: "Paste". So in the end I want to simulate the Explorer's "Copy" command. @Earthshine I just want be sure I'm making it clear. So can you please confirm your previous reply?
  1. Load more activity

Important Information

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