Sign in to follow this  
Followers 0
electronixtar

Can I activate the last unfocused window?

4 posts in this topic

#1 ·  Posted (edited)

oAutoIt.WinActivate is greate method but I came across a problem when I am programming a PasteSerrialNumber.vbs. Entering Serial Numbers is pain, but sncopy.exe or sninput.exe costs memory. I tried to write a snpaste.vbs and created a snpaste.lnk in my StartMenu with the ShortcutKey Ctrl+Alt+V, so when I am reinstalling MS Office and entering the ProductKey, or while changing the IP address, I can simply copy a string and paste it into the row of textboxes with one press: Ctrl+Alt+V. The problem came when I started the program, It unfocused the last window and activated wscript.exe! Then when I use oAutoIt.send it send the key to nowhere. I tended to find out a solution with AutoIt, but faild. Can anybody give me an solution?

Edited by electronixtar

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Are you using the AutoIt3X.dll with VBScript?

Edit:

Might be a good idea to expose your script or the problem part atleast.

Edited by MHz

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Are you using the AutoIt3X.dll with VBScript?

Yes! and thanks for the quick reply. So what's your solution?

I am trying my best to explain:

PasteSerialNumber.vbs process:

1.Get the clipboard text

2.Find the last focused textbox <----I failed at this step!

3.Use oAutoIt.Send method to paste the text to the textbox

4.wscript.quit

It's just like in VB to

Shell "PasteSerailNumber", vbMinimizedNoFocus

But how can I run the script MinimizedNoFocus itself?

Edited by electronixtar

Share this post


Link to post
Share on other sites

AutoItX does have Control* functions which do not require an active window. Have a look at methods ControlSend or ControlSetText.

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
Sign in to follow this  
Followers 0