MSFN Forum: How to bring an application to bring on top (focus) and active - MSFN Forum

Jump to content



Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

How to bring an application to bring on top (focus) and active Application - active and on top of other windows (Using VBS) Rate Topic: -----

#1 User is offline   mskmsiva 

  • Group: Members
  • Posts: 1
  • Joined: 17-January 12
  • OS:XP Pro x64
  • Country: Country Flag

Posted 18 January 2012 - 12:34 AM

Hi all,

All I want to do is to bring an application on top as focussed and the only active window using VBScript


#2 User is online   gunsmokingman 

  • MSFN Master
  • Group: Super Moderator
  • Posts: 2,020
  • Joined: 02-August 03
  • OS:none specified
  • Country: Country Flag

Posted 18 January 2012 - 01:13 PM

Could you provide more infomation about what you want.
Here is a Vbs Script that uses AppActivate and SendKeys Method

1:\ Open Notepad
2:\ Add Some Text
3:\ Save And Closes the new Text flle


AppActivate And Sending Keystrokes to a Program

Save As Demo_SendKey.vbs
Dim Act :Set Act = CreateObject("Wscript.Shell")
Act.Run("Notepad.exe"),1,False 
  Do Until Success = True
    Success = Act.AppActivate("Notepad")
    Wscript.Sleep 1000
   Loop
   
 Act.SendKeys "This is a test of AppActivate."
 WScript.Sleep 1000
 Act.SendKeys "{ENTER}"
 Act.SendKeys "T" :WScript.Sleep 500
 Act.SendKeys "e" :WScript.Sleep 500
 Act.SendKeys "s" :WScript.Sleep 500
 Act.SendKeys "t" :WScript.Sleep 500
 Act.SendKeys "%F" 
 Act.SendKeys "{DOWN}" :WScript.Sleep 500
 Act.SendKeys "{DOWN}" :WScript.Sleep 500
 Act.SendKeys "{DOWN}" :WScript.Sleep 500
 Act.SendKeys "{ENTER}" :WScript.Sleep 500
 Act.SendKeys "Demo_Send_Key.txt"
 Act.SendKeys "{ENTER}",500
 Act.SendKeys "%F" :WScript.Sleep 1000
 Act.SendKeys "{DOWN}" :WScript.Sleep 500
 Act.SendKeys "{DOWN}" :WScript.Sleep 500
 Act.SendKeys "{DOWN}" :WScript.Sleep 500
 Act.SendKeys "{DOWN}" :WScript.Sleep 500
 Act.SendKeys "{DOWN}" :WScript.Sleep 500
 Act.SendKeys "{DOWN}" :WScript.Sleep 500
 Act.SendKeys "{ENTER}" :WScript.Sleep 500



Rename Demo_SendKey.vbs.txt to Demo_SendKey.vbs to make active.
Attached File  Demo_SendKey.vbs.txt (1.01K)
Number of downloads: 1

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2011 msfn.org
Privacy Policy