foster74 Posted April 22, 2009 Share Posted April 22, 2009 When I use ShellExecute to run a program hidden, it always takes focus away from the current application. Is there anyway around this? Thank you very much. Link to comment Share on other sites More sharing options...
MrMitchell Posted April 22, 2009 Share Posted April 22, 2009 (edited) You could run: $windows = WinList() ;Get list of windows ShellExecute(...) WinActivate([$windows[1][0]) ;Activate the first window in the list May or may not work, but worth a shot anyway... Edited April 22, 2009 by MrMitchell Link to comment Share on other sites More sharing options...
WideBoyDixon Posted April 22, 2009 Share Posted April 22, 2009 $hActive = WinGetHandle("[ACTIVE]") ShellExecute(....) WinActivate($hActive) [center]Wide by name, Wide by nature and Wide by girth[u]Scripts[/u]{Hot Folders} {Screen Calipers} {Screen Crosshairs} {Cross-Process Subclassing} {GDI+ Clock} {ASCII Art Signatures}{Another GDI+ Clock} {Desktop Goldfish} {Game of Life} {3D Pie Chart} {Stock Tracker}[u]UDFs[/u]{_FileReplaceText} {_ArrayCompare} {_ToBase}~ My Scripts On Google Code ~[/center] Link to comment Share on other sites More sharing options...
youknowwho4eva Posted April 22, 2009 Share Posted April 22, 2009 If you ran in with the minimize flag, would that make it so it doesn't get focus? Giggity Link to comment Share on other sites More sharing options...
WideBoyDixon Posted April 22, 2009 Share Posted April 22, 2009 Actually, take a look here: http://msdn.microsoft.com/en-us/library/bb762153(VS.85).aspxI guess the AutoIt ShellExecute simply calls the underlying Windows API. In which case, you can use 7 as the last parameter for SW_SHOWMINNOACTIVE. Then I guess you'd need to find the window and hide it. Try it:ShellExecute("notepad.exe", "", "", "", 7)WBD [center]Wide by name, Wide by nature and Wide by girth[u]Scripts[/u]{Hot Folders} {Screen Calipers} {Screen Crosshairs} {Cross-Process Subclassing} {GDI+ Clock} {ASCII Art Signatures}{Another GDI+ Clock} {Desktop Goldfish} {Game of Life} {3D Pie Chart} {Stock Tracker}[u]UDFs[/u]{_FileReplaceText} {_ArrayCompare} {_ToBase}~ My Scripts On Google Code ~[/center] Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now