Jump to content

Search the Community

Showing results for tags 'solved'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office


  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



Member Title




  1. Hi, I haven't used Autoit in like 3 years so I'm not sure if something has changed and I'm doing something wrong but the Send() function is not working for me. I'm trying to send 4 Tabs then 2 Enters then some text. I thought it could be the window I'm working with so I just did a simple test and the keys are not being sent. Run("C:\WINDOWS\system32\notepad.exe") WinWait("Untitled - Notepad",0.0) WinActivate("Untitled - Notepad",0.0) WinWaitActive("Untitled - Notepad",0.0) Sleep(3) Send("{TAB}",0) Send("test",0) Send("t",0) Send("e",0) Send("s",0) Send("t",0) Notepad opens fine but then it just sits there. This is the output log: >"C:\Program Files (x86)\AutoIt3\SciTE\..\AutoIt3.exe" "C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "E:\AutoIt Projects\test.au3" /UserParams +>16:03:41 Starting AutoIt3Wrapper v.19.102.1901.0 SciTE v. Keyboard:00000409 OS:WIN_10/ CPU:X64 OS:X64 Environment(Language:0409) CodePage:0 utf8.auto.check:4 +> SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE UserDir => C:\Users\User\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper SCITE_USERHOME => C:\Users\User\AppData\Local\AutoIt v3\SciTE >Running AU3Check ( from:C:\Program Files (x86)\AutoIt3 input:E:\AutoIt Projects\test.au3 +>16:03:41 AU3Check ended.rc:0 >Running:(\Program Files (x86)\AutoIt3\autoit3.exe "E:\AutoIt Projects\test.au3" +>Setting Hotkeys...--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop >Process failed to respond; forcing abrupt termination... >Exit code: 1 Time: 11.86 I have to stop it because it doesn't do anything at all. I already tried to use sleep thinking it was sending the keys too fast but no dice. Thanks for your help.
  2. Hello. I'm trying create a RASCONNSTATUS structure So far I've got this much: Global Const $RAS_MaxDeviceType = 16 Global Const $RAS_MaxDeviceName = 128 Global Const $RAS_MaxPhoneNumber = 128 #cs typedef struct _RASCONNSTATUS { DWORD dwSize; RASCONNSTATE rasconnstate; DWORD dwError; TCHAR szDeviceType[RAS_MaxDeviceType + 1]; TCHAR szDeviceName[RAS_MaxDeviceName + 1]; TCHAR szPhoneNumber[RAS_MaxPhoneNumber + 1]; RASTUNNELENDPOINT localEndPoint; RASTUNNELENDPOINT remoteEndPoint; RASCONNSUBSTATE rasconnsubstate; } RASCONNSTATUS; #ce Global Const $tagRASCONNSTATUS = "struct;align 4;" & _ "dword dwSize;" & _ "int rasconnstate;" & _ "dword dwSize;" & _ "wchar szDeviceType[" & $RAS_MaxDeviceType + 1 & "];" & _ "wchar szDeviceName[" & $RAS_MaxDeviceName + 1 & "];" & _ "wchar szPhoneNumber[" & $RAS_MaxPhoneNumber + 1 & "];" & _ "RASTUNNELENDPOINT localEndPoint;" & _ "RASTUNNELENDPOINT remoteEndPoint;" & _ "int rasconnsubstate;" & _ "endstruct;" Specifically I'm stuck with RASTUNNELENDPOINT how do I define these? P.S. RASCONNSTATE and RASCONNSUBSTATE are int, correct?
  3. Hello. I'm trying disconnect VPN connections via RasHangUp function, but for some reason it returns error 668 (The connection dropped.) and no disconnection: #include <Array.au3> ;-------------------[ get list of connections ]------------------- Global Const $RAS_MaxDeviceType = 16 Global Const $RAS_MaxDeviceName = 128 Global Const $RAS_MaxEntryName = 256 Global Const $MAX_PATH = 260 #cs typedef struct _RASCONN { DWORD    dwSize; HRASCONN hrasconn; TCHAR    szEntryName[RAS_MaxEntryName + 1]; TCHAR    szDeviceType[RAS_MaxDeviceType + 1]; TCHAR    szDeviceName[RAS_MaxDeviceName + 1]; TCHAR    szPhonebook[MAX_PATH ]; DWORD    dwSubEntry; GUID     guidEntry; DWORD    dwFlags; LUID     luid; GUID     guidCorrelationId; } RASCONN, *PRASCONN; #ce Global Const $tagRASCONN = "struct;align 4;" & _ "dword dwSize;" & _ "handle hrasconn;" & _ "wchar szEntryName[" & $RAS_MaxEntryName + 1 & "];" & _ "wchar szDeviceType[" & $RAS_MaxDeviceType + 1 & "];" & _ "wchar szDeviceName[" & $RAS_MaxDeviceName + 1 & "];" & _ "wchar szPhonebook[" & $MAX_PATH & "];" & _ "dword dwSubEntry;" & _ tagGUID("guidEntry") & _ "dword dwFlags;" & _ tagLUID("luid") & _ tagGUID("guidCorrelationId") & _ "endstruct;" Global Const $tagBUFFER_SIZE = "dword bufferSize" Global Const $tagCONNECTIONS_COUNT = "dword connectionsCount" Global $tagRASCONNECTIONS = "" ; up-to 5 connections Local $iMaxConnections = 5 For $i = 1 To $iMaxConnections $tagRASCONNECTIONS &= StringRegExpReplace($tagRASCONN, "\s+((?!\d).*?);", " " & $i & "_$1;") Next ; get the required buffer size Local $tRASCONNECTIONS = DllStructCreate($tagRASCONNECTIONS) Local $iRASCONN_size = DllStructGetSize(DllStructCreate($tagRASCONN)) For $i = 1 To $iMaxConnections DllStructSetData($tRASCONNECTIONS, $i & "_dwSize", $iRASCONN_size) Next Local $tBufferSize = DllStructCreate($tagBUFFER_SIZE) DllStructSetData($tBufferSize, "bufferSize", DllStructGetSize($tRASCONNECTIONS)) Local $tConnectionsCount = DllStructCreate($tagCONNECTIONS_COUNT) Local $LPRASCONNA = DllStructGetPtr($tRASCONNECTIONS) Local $aResult = DllCall("Rasapi32.dll", "dword", "RasEnumConnectionsW", "ptr", $LPRASCONNA, "ptr", DllStructGetPtr($tBufferSize), "ptr", DllStructGetPtr($tConnectionsCount)) ConsoleWrite("RasEnumConnections() [" & _ArrayToString($aResult, ", ") & "]" & @CRLF) Local $iCount = DllStructGetData($tConnectionsCount, "connectionsCount") ConsoleWrite("Connections: " & $iCount & @CRLF) Local $aConnections[$iCount] For $i = 1 To $iCount Local $info[] $info.name = DllStructGetData($tRASCONNECTIONS, $i & "_szEntryName") $info.handle = DllStructGetData($tRASCONNECTIONS, $i & "_hrasconn") $aConnections[$i - 1] = $info ConsoleWrite("$aConnections[" & $i - 1 & '] {name: "' & $info.name & '", handle: ' & $info.handle & "}" & @CRLF) ;shows $aConnections[0] {name: "VPN NAME", handle: 0x1234567890123456} Next ;-------------------[ disconnect connections ]------------------- If $iCount Then ;disconnect all connections $aResult = DllCall("Rasapi32.dll", "dword", "RasHangUpW", "ptr", $LPRASCONNA) ConsoleWrite("RasHangUp() [" & _ArrayToString($aResult, ", ") & "]" & @CRLF) ;shows: ;RasHangUp() [668, 0x1234567890123456] ;where 668 is "The connection dropped." ;or disconnect single connection For $i = 0 To $iCount - 1 Step 1 Local $tRASCONN = DllStructCreate($tagRASCONN) DllStructSetData($tRASCONN, "hrasconn", $aConnections[$i].handle) DllStructSetData($tRASCONN, "dwSize", DllStructGetSize($tagRASCONN)) $aResult = DllCall("Rasapi32.dll", "dword", "RasHangUpW", "ptr", DllStructGetPtr($tRASCONN)) ConsoleWrite('RasHangUp("' & $aConnections[$i].name & '") [' & _ArrayToString($aResult, ", ") & "]" & @CRLF) ;shows: RasHangUp("VPN NAME") [668, 0x1234567890123456] Next EndIf #cs typedef struct _GUID { unsigned long Data1; unsigned short Data2; unsigned short Data3; unsigned char Data4[8]; } GUID; #ce Func tagGUID($id) Return "struct;ulong " & $id & "_Data1;ushort " & $id & "_Data2;ushort " & $id & "_Data3;byte " & $id & "_Data4[8];endstruct;" EndFunc ;==>tagGUID #cs typedef struct _LUID { DWORD LowPart; LONG HighPart; } LUID, *PLUID; #ce Func tagLUID($id) Return "struct;dword " & $id & "_LowPart;long " & $id & "_HighPart;endstruct;" EndFunc ;==>tagLUID What's strange is if I comment out these lines DllStructSetData($tRASCONN, "hrasconn", $aConnections[$i].handle) DllStructSetData($tRASCONN, "dwSize", DllStructGetSize($tagRASCONN)) It still returns same 668 error, which suggests that maybe it's not getting proper "handle"? Any suggestions what I'm doing wrong? Thank you P.S. The code to get list of active connections is based on this topic, it's working fine.
  4. If I run this code, it works perfectly $CmdPid = Run("C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noexit " & 'Get-ChildItem',@DesktopDir, @SW_SHOW) But this code $CmdPid = Run("C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noexit " & 'Get-RDUserSession',@DesktopDir, @SW_SHOW) I get this error: Get-RDUserSession : The term 'Get-RDUserSession' is not recognized as the name of a cmdlet, function, script file, or o perable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try aga in. If I try run the command Get-RDUserSession in normal PowerShell (started from windows start menu) the command works perfectly. But If I run with AutoIt I get the above mentioned error . Any ideas?
  5. Simple script latest autoit version. #include <GUIConstantsEx.au3> #include <FontConstants.au3> Example() Func Example() GUICreate("test", 800, 540) GUISetFont(12, $FW_NORMAL, $GUI_FONTNORMAL) GUICtrlCreateLabel("testing",680,310) GUISetState(@SW_SHOW) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>Example After using GUISetFont(12) or GUISetFont(12, $FW_NORMAL, $GUI_FONTNORMAL) every GUI control is changed to italic. Am i doing something wrong?
  6. Hi, I'm afraid I'm just stupid or blind or both: how can I read user input from an AutoIt console program? Just a simple String input, terminated with pressing "Return"? This can't be difficult, but I can't find a solution.
  7. #include <FileConstants.au3> #include <MsgBoxConstants.au3> #include <file.au3> ; Create Data Folder if it doesn't exist yet If FileExists(@ScriptDir & "\Data") Then Else ShellExecute(@ScriptDir) DirCreate(@ScriptDir & "\Data") EndIf ; Playlist Name & location input Global $playlistnameinput = InputBox("Playlist", "Enter The playlist name", _ "Name") Global $playlistlocationinput = InputBox("Location", "Specify where you would like the playlist folder to be stored", @ScriptDir & "\Playlists\" & $playlistnameinput) ; Create file in Data folder and other vars Global $sDataFile = @ScriptDir & "\Data\Data.txt" Global $DataHandle = FileOpen($sDataFile, 1) Global $DataFileLine = FileReadLine($sDataFile, 1) FileClose($DataFileLine) MsgBox(0, "", $DataFileLine, 10) ; Prove it exists If FileExists($sDataFile) Then _FileWriteToLine($DataHandle, $DataFileLine, $playlistnameinput, True, True) $DataFileLine += 1 _FileWriteToLine($DataHandle, 1, $DataFileLine, True) Else MsgBox($MB_SYSTEMMODAL, "Error", "File " & $sDataFile & "Does not exist") EndIf Global $sPDataFile = @ScriptDir & "\Data\" & $playlistnameinput & "_Data.txt" Global $PDataHandle = FileOpen($sPDataFile, 1) If FileExists($sPDataFile) Then _FileWriteToLine($PDataHandle, 1, $playlistnameinput, True, True) _FileWriteToLine($PDataHandle, 2, $playlistlocationinput, True, True) Else MsgBox($MB_SYSTEMMODAL, "Error", "File " & $sPDataFile & "Does not exist") EndIf _FileWriteToLine stopped working and i don't know what it is in my code that's causing this, please help
  8. $sCommands1 = 'powershell.exe Get-ChildItem' $iPid = run($sCommands1   , @WorkingDir , @SW_SHOW , 0x2) $sOutput = ""  While 1     $sOutput &= StdoutRead($iPID)         If @error Then             ExitLoop         EndIf  WEnd ;~ msgbox(0, '' , $sOutput) ConsoleWrite("$sOutput") ConsoleWrite($sOutput) ConsoleWrite(@CRLF) $aOutput = stringsplit($sOutput ,@LF , 2) For $i=0 To  UBound($aOutput) - 1 Step 1     ConsoleWrite($aOutput[$i]) Next The script above reads the whole directory into a one dimensional array, but I need to work with the array, so I need to split the array into multiple dimensions. I have already read some forum answers here, and I have already tried these commands: Are there any way to use the $aOutput variable like in PowerShell: PowerShell: $a = Get-ChildItem $a.Mode I imagine this in AutoIt $aOutput ConsoleWrite($aOutput[i].Mode) Or if I split this command into 2 dimension like: For $i To UBound($aOutput)-1 Step 1 ConsoleWrite($aOutput[$i][1]) ConsoleWrite($aOutput[$i][2]) Next
  9. Hi all, I haven't used AutoIt in more than 10 years and I am sure a lot has improved since that long time. I hope you can give me some suggestions on my approach. Task: I need to extract user data (for around 1700 users) from a website tool. That tool shows an output in a table on the website. However, no export feature is available and I need the data in an Excel file, such as: username, serial number (of a laptop), ID number (of laptop) and some more With my knowledge from 2009 I would do this: 1) use _IEextract with each username in the url to get the whole source code of the website with the user's data summary 2) Work with lots of regexpressions to extract each data piece, save them into variables/array 3) Write variable values into an Excel file 4) rinse repeat 1700 times The relevant line for step 3 looks like this: <td class="resultcell"><span class="new">2021-03-23 11:05:00</span></td><td class="resultcell">Hostname-1234</td><td class="resultcell"><a href="?&Search=Search&result=summarized%20history&field=serial%20numbers&criteria=123456">123456</a></td><td class="resultcell">0987654/td><td class="resultcell"><a href="?&Search=Search&result=summarized%20history&field=usernames&criteria=myusername">myusername</a> and so on.. so here it would be Hostname-1234, 0987654 and myusername that I would need to extract. Although this may work it does not appear very efficient and would take a while. So I am happy for an alternate approach. Preferably, without using additional exe binary files due to company policies besides AutoIt itself.
  10. Hi! I am just getting started with C and C++. I have created a pretty simple C code which is calling a dll function. When I compile and run, I get the appropriate Output. So it works fine. Now I would want to transform that to AutoIt. -> I would like to call the "RfcOpenConnection" function from AutoIt - but whatever I try with DLLCall, I can not get it to work. Can someone point me in the right direction? DLL, C Sourcecode and compiled exe are attached too large to be attached, so they're uploaded here: https://drive.google.com/file/d/12CUSsISl0mojiMCNxKjps1Sdoox3JlCX/view?usp=sharing Thanks a bunch!
  11. I am looking for a way to pull up a Child GUI Window that users can enter information into and return that information to the main for loop which is running off an array. However, I have been unable to do so because the For loop continues even though the child window is open. If I put in another while loop inside the child window function, I am not able to poll the windows for the events looking for the close button getting clicked. I have put together a simple test application that shows this. Any help with holding the main loop while the child window is open and returning when the Close button is clicked is appreciated. In the below example, the child window contains a single text box, however, on my main application the Child GUI is much more complex with multiple pieces of information being returned. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Array.au3> AutoItSetOption("GUIOnEventMode", 1) Global $hGUI, $hChild Global $childClose = False Global $childValue OpenMainGUI() While Sleep(100) ConsoleWrite("Main Loop") WEnd Func OpenMainGUI() ; Create a GUI with various controls. Local $hGUI = GUICreate("Example", 400, 100) $btnMain = GUICtrlCreateButton("Open", 10, 10, 100, 30) ; Display the GUI. GUISetState(@SW_SHOW, $hGUI) ; Events GUISetOnEvent($GUI_EVENT_CLOSE, "_ExitMain", $hGUI) GUICtrlSetOnEvent($btnMain, "createChildren") EndFunc ;==>Example Func createChildren() For $i = 1 to 5 createChild($i) ConsoleWrite($i & " - " & $childValue & @CRLF) Next EndFunc Func createChild($valInp) $childClose = False $hChild = GUICreate("Child GUI", 210, 72, -1, -1, -1, -1, $hGUI) $txtOperation = GUICtrlCreateInput($valInp, 10, 10, 100, 20) $btnCloseChild = GUICtrlCreateButton("Close", 10, 40, 100, 30) GUICtrlSetOnEvent($btnCloseChild, "_ExitChild") ; Display Child GUISetState(@SW_SHOW) ;Wait here till Close button is clicked While $childClose = False ConsoleWrite("Stuck in this loop..." & @LF) Sleep(100) $aMsg = GUIGetMsg(1) If $aMsg[0] >0 Then _ArrayDisplay($aMsg) Wend EndFunc Func _ExitMain() Exit EndFunc Func _ExitChild() ConsoleWrite("Exit Child Called") $childValue = GUICtrlRead($txtOperation) $childClose = True GUIDelete($hChild) EndFunc Thanks in advance for any help offered. My other alternative is to create a separate EXE for the child window and use ShellExecuteWait to wait for the child window to close before the loop continues, but I am hoping to avoid doing that.
  12. I am building an application which needs a child panel in the GUI Control that needs to be scrolled as it contains controls that extend beyond the panel height. But I also need to have the users to be able to Tab through those controls. I don't seem to be able to to both working together. The Tabstops can be allowed on children by using $WS_EX_CONTROLPARENT and the Scrollbar creation using the GUIScrollBar.au3. If I set the $WS_EX_CONTROLPARENT it drags the entire child and does not allow the scroll, but if I remove it, the Scroll works but the tabstops don't. Please see the below sample application that can help reproduce this problem. #include <GUIConstants.au3> #include <GUIScrollbars.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) ; Change to OnEvent mode Global $width=500, $height=500, $titel="Tabtest in Childwindow" ; create the parentwindow $mainwindow = GUICreate($titel, $width, $height, -1, -1) GUISetBkColor(0x00ffff) ; show the parentwindow GUISetState(@SW_SHOW,$mainwindow) ; check on screen sleep(1000) ; create the childwindow with the scrollbars active ->TABSTOPS Dont work $childwindo1 = GUICreate("child", 220,$height, 10 ,0,$WS_CHILD, -1 ,$mainwindow) _GUIScrollBars_Init($childwindo1, 100, 100) GUISetBkColor(0xff0000, $childwindo1) GUISetState(@SW_SHOW, $childwindo1) $input_1 = GUICtrlCreateInput("Scroll Works",10,10) $input_2 = GUICtrlCreateInput("Tab Does Not",10,40) ; create the childwindow with the scrollbars active ->TABSTOPS Work, Scroll does not because window moves $childwindo2 = GUICreate("child", 220, $height, 240 ,0,$WS_CHILD, $WS_EX_CONTROLPARENT ,$mainwindow) _GUIScrollBars_Init($childwindo2, 100, 100) GUISetBkColor(0xff0000, $childwindo2) GUISetState(@SW_SHOW, $childwindo2) $input_3 = GUICtrlCreateInput("Tab Works",10,10) $input_4 = GUICtrlCreateInput("Scroll Does Not",10,40) GUIRegisterMsg($WM_VSCROLL, "WM_VSCROLL") ; register close GUISetOnEvent($GUI_EVENT_CLOSE, "close_it",$mainwindow) ;loop While 1 Sleep(100) ; Idle around WEnd Func close_it() ; exit application GUIDelete($mainwindow) exit EndFunc $childwindo = GUICreate("child",$width,$height,0,0,$WS_CHILD,-1,$mainwindow) GUISetBkColor(0xff0000) GUISetState(@SW_SHOW,$childwindo) Func WM_VSCROLL($hWnd, $iMsg, $wParam, $lParam) #forceref $iMsg, $wParam, $lParam Local $iScrollCode = BitAND($wParam, 0x0000FFFF) Local $iIndex = -1, $iCharY, $iPosY Local $iMin, $iMax, $iPage, $iPos, $iTrackPos For $x = 0 To UBound($__g_aSB_WindowInfo) - 1 If $__g_aSB_WindowInfo[$x][0] = $hWnd Then $iIndex = $x $iCharY = $__g_aSB_WindowInfo[$iIndex][3] ExitLoop EndIf Next If $iIndex = -1 Then Return 0 ; Get all the vertial scroll bar information Local $tSCROLLINFO = _GUIScrollBars_GetScrollInfoEx($hWnd, $SB_VERT) $iMin = DllStructGetData($tSCROLLINFO, "nMin") $iMax = DllStructGetData($tSCROLLINFO, "nMax") $iPage = DllStructGetData($tSCROLLINFO, "nPage") ; Save the position for comparison later on $iPosY = DllStructGetData($tSCROLLINFO, "nPos") $iPos = $iPosY $iTrackPos = DllStructGetData($tSCROLLINFO, "nTrackPos") Switch $iScrollCode Case $SB_TOP ; user clicked the HOME keyboard key DllStructSetData($tSCROLLINFO, "nPos", $iMin) Case $SB_BOTTOM ; user clicked the END keyboard key DllStructSetData($tSCROLLINFO, "nPos", $iMax) Case $SB_LINEUP ; user clicked the top arrow DllStructSetData($tSCROLLINFO, "nPos", $iPos - 1) Case $SB_LINEDOWN ; user clicked the bottom arrow DllStructSetData($tSCROLLINFO, "nPos", $iPos + 1) Case $SB_PAGEUP ; user clicked the scroll bar shaft above the scroll box DllStructSetData($tSCROLLINFO, "nPos", $iPos - $iPage) Case $SB_PAGEDOWN ; user clicked the scroll bar shaft below the scroll box DllStructSetData($tSCROLLINFO, "nPos", $iPos + $iPage) Case $SB_THUMBTRACK ; user dragged the scroll box DllStructSetData($tSCROLLINFO, "nPos", $iTrackPos) EndSwitch ; // Set the position and then retrieve it. Due to adjustments ; // by Windows it may not be the same as the value set. DllStructSetData($tSCROLLINFO, "fMask", $SIF_POS) _GUIScrollBars_SetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO) _GUIScrollBars_GetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO) ;// If the position has changed, scroll the window and update it $iPos = DllStructGetData($tSCROLLINFO, "nPos") If ($iPos <> $iPosY) Then _GUIScrollBars_ScrollWindow($hWnd, 0, $iCharY * ($iPosY - $iPos)) $iPosY = $iPos EndIf Return $GUI_RUNDEFMSG EndFunc ;==>WM_VSCROLL Any help to get both working together is appreciated. Thanks, Sudeep.
  13. I have a webpage that I would like to Focus the Input on a particular field, which is not automatically set as the initial input. Website: https://fiscaloffice.summitoh.net/PropertyTaxValues/PayTaxCC.htm I want to just simply use the Send(“154xxx”) into the “Parcel” field, then Send(“{ENTER}”) without cycling through tab presses each time before getting to the correct inputbox, where number of tab press numbers might change depending on a few things (using either IE, chrome, etc). On most websites I try this with, the “Login ID” field is the first one that the cursor jumps to so all I do is just start a Send command, but here I can’t do that since it’s not the initial cursor location. I’ve read a few things on the forums about “_WinAPI_SetFocus” but that appears to work on AutoIT generated form fields only (see below code), I don’t know how to translate it for website use, thanks for any help! #include <GUIConstantsEx.au3> #Include <WinAPI.au3>   $hGUI = GUICreate("Test", 500, 500) $hInput = GUICtrlCreateInput("", 10, 10, 400, 20) GUICtrlCreateButton("Test", 10, 100, 80, 30) GUICtrlSetState(-1, $GUI_FOCUS)   GUISetState() Sleep(5000) _WinAPI_SetFocus(ControlGetHandle("Test", "", $hInput)) While 1     Switch GUIGetMsg()         Case $GUI_EVENT_CLOSE             Exit     EndSwitch WEnd
  14. Hello, I'm automating part of the note taking ability of my old bad POS, I managed to do much of the heavy lifting in the past weeks, I can finally do everything i want and more. Now I have a form with two buttons that expand the form to show a note taking beast that can lets us escape the hell of the one way editing the POS actually support (no cursor just delete. want to change the time on that order better delete everything and start the note from scratch, well not anymore) Now i'm stuck, my form shows up as two buttons over the POS window, however I need it to go away when I minimized the POS or switch to a different page or application, I was able to do so by doing a while loop, it worked badly as it will repeat the show command infinitely and if i break the loop then there's no way to restart the loop if the user didn't interact with the buttons directly. I have many ways I could know when controls are visible and it worked, I just don't have a way of constantly checking for this without straining the CPU, I know if I work it somehow I could do a while loop that can work, but it'll be CPU intensive. (Bad POS entails BAD PC) Should I make another form that does the loop? can I make the loop slower ? I'm using VB.net VS 2017 with AutoitX dll. EDIT: Hello anyone who searched for this, if you're and idiot like me and forgot that Timers exist then this will jog your memory Add a timer to your form, set the timer for 1 sec intervals (dealers choice) start your timer (within form load or manually) Timer1.start() then double click the timer to create a Timer tick (for my case the control visibility test i want to make each second) it should look something like this :     Private Sub timer1_Tick(sender As Object, e As EventArgs) Handles timer1.Tick         dim visibleform = ait.ControlCommand("my app", "", "[NAME:wacontact]", "IsVisible", "")         If visibleform = 0 Then             Me.Hide() ElseIf visibleform = 1 And Me.Visible = False Then ' to prevent the timer ticks from interupting any sendkeys or something we put two conditions. Me.Show() End If     End Sub remarks: ait. is the call I set for Autoit DLL.
  15. Hello guys! I'm a rookie in AutoIt lol. I've tried to looking up in MSDN and the UDFs, but it can only get the GUID of a usual partition and with the GUID to control it. Now I have no ways😥. Thanks a lot for your help!
  16. Hi guys, i have simple report in PowerPivot that shows Orders (Values) by Regions (Row) and Weeks (Columns). In Filter field is WeekDAYS (Monday,Tuesday,Wednesday,Thursday etc ) how to filter WeekDAYS Filed on WEEKDAYYesterday with autoit ? my junky try #include <Date.au3> #include <Excel.au3> Local $sWEEKDAYYesterday = _DateDayOfWeek(@WDAY-1) Global $oExcel = _Excel_Open() Global $oWorkbook = _Excel_BookOpen($oExcel, "C:\Users\.......\Orders.xlsb") Sleep (5000) $oExcel.ActiveWorkbook.RefreshAll Sleep (5000) $oExcel.Application.Sheets("Sheet1").PivotTables("PivotTable1").PivotFields("WeekDAYS").PivotFilters($sWEEKDAYYesterday) Error result $oExcel.Application.Sheets("PivotTable1").PivotTables("PivotTable1").PivotFields("WeekDAYS").PivotFilters($sWEEKDAYYesterday) $oExcel.Application^ ERROR
  17. Probably something simple, but i'm trying to create a trigger that happens if the user is idle for too long (in this example 10 seconds). #include <Timers.au3> While 1 $CurrIdleTime = _Timer_GetIdleTime() Switch $CurrIdleTime Case $CurrIdleTime >= 10001 MsgBox(64,"Current Idle Time",$CurrIdleTime) Exit EndSwitch WEnd So if I run this and don't press anything the message box will trigger in 10 seconds, but if press anything the message box will immediately trigger. The $CurrIdleTime given to me in the message box always reads 0 in the second scenario, so I'm not understanding why the case would trigger if it's clearly not greater than or equal to 10001. Does moving the mouse/pressing a key cause _Timer_GetIdleTime() to very quickly go to another value than zero? I tried specifying Number($CurrIdleTime), but it didn't make any difference. Any insight would be appreciated, thank you.
  18. Hello, I have A simple question about http request. What would be the fastest way to send mupltiple http request at the same time with autoit? The only way i figured out was to to start multiple processes. This way works fine but its not really a good way. What user would like to see 15 processes running in the background at the same time. I know multithread is also not available in autoit.
  19. Hello, I am alwasy struggeling to do multiple things at the same time. I have a main screen with a button which calls the function ninite1. The function "ninite1" then executes and fires a new gui. The program start to run with the gui (test) in the back ground Now I would like to have a counter (_count() which shows how long this program is running within this gui (ninitegui) Somebody? #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <StaticConstants.au3> #include <ColorConstantS.au3> #include <EditConstants.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> #include <InetConstants.au3> _ninite1() Func _ninite1() GLOBAL $count = 0 Local $NINITEGUI = GUICreate("Runtimes", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP) Local $idLabel2 = GUICtrlCreateLabel("test", 600, 150, @DesktopWidth, 150) GLOBAL $lblData = GuICtrlCreateLabel("", 40, 40,50,50) _Count() Sleep(1000) GUISetState(@SW_SHOW, $NINITEGUI) Run(@ScriptDir & "\Resources" & "\Runtime\ninite.exe") ;Run(@ScriptDir & "\Resources" & "\Runtime\vlcetc.exe") While 1 If ControlCommand("Ninite", "Close", "[CLASS:Button; INSTANCE:1]", "IsEnabled", "") Then ControlClick("Ninite", "Close", 2) Sleep(15) ; Important or you eat all the CPU which will not help the defrag! ExitLoop EndIf WEnd GUIDelete($NINITEGUI) EndFunc ;==>_ninite1 Func _Count() For $i = $count To 100 GuiCtrlSetData($lblData, $i) Sleep(1000) Next EndFunc
  20. Hello, I am tasked with creating a program that will scan a window for an image, if the image is detected it will need to click it, and download it. (I can handle the download part) I have attempted searching online, with no avail. The closest thing I have found is the following: https://www.autoitscript.com/forum/topic/189338-imagesearchau3-help/ I attempted to run the sample / example provided by Danyfirex which the post owner claimed worked for him. I receive no output back from Scite, and am unable to get it working. *what shows in console after attempting to run (Yes I tried running Scite as Admin): >"C:\Users\rmatt\OneDrive\AutoIt3\SciTE\..\AutoIt3.exe" "C:\Users\rmatt\OneDrive\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "C:\Users\rmatt\OneDrive\Autoit Projects\GMR Auto Logger\GMR Auto Logger - LUA.au3" /UserParams >Exit code: 1 Time: 0.1236
  21. Hello everyone, i'm not so expert in autoit, but in these day, I spent some hours to create a script with imagesearch.. I have no syntax error and no logical error (cause the script has worked for some hours..). So i tried to upgrade it and add another function, and there, the script started to give me: if $result[0]="0" then return 0 if $result^ ERROR So i surfed in the threads and i found the fix for it. ANYWAY, the error was just for the last function, the other one was working fine.. just the last one (tested in a new file) gives that error, even if they're using the same library (ImageSearch.au3) If i try to test the last one in the main project, no error but just don't work that function.. In that moment i fixed the $result error with: If (IsArray($result) = False) Then Return 0 But now, all the functions are not working.. i tried adding a msgbox to see if the image was found or not, but it always says not found.. What could be the problem? Anyway thanks for the helping and sorry for my bad english
  22. I've been trying to find a way to make the SplashTextOn positioning be relative to the GUI placement instead of the default x,y screen coordinates. Can anyone offer some assistance?
  23. Hi, I'm writing a script that interacts with a webpage. The contents of the webpage depend on the size of the browser window. To get the (for me) correct contents from the page, the browser window must be maximized. However, I also don't need or want to see the browser window when the script creates it, so it should be invisible. At first I created the browser window with simply this: $oIE = _IECreate ($url ,0 ,0 ,1 ,0) However, from the results I can see that the invisible browser window isn't maximized. So I changed the code to maximize the window, but then it becomes visible. Now I have this: $oIE = _IECreate ($url ,0 ,0 ,1 ,0) $hIE = _IEPropertyGet($oIE, "hwnd") WinSetState($hIE, "", @SW_MAXIMIZE) WinSetState($hIE, "", @SW_HIDE) ...but then I do see the browser window shortly when it is maximized. I could live with that if it were just a single browser window. But the script is opening (and closing) quite a few browser windows, and I don't wait to see them flicker, nor do I want to (be able to accidentally) interact with these windows. Any ideas on how to create and invisible yet maximized IE windows?
  24. Hello I created a script to split a text file to multiple files based on the first two characters of each line, Example: ORIGINAL.txt: about my brother and me. About me? Naturally, you can't know. Nature must take her course! The result of this example will be two files: AB.txt about my brother and me. About me? NA.txt Naturally, you can't know. Nature must take her course! As you see the first two characters will be the file name. My script does the job. So, What's the problem? The problem is that my script is so slow with big files. I tried it with a text file with 1,000,000 lines and it took about half an hour to finish 20% only. Here is my script: #include <Array.au3> #include <AutoItConstants.au3> #include <File.au3> #include <scriptingdic.au3> ;Download from: https://www.autoitscript.com/forum/topic/182334-scripting-dictionary-modified/ Global $Lines _FileReadToArray("ORIGINAL.txt", $Lines, $FRTA_NOCOUNT) Global $initArr = ["----"] Global $dict = _InitDictionary() $Total = UBound($Lines) $LastRound = 0 For $i = 0 To UBound($Lines)-1 Step +1 ;Extract the first two characters of the current line $FirstTwoChar = StringMid($Lines[$i], 1, 2) ;Replace symbols that are not valid for file names $FirstTwoChar = StringReplace($FirstTwoChar, " ", "_") $FirstTwoChar = StringReplace($FirstTwoChar, "<", "_") $FirstTwoChar = StringReplace($FirstTwoChar, ">", "_") $FirstTwoChar = StringReplace($FirstTwoChar, "?", "_") $FirstTwoChar = StringReplace($FirstTwoChar, '"', "_") $FirstTwoChar = StringReplace($FirstTwoChar, "|", "_") $FirstTwoChar = StringReplace($FirstTwoChar, ":", "_") $FirstTwoChar = StringReplace($FirstTwoChar, "\", "_") $FirstTwoChar = StringReplace($FirstTwoChar, "/", "_") ;Add the first two characters as a key in the dictionary with an array as its value. if not _ItemExists($dict, $FirstTwoChar) then $initArr[0] = $FirstTwoChar _AddItem($dict, $FirstTwoChar, $initArr) EndIf ;Add the current line to the array. $tmpArray = _Item($dict, $FirstTwoChar) _ArrayAdd($tmpArray ,$Lines[$i]) _ChangeItem($dict, $FirstTwoChar, $tmpArray) ;Show progress on the screen $Percent = $i / $Total * 100 if round($Percent) <> $LastRound then ToolTip('...'&round($Percent)&"%",0,5) $LastRound = round($Percent) EndIf Next ;Save each array as text file DirCreate("result") For $Key In $Dict $FinalArray = _Item($dict, $Key) $FileName = $FinalArray[0] _ArrayDelete($FinalArray, 0) ;_ArrayDisplay($FinalArray) _FileWriteFromArray("result\"&$FileName&".txt", $FinalArray) Next My limitations: * Lines must stay in the same order. You can't change lines order while processing the file. Any idea to make this script fast? Thanks. Example of ORIGINAL text file.rar
  25. Hello, I am wondering how to "scroll" to left and right (till the end ) on a webpage . Sending Arrow left/right only moves a bit, I wan to move isntaly to the end Up and down is easily done sending Page Up and Page Down. Any ideas? Greetings Hendrik
  • Create New...