Bring a Process to Front for User Focus – AutoIT Script

Compile the following script using AutoIT and pass the process to be brought to front as commandline


For Example: BringToFront.exe “Caculator”



 AutoIt Version: 3.3.0.0
 Author:         myName


 Script Function:
Bring Window to front.


#ce —————————————————————————-
AutoItSetOption(“TrayIconHide”, 1)


If $CmdLine[0] > 0 Then
$WinTitle = $CmdLIne[1]
Else
Exit 1
EndIf
If $CmdLine[0] > 1 Then
$WinText = $CmdLIne[2]
Else
$WinText = “”
EndIf


WinWait($WinTitle, $WinText, 60)
If WinExists($WinTitle, $WinText) Then
WinActivate($WinTitle, $WinText)
EndIf

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: