Aryabhatta M
asked on
In a Batch script how to refresh webpage after launching in default browser
I want to refresh the launched webpage just 3 times in an interval of 7 seconds after webpage is launched by the below script. How can I do that? ( This refresh is required for the application to load properly)
@echo Launching application in webpage
start http://localhost:%NewPort%/MyProject
@echo Launching application in webpage
start http://localhost:%NewPort%/MyProject
You would have to use tools to do that with a batch file. However, PowerShell can get control over a web pages it starts.
And you could run a VBscript from the BAT file to do the load of the web page and refreshes, but that isn't much different than the Powershell approach mentioned above...
»bp
»bp
PowerShell (pure VBS would require similar code):
$ie = New-Object -Com InternetExplorer.Application
$ie.Navigate("http://localhost:$($env:NewPort)/MyProject")
$ie.Visible = $true
foreach ($I in 1..3)
{
start-sleep 7
$ie.Refresh()
}
ASKER
Thanks Qlemo and Bill, I have some doubts and need help in executing it -
[1] (a) Can I save the above code as Launch.vbs in same folder and call it from my batch file like => call "%~dp0\Launch.vbs . Will it work ?
(b) How will I pass the variable value of %NewPort% from batch to this VBS code.
[2]I want to do it for default browser whatever is set in users PC, it may be IE or Mozilla or Chrome.
[Is there any simple way like send keys with f5 and doing some delay in between ? If that is possible how can I write it ?
[1] (a) Can I save the above code as Launch.vbs in same folder and call it from my batch file like => call "%~dp0\Launch.vbs . Will it work ?
(b) How will I pass the variable value of %NewPort% from batch to this VBS code.
[2]I want to do it for default browser whatever is set in users PC, it may be IE or Mozilla or Chrome.
[Is there any simple way like send keys with f5 and doing some delay in between ? If that is possible how can I write it ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Helpful knowledge shared. Thank you.