I have a VBS script that works great with Internet Explorer. It opens Internet Explorer in kiosk mode on multiple monitors. I have been trying to change it to launch Edge with very little success.
Here is the basic script that doesnt work.
I changed the sub launchIE to Edge, but getting type mismatch 'Shell'
What works with IE is this code.
Sub launchIE
Set objExplorer = CreateObject("InternetExplorer.Application")
objExplorer.navigate strURL
set WshShell = CreateObject("WScript.Shell")
'wshShell.exec "c:\nomousy.exe /hide"
strRes = 0
strUrl = "http://WWW.CNN.COM"
launchIE
strRes = strRes + 1280
strUrl = "http://www.Foxnews.com"
launchIE
strRes = strRes + 1280
strUrl = "http://www.StackOverflow.com"
launchIE
WScript.quit
Sub launchIE
Set objExplorer = CreateObject("Shell.Application")
Call Shell ("msedge.exe")
objExplorer.navigate strURL
objExplorer.Left = strRes
objExplorer.Top = 0
objExplorer.Visible = True
objExplorer.FullScreen = True
objExplorer.StatusBar = 0
End Sub
Do
' Wait till the Browser is loaded
Loop Until objExplorer.readyState = 4
Powershell Script
#Community-developed module to support setting a window location with x & y coordinates
Import-Module C:\temp\Set-Window.psm1
#Get information about all locally attached monitors
Add-Type -AssemblyName System.Windows.Forms
$AllDisplays = [System.Windows.Forms.Screen]::AllScreens
#Kill all Edge processes; we need to make sure no Edge instances are running in the background before starting
Get-Process -Name msedge -ErrorAction SilentlyContinue | Stop-Process -Force
#List of urls
if ($env:computername -eq "Window8680"){
$testURLs = @(
"http://www.foxnews.com",
"http://www.cnn.com",
"http://www.stackoverflow.com",
)
#} elseif ($env:computername -eq "Windows1068"){
} else {
#Start-Process -FilePath C:\Temp\nomousy.exe -ArgumentList "/hide" -PassThru
$testURLs = @(
"http://www.foxnews.com",
"http://www.cnn.com",
"http://www.stackoverflow.com",
)
}
#Set x coordinates
$X = 0
#Null array to hold main window titles
$HandledIDs = @()
#Loop through urls
foreach($URL in $testURLs){
#Start MSEdge
Start-Process -FilePath "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" -ArgumentList "--new-window --start-fullscreen $URL"
Start-Sleep -Seconds 2
pause
#Get the PID of the relevant process.
#$EdgeID = Get-Process -Name MSEdge | Where {$_.MainWindowTitle.length -ge 1 -and $_.ID -notin $HandledIDs} | Select -ExpandProperty ID
#$HandledIDs += $EdgeID
#Set window location
#"Attempting to set PID $EdgeID to X coordinate $($AllDisplays[$X].WorkingArea.X)"
#Set-Window -ID $EdgeID -X $($AllDisplays[$X].WorkingArea.X) -Verbose
#$X = $X + 1