Chance1

Make MsgBox Non-Active Window

4 posts in this topic

#1 ·  Posted (edited)

Hey guys,

I was wondering if there is a way that I can make a msgbox pop up without making it the active window? I am sure it's not too difficult but I cannot find anything about it in the forum. I have tired a couple different things with waits and controlfocus but nothing seems to work. Thanks!

Edited by Chance1

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Can you show the code you have?

Edited by SkysLastChance

Life's simple. You make choices and you don't look back.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

$TNPid = Run('C:\Windows\System32\telnet.exe')
ControlSend('C:\Windows\System32\telnet.exe', "", '', 'open msn-devqa 259 {ENTER}') ;open fire wall auth
ControlSend('Telnet msn-devqa', "", '', $Username & "{ENTER}") ;enter the username
    
MsgBox(0, "FIREWALL AUTH","Hit OK when finished")
WinWaitActive("Telnet")

The executable, telnet, propmts the user for their username and password. Username is provided earlier. I wan them to type their password in the telnet window.

I know controlsend to a exe is not the best way to send commands, but there is a problem with the IO stream that I am still trying to figure out. Because of that problem, I am unable to read the errors thorwn back by the exe. So, I thought it would be best if the user went into the window to finish logging on and just wait for the window after the logon (titled 'Telnet') to be the active window before continuing along with the script. But the fall back that I have been having to do is have the user hit okay in the message box when they are done logging in and then the script will continue.

Hope this makes a little bit of sense. Thanks.

Edited by Chance1

Share this post


Link to post
Share on other sites

#4 ·  Posted

$TNPid = Run('C:\Windows\System32\telnet.exe') ;run telnet -- return the PID for later close
ControlSend('C:\Windows\System32\telnet.exe', "", '', 'open msn-devqa 259 {ENTER}') ;open fire wall auth
ControlSend('Telnet msn-devqa', "", '', $Username & "{ENTER}") ;enter the username
MsgBox(0, "FIREWALL AUTH", "Finish authentication in telnet window", 5)
    
;wait for the user to finsih
while WinExists('Telnet msn-devqa')
    sleep(200)
WEnd
WinWaitActive("Telnet") ;wait for the telnet window to become active

Wait, I just tired this and it worked a lot better than what I had originally wanted to do. So, when the user goes to the login page, the title switches and when they are finished, the title of the window changes again. So, If i just wait for the logon title window to not exist anymore (while loop, title of logon page "Telnet msn-devqa") it works! It waits for the user to finish and then continues perfectly.

Share this post


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