Jump to content

Recommended Posts

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.4.1.2.0   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 (3.3.14.5)  from:C:\Program Files (x86)\AutoIt3  input:E:\AutoIt Projects\test.au3
+>16:03:41 AU3Check ended.rc:0
>Running:(3.3.14.5):C:\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.

Link to post
Share on other sites
Just now, Earthshine said:

Notepad on windows 10 isn’t easy to automate as it once was. What operating system are you using

Windows 10. But notepad is not really the problem, I just used it as test. any program any window the keys are not being send. it gets stuck at 

+>Setting Hotkeys...--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
Link to post
Share on other sites
2 minutes ago, Earthshine said:

I don’t see anywhere in the code where you’re setting hotkeys.

Exactly, I'm not setting hotkeys, should I? last time I wrote a script that involved sending keys I didn't have to set any hotkey. I even opened one of my old scripts ran it and same thing happened. 

Link to post
Share on other sites

Use [CLASS] instead of title.  With different languages and OS versions, it is more of a robust approach.  And get handle at the first call to Win* () so you can use it afterward.  Also, can you give us the REAL application you are trying to interact to ?

Edited by Nine
Link to post
Share on other sites
6 minutes ago, Nine said:

Use [CLASS] instead of title.  With different languages and OS versions, it is more of a robust approach.  And get handle at the first call to Win* () so you can use it afterward.  Also, can you give us the REAL application you are trying to interact to ?

The application is called FlirCloud and it is a CCTV application. I just tried using the class but didn't work either.

Link to post
Share on other sites
8 minutes ago, Nine said:

Show us the code you have so far, along with the control info you want to interact to...

Run("flircloud.exe")
Local $flir = WinWait("[CLASS:Qwidget]", "",0)
WinActivate($flir, "",0)
WinWaitActive($flir, "", 0)
sleep(5000)
Send("{TAB 4}")
Send("{ENTER}")

Title: Flir Cloud Client

Class: QWidget

Instance: 287

ClassnameNN: QWidget287

Name, ID and Text are empty.

 

But again I don't think the applications are the problem, I even ran one that I used to use before and it is not happening.

If ProcessExists("POS22.exe") Then
    ProcessClose("POS22.exe")
EndIf
ProcessWaitClose("POS22.exe")
Run("C:\POS\POS22.exe")
ProcessWait("POS22.exe")
WinWait("","0.00")
WinActivate("","0.00")
WinWaitActive("","0.00")
Send("{ALT}")
Send("{RIGHT 2}")
Send("{DOWN}")
Send("{ENTER}")
WinWait("","Customer info")
WinActivate("","Customer info")
WinWaitActive("","Customer info")
Sleep(2)
Send("{TAB 2}")
Send("+{END}")
Send("{DEL}")
Send("P:\\PM229.mdb")
#cs
Send("C:\Program Files\DiGital WorkShop\POS Panic\PM229.mdb")
#CE
MouseMove(1162,742)
MouseClick("right")
Send("{ENTER}")

I know that one worked when I used it about 3 years ago. Not working today.

Link to post
Share on other sites
13 hours ago, Nine said:

WinActivate doesn't have a 3rd parameter. So it is impossible that you could run that script. What are you up to ?

oh yeah you're right I didn't see that. but believe me it worked at that time lol.

Maybe the older version of Autoit was more permissible of mistakes like this? I don't know.

Anyway I removed the 3rd parameter and that was it, it is sending the keys now. thanks.

 

Link to post
Share on other sites
13 hours ago, Werty said:

Qwidgets are a pain to automate, read this thread about qwidgets, not a solution as the zip in the example is missing, but will give you an idea of what you are up against...

 

Thanks I'll read it, Hopefully since the automation I want to do is quite simple it doesn't give me such hard time.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By WhaleJesus
      #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
    • By DannyJ
      $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  
    • By DannyJ
      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?
    • By Automania
      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.
    • By SEuBo
      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!
×
×
  • Create New...