-
Jan 12th, 2013, 03:31 PM
#1
Thread Starter
New Member
Launch Webpage, then Change URL in Browser Window
I've created a simple script that will launch IE using my default browser (which is IE8 here at work), and goes to a specific URL and uses the send keys method. I'm stuck on how to then redirect the same url (same window) to go to a new webpage.
Below is a watered down example. I'm not really trying to launch google, but another website that requires a username and password. After I login I'd like the webpage to then bounce to another webpage that can only be accessed once I've logged in and it must be the same IE window, not a new window or else it doesn't work. I'd prefer to keep the same code method that I'm using and not have to use the InternetExplorer.Application method because for some reason InternetExplorer.Application doesn't work on my work computer. Thanks!
Code:
set a = createobject("wscript.shell")
a.run "https://www.google.com"
wscript.sleep (1000)
a.sendkeys ("dogs")
wscript.sleep (1000)
a.sendkeys "{Enter}"
wscript.sleep (1000)
'Next, how to i redirect the same url to a new url?
-
Jan 12th, 2013, 04:17 PM
#2
Re: Launch Webpage, then Change URL in Browser Window
Here is one method. Internet Explorer has an option under the Advanced tab labeled "Reuse windows for launching shortcuts (when tabbed browsing is off)". Set it and then create an Internet shortcut to the other webpage and Run the shortcut after logging in to the first page. For that to work reliably, there should be only one instance of IE running and it should have tabbed browsing disabled.
On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)
-
Jan 12th, 2013, 05:41 PM
#3
Thread Starter
New Member
Re: Launch Webpage, then Change URL in Browser Window
Thanks Bonnie. I'm not familiar with the code you provided. I tried it out to some degree but it wasn't what I was looking for.
What can I add to the rest of my above mentioned code (keeping what I have)?
-
Jan 12th, 2013, 05:54 PM
#4
Re: Launch Webpage, then Change URL in Browser Window
After the part where you enter the username and password, launch the Internet shortcut file (*.url) like this:
Code:
a.Run "C:\InternetShortcut.url"
If you have modified IE's options like I suggested in post #2, then your script should be able to open that shortcut in the existing IE window.
On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)
-
Jan 12th, 2013, 08:01 PM
#5
Re: Launch Webpage, then Change URL in Browser Window
not have to use the InternetExplorer.Application method because for some reason InternetExplorer.Application doesn't work on my work computer.
Are you sure it doesn't work? what example have you tried
i would NOT use sendkeys for whatever you need to do
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|