Link to home
Start Free TrialLog in
Avatar of centerv
centervFlag for United States of America

asked on

Batch file to launch IE and Login

Hello, I'm looking for a batch file that will open IE and enter all the info to log in to this site. https://www.caringbridge.org/visit/other  1) Website name  2) Website password  3) Email address 4) Profile password  Please note: I created the website "other" as a way to show the page and not the real site. The object of this is so I can setup the script for the individual person, mostly elderly, so they can click on it and have it on. It's being too difficult for them to navigate this page to gain access. Any help with this will have may sincere gratitude and hopefully help many others.  I will be glad to answer any questions you may have to help with this issue. Thanks
Avatar of giltjr
giltjr
Flag of United States of America image

Do you know how the site prompts for user-id and password?

Assuming you are running IE 7  you could setup a command file that has:

c:\windows\ie7\iexplore http://userid:password@www.website.com

But this is totaly unsecure and dependent on the method used to get the user-id and password.
Avatar of centerv

ASKER

If you open https://www.caringbridge.org/ and enter "other" and then click on Visit A Website, it will get you to the page above. As to scripting, Sorry. I have a total blank on that. Will need details. Thanks
Taking a quick look at the page, I don't think you will be able to easily create a command file that will go to the site and automatically sign on.  Now, somebody else could come along and take a look at the page and find that it is easy. So you may want to wait for other experts to come along.
Avatar of centerv

ASKER

I'm hoping to find something similar to link below but would open above site with its more complex login.
Thank you.

https://www.experts-exchange.com/questions/23287374/batch-file-to-launch-website-and-login.html?sfQueryTermInfo=1+10+login+script+websit 
WELL, i suggest you can use iMacros for IE too... It can automate anything... Just record a macro once of logging in to a website... And simply say share.. It will give u a pretty long link.. Just shorten it, by using tinyurl.com...

U're just publishing it.. So, no one would know that 447-450 character link, until u give it.. :)

iMacros for Windows IE and FireFox can be downloaded at: www.iopus.com/imacros/compare/all/

If u can switch too firefox, you can still use it more effectively.. :)

HTH
Manavsi
REM Create a batch file like this.. To run the script
 
@rundll32.exe url.dll,FileProtocolHandler http://tinyurl.com/yourID

Open in new window

Avatar of centerv

ASKER

Thanks manavsi. I'm hoping not to deal/learn another program but if push come to shove, I'll try your option.  Thanks again for the input.
its not that difficult, just record ur Macro...

Click on Record and do a login once..
Now say stop..
Click on share..
Convert ur link...
Use the batch...

Use the free addon...

As simple as that..

HTH
Manavsi
Avatar of centerv

ASKER

Ok manavsi, tried your method. Used free addon. The saved url will only work on the other end if they're using same browser and have imacro loaded.
Again, I'm looking for a file that the person can put on their desktop and click to open such as a js or bat file.
I don't see where iMacro saves as a  js file.
Thanks
well, thats true.. u need iMarcos on the other end also to play that script... and iMacros dont save any js file.. but *.iim file.. which works only on a iMacros enabled browser...
 
well installing iMacros is one time work right.. installing it.. will definitely... ease ur work if u use this type work for ur clients.. :)

HTH
Manavsi
Avatar of centerv

ASKER

I would like to emphisize that the script is to make it as easy as possible for computer challenged people
to login to the site. The object is for me to fill out the approriate info for each individual and email them the  script file to use from their desktop.  Thanks
Avatar of centerv

ASKER

>>>well installing iMacros is one time work right.. installing it.. will definitely... ease ur work if u use this type work for ur clients.. :)

Manavsi, I do not have access to the computers that will be using the file. They're all over the country. This is strictly to help the older generation that is having difficulty navigating to that site let alone try to get them to load software!  
Avatar of centerv

ASKER

Thank you all. I created the file I was looking for as a vbs using WSH SendKeys
it would be helpful, if you can publish ur solution here...

Thanks
Manavsi
Copy the code and save it to a File with the extension VBS e.g. LoadIE.vbs
You need to analyse the HTML code of the login page of the site. You need to find out the login script name and parameters. The HTML Code could look like the sample down below.
The attribute "action" of the tag "form" tells you the script that is called to process the login.
You have to generate the full URL to it. I hope that you know how to do that depending on the value in the HTML form. If not, let me know.

in my example below would the full URL to the login script be.
http://www.website.com/loginscript.aspx

