Hi,
I have a powershell script that bring chrome browser to front (Active Window) working very well
Add-Type-AssemblyName Microsoft.VisualBasic[Microsoft.VisualBasic.Interaction]::AppActivate("chrome") |Out-Null
[System.Windows.Forms.SendKeys]::SendWait("% X{ESC}")
I'm trying do the same to iexplore but, isn't working.
Add-Type-AssemblyName Microsoft.VisualBasic
[Microsoft.VisualBasic.Interaction]::AppActivate("iexplore") |Out-Null
[System.Windows.Forms.SendKeys]::SendWait("% X"{ESC})
Exception calling "AppActivate" with "1"argument(s): "Process 'iexplore' was not found."
At line:3 char:1
+ [Microsoft.VisualBasic.Interaction]::AppActivate("iexplore") | Out-Null
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
I have read that AppActivate value to iexplore must be declared as "Tab's Name - Internet Explorer".
So... if my page opened is bing.com like tis image below:
The AppActivate on my script must be:
[Microsoft.VisualBasic.Interaction]::AppActivate("Bing
- Internet Explore") |
Out-Null
And, yes. It's works!
But... I'm trying do it in the most of time, with unknow opened pages on Internet Explorer. I need do it with any opened page on iexplorer.
I tried using asterisk like: AppActivate("*Internet Explore") or AppActivate(*"Internet Explore") and isn't working yet.
Is there some variable to do it? A variable that means "any value" to powershell. Like $null that means null value.
Something like:
AppActivate("$anything - Internet Explore")
Does somebody how can i do that? I think if it's possible with another browser, is possible do it with IE also. I need you help guys.
Thanks