Jump to content

Recommended Posts

Posted

I have updated AutoIt from version 3.3.14 to 3.3.16.1, and SendKeepActive doesn't keep active the window while I use Send command. Can someone help me with this issue? Thanks in advance

  • Developers
Posted

Moved to the appropriate AutoIt General Help and Support forum, as the Developer General Discussion forum very clearly states:

Quote

General development and scripting discussions.


Do not create AutoIt-related topics here, use the AutoIt General Help and Support or AutoIt Technical Discussion forums.

Moderation Team

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted

Good morning,

The code was working properly and since I install the version 3.3.16.1, it began to fail.

WinActivate("Sin título: Bloc de notas")
SendKeepActive("Sin título: Bloc de notas")
If WinExists("Sin título: Bloc de notas")=1 Then
    Send("pepe")
EndIf
Sleep(4000)
If WinExists("*Sin título: Bloc de notas")=1 Then
    Send("pepe")
EndIf
Sleep(4000)
If WinExists("*Sin título: Bloc de notas")=1 Then
    Send("pepe")
EndIf
SendKeepActive("")

I have put sleep between send to change the window manually, and it doesn't returns focus on "Sin título: Bloc de notas".

If I generate the executable file in 3.3.14, I don't have any problem.

Thanks in advance Jos

Posted (edited)

edit: nwm totaly missclicked in brain for operator usage

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
  • 2 weeks later...
  • Developers
Posted (edited)

Think your title changed after the first send, as you have also changed in the WinExists() function:

Quote
SendKeepActive("Sin título: Bloc de notas")
If WinExists("Sin título: Bloc de notas")=1 Then
    Send("pepe")
EndIf
Sleep(4000)
If WinExists("*Sin título: Bloc de notas")=1 Then
    Send("pepe")
EndIf

So try as it is done in the example provided by the helpfile and use the class like this which works fine:

Run("notepad.exe")

; Wait max 10 seconds for the Notepad window to appear.
Local $hWnd = WinWait("[CLASS:Notepad]", "", 10)

; Keep the Notepad window active when using the Send function.
SendKeepActive("[CLASS:Notepad]")

If WinExists("[CLASS:Notepad]") Then
    Send("pepe")
EndIf
Sleep(4000)
If WinExists("[CLASS:Notepad]") Then
    Send("pepe")
EndIf
Sleep(4000)
If WinExists("[CLASS:Notepad]") Then
    Send("pepe")
EndIf
SendKeepActive("")

 

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted (edited)

I think even better could be (not tested just idea!)

Run("notepad.exe")

; Wait max 10 seconds for the Notepad window to appear.
Local $hWnd = WinWait("[CLASS:Notepad]", "", 10)

; Keep the Notepad window active when using the Send function.
SendKeepActive($hWnd)

If WinExists($hWnd) Then
    Send("pepe")
EndIf
Sleep(4000)
If WinExists($hWnd) Then
    Send("pepe")
EndIf
Sleep(4000)
If WinExists($hWnd) Then
    Send("pepe")
EndIf
SendKeepActive("")

 

Edited by Zedna
  • 2 weeks later...
Posted

Thanks, both codes works properly if you run them in debug. But they doesn't work with build file. I don't know if the problem is the configuration of compiler.

I add a screenshot of the compiler.

After you run the file, if you change the active window, it doesn't return to "Notepad"

image.png

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.
×
×
  • Create New...