Now you need the parameters. Look for all "input" tags before the form ends ("</form>" tag).
look for the attribute "name".

In my example it's "uname" and "pw", which should be self explaining. If there are any other input tags, especially of type "hidden" that have a value, then you probably need those as well.

The URL with the parameters and added values would look like this.

https://www.website.com/loginscript.aspx?uname=myname&pw=mypassword

Test the URL, if it works and logs you in. If it does work, use the VBScript below.
Enter for "sMyLoginURL" the URL that you just created and for "sMyHomeURL" the page that you want the user to redirect to after the login (and because you don't want to show the user the URL with the login credentials in it, right?)

In the SUB that is being called, I left in some options that you can set for the IE window that is being opened and might be useful to enable.

If the logging in via a URL does not work (for example, if the site requires the data to be submit via "POST" and not accepts the input via "GET", the solution would become a bit more complicated, but is still possible. I would need the HTML code of the login form though.




HTML Form Code Example
http://www.website.com/login.aspx
 
<form name=blah method=post action="loginscript.aspx">
<input type="text" name="uname" value="">
<input type="password" name="pw" value="">
<input type="submit" value="Login">
</form>
 
 
 
'IELaunch.vbs
 
sMyLoginURL = "https://www.website.com/loginscript?username=myname&password=mypassword"
sMyHomeURL = "http://www.website.com/home"
 
 
StartIE sMyLoginURL, sMyHomeURL
 
 
Private Sub StartIE(sLoginURL,sHomeURL)
    Dim objDocument
    Dim objWshShell
 
    Set objIE = CreateObject("InternetExplorer.Application")
'    objIE.height = 230
'    objIE.width = 400
'    objIE.menubar = False
'    objIE.toolbar = false
'    objIE.statusbar = false
'    objIE.addressbar = false
'    objIE.resizable = False
    objIE.navigate (sLoginURL)
 
    ' wait till ie is loaded
    While (objIE.busy)
    wend
 
    objIE.navigate (sHomeURL)
 
    ' wait till ie is loaded
    While (objIE.busy)
    wend
 
    objIE.visible = True
 
    ' set focus to ie 
    Set objWSHShell = WScript.CreateObject("WScript.Shell")
    objWshShell.AppActivate("Microsoft Internet Explorer")
End Sub

Open in new window

Oh, to execute the script IElaunch.vbs, use CSCRIPT.EXE (for the shortcut).
Example short cut (asuming that the script is located in the root of the users home directory).

%SystemRoot%\system32\cscript.exe /B /NOLOGO /T:240 "%USERPROFILE%\IELaunch.vbs"

The /T parameter is to time-out the script, if it does not finish within 240 seconds (4 minutes) for whatever reason.
Avatar of centerv

ASKER

Cumbrowski, thank for your effort, but I will not be trying your suggestion as I'm satisfied with my resluts.

Manavsi, this is my first attempt in windows scripting so my methods may be a bit unorthodox but it worked.   Using XPpro, IE7  

I started with a script provided by teedo757 at    https://www.experts-exchange.com/questions/22649533/Automate-logging-into-a-website-website-uses-ssl-for-login.html?sfQueryTermInfo=1+10+script+www.logmein.com  saved as .vbs and edited with Notepad
through trial and error. Couldn't find a way to input a left mouse click so I used the multiple TAB option.

This script does work for this website with those options and conditions.
Hope someone else using that site will find it useful.  Thanks
PS will post script after I modify the personal inputs.
Avatar of centerv

ASKER

Set wshShell = WScript.CreateObject("WScript.Shell")
wshShell.Run "iexplore https://www.caringbridge.org/visit/YOUR SITE NAME HERE", 9
WScript.Sleep 5000 ' Give ie some time to load
WshShell.SendKeys "{F6}"
WScript.Sleep 200
WshShell.SendKeys "{F6}"
WScript.Sleep 200
WshShell.SendKeys "{F6}"
WScript.Sleep 200
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "YOUR SITE PASSWORD"
WScript.Sleep 200
WshShell.SendKeys "{TAB}"
WScript.Sleep 200
WshShell.SendKeys "YOUR EMAIL"
WScript.Sleep 200
WshShell.SendKeys "{TAB}"
WScript.Sleep 200
WshShell.SendKeys "YOUR PASSWORD"
WScript.Sleep 200
WshShell.SendKeys "{TAB}"
WScript.Sleep 200
WshShell.SendKeys "{ENTER}"
ASKER CERTIFIED SOLUTION
Avatar of centerv
centerv
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial