1. You are viewing our forum as a guest. For full access please Register. WindowsBBS.com is completely free, paid for by advertisers and donations.

Lanuch multiple Urls using Batch file

Discussion in 'Internet Explorer & Microsoft Edge' started by Shinekn, 2005/11/01.

  1. 2005/11/01
    Shinekn

    Shinekn Inactive Thread Starter

    Joined:
    2005/11/01
    Messages:
    3
    Likes Received:
    0
    Echo off
    start iexplore.exe javascript: resizeTo(1024,240);moveTo(0,0); document.location.href= "http://yahoo.com "
    start iexplore.exe javascript: resizeTo(1024,240);moveTo(0,240); document.location.href= "http://www.google.com "
    Exit


    I use a similar batch file (as above) to open multiple URLs in a fixed Size & location as I have to refer them simultaneously for my work. But after I got XP Sp2, it does not work, the Javascript does not work with SP2 when run from a Batch file. I understand XP is blocking it due to security reasons. It works perfectly when run from 'favorite' link. Is there a way to get around it?

    The only solution around this issue that I came across net is in the following link
    http://windowsxp.mvps.org/ie/resizeiehome.htm

    But how could I use this with my batchfile to open multiple URLs? Or is there another way around it?

    Thanks in advance
     
  2. 2005/11/01
    Newt

    Newt Inactive

    Joined:
    2002/01/07
    Messages:
    10,974
    Likes Received:
    2
    Create two local html documents containing the "Mark of the web" (first-line) and point to them in your batch file.

    The example from http://windowsxp.mvps.org/ie/resizeiehome.htm shows a proper first line and the sort of contents your two local pages will need. Just maek sure the url length (number in (nn) is an accurate count of the url length that follows
    Code:
    <!-- saved from url=(0025)[url]http://www.winxptutor.com[/url] -->
    <html><head>
        <title></title>
        <script language= "Javascript ">
            resizeTo(800,600);
            moveTo((window.width-800)/2,(window.height-600)/2);
            document.location.href = 'http://www.winxptutor.com';
        </script>
    </head>
    <body>
    </body></html>
     
    Newt,
    #2

  3. to hide this advert.

  4. 2005/11/04
    Shinekn

    Shinekn Inactive Thread Starter

    Joined:
    2005/11/01
    Messages:
    3
    Likes Received:
    0
    Thank you Newt

    That works. But is it possible to merge the html documents in to one single document?. I have 10 web pages in my batch file.

    Edit: Another issue is that the windows opened by above method are not resizable & does not retain their custome size after minimizing & restoring.How to work out of this. I'm sorry I'm not good at html.
     
    Last edited: 2005/11/04
  5. 2005/11/04
    Newt

    Newt Inactive

    Joined:
    2002/01/07
    Messages:
    10,974
    Likes Received:
    2
    LOL - I'm not very good at it either and in fact had never even heard of this issue until you posted and I did some searching.

    We do have some regulars on here who are pretty expert though and one of them will certainly give you specifics.
     
    Newt,
    #4
  6. 2005/11/05
    TonyT

    TonyT SuperGeek Staff

    Joined:
    2002/01/18
    Messages:
    9,072
    Likes Received:
    400
    The batch file *may* work ( I have not tested) IF you go to Internet Options > Advanced Tab > Security section > put a check next to "Allow active content to run in files on my comp ".
    When I save the above code (copy=paste into notepad > File Menu > saveas 1.html) it works as expected. I can resize the window and if I minimize it & then maximize it, it will return to the exact location it was at before it was minimized.

    As for loading multiple pages in a single html doc, this works just fine:
    Code:
    <html>
    <head>
    <title>My Quick Pages</title>
    	
    	<script language= "Javascript ">
    	resizeTo(800,600);
    	moveTo((window.width-800)/2,(window.height-600)/2);
    	</script>
    	
    </head>
    
    <body>
    
    <!--MENU OPENS PAGES IN THE INLINE FRAME -->
    <!--EDIT <a href= "http://www.xxxxxxxx.com" AND EDIT PAGE 1, Page 2, Page 3 etc. -->
    <!--ADD ADDITOIONAL MENU ITEMS BY DUPLICATING THE LAST LINE IN MENU -->
    <p>
    <a href= "http://www.google.com" target= "mypages ">PAGE 1</a>&nbsp;|&nbsp;
    <a href= "http://www.yahoo.com" target= "mypages ">PAGE 2</a>&nbsp;|&nbsp;
    <a href= "http://www.windowsbbs.com" target= "mypages ">PAGE 3</a>
    </p>
    
    <!--INLINE FRAME -->
    <iframe name= "mypages" src= "http://www.winxptutor.com" scrolling= "auto" width= "100%" height= "500" frameborder= "no "></iframe>
    
    </body>
    </html>
     
    Last edited: 2005/11/05
  7. 2005/11/07
    Shinekn

    Shinekn Inactive Thread Starter

    Joined:
    2005/11/01
    Messages:
    3
    Likes Received:
    0
    TonyT, Your Html works great. Although my requirement is to open sites in different windows as I have to compare data simultaneously.

    I tried running your code from the batch file. Still I had the same issue of custom sizes. I tried enabling 'Active content' still no go. After a lot of trial & error, quite by accident I found out what the issue is.

    If the "last opened" explorer window is a maximized one, the html to resize will no work as it is resizing the maximized window. If you custom size to your "last opened" window. Everything works fine. Resizing, restoring Works Good!!!

    Or does it ?!! NO. It does not. If your run the batch file a couple of time after closing the opened windows. The sizing of the window gets messed up.

    Here is a sample of batch file that I use.

    Echo off
    start iexplore "C:\Documents and Settings\vonage\Vonage Utilities Files\Yahoo.html "
    PING 1.1.1.1 -n 1 -w 2000>NUL
    start iexplore "C:\Documents and Settings\vonage\Vonage Utilities Files\B.html "
    PING 1.1.1.1 -n 1 -w 2000>NUL
    start iexplore "C:\Documents and Settings\vonage\Vonage Utilities Files\C.html "
    Exit


    and the html file for first one

    <!-- saved from url=(0020)http://www.yahoo.com -->
    <html><head>
    <title></title>
    <script language= "Javascript ">
    resizeTo(512,710);
    moveTo(0,0);
    document.location.href = 'http://www.yahoo.com';
    </script>
    </head>
    <body>
    </body></html>

    *What is that I'm doing wrong with the sizing? My screen res. is 1024 x 768 with "double sized" task bar (Normal task bar dragged to increase width).

    *How could I change the code to solve the maximized window issue?
     
  8. 2005/11/09
    TonyT

    TonyT SuperGeek Staff

    Joined:
    2002/01/18
    Messages:
    9,072
    Likes Received:
    400
    I've been at this for 2 days now in spare time & believe I have it solved. There's no need for separate html files to be called by the batch file. My method allows you to call only one html file in the batch file and the desired html files will open automatically. Also, there is no need to PING in the batch file, it serves no purpose that I can see.

    The problem with any method of doing what you want to do is due to the inherent security settings in IE6 SP2 along with the IE PopUp Blocker settings. PopUp Blocker is not supposed to have any effect upon Trusted Sites or Local Internet Zones, but sometimes it does, depending upon the rest of your security settings.

    I believe my method here will work well for you. Save the below code as a local html file. Instructions are contained on the page itself.

    Code:
    <html>
    <head>
    <title>My Window Opener</title>
     
    <script language= "JavaScript ">
    function popUp1(URL) {
    day = new Date();
    id = day.getTime();
    eval( "page" + id + " = window.open(URL, '" + id +  "', 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=500,height=500,left=0,top=0'); ");
    }
    
    function popUp2(URL) {
    day = new Date();
    id = day.getTime();
    eval( "page" + id + " = window.open(URL, '" + id +  "', 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=500,height=500,left=0,top=0'); ");
    }
    
    function popUp3(URL) {
    day = new Date();
    id = day.getTime();
    eval( "page" + id + " = window.open(URL, '" + id +  "', 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=500,height=500,left=0,top=0'); ");
    }
    </script>
    
    </head>
    
    <body onLoad= "javascript:popUp1('http://www.google.com'); javascript:popUp2('http://www.yahoo.com'); javascript:popUp3('http://members.cox.net/aturrisi'); window.close(); ">
    
    <p>Internet Explorer security prevents the closing of this window and enforces a user prompt.</p>
    
    <p>You can add additional opened windows by duplicating the function in the script and rename them sequentially. Example:</p>
    <p>function popUp4(URL)<br>day = new Date();<br>id = day.getTime();<br>eval( "page" + id + " = window.open(URL, '" + id +  "', 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=500,height=500,left=0,top=0'); ");</p>
    
    <p>next, add the onLoad Event handler to the <body> element and separate each event handler with a semi-colon. Example:</p>
    
    <p>javascript:popUp4('http://www.microsoft.com');</p>
    
    </body>
    </html>
     
  9. 2005/11/09
    TonyT

    TonyT SuperGeek Staff

    Joined:
    2002/01/18
    Messages:
    9,072
    Likes Received:
    400
    one more thing:
    Using my above solution, a batch file is no longer necessary at all. just make a shortcut to the loacal html file and place it on the desktop or quick launch toolbar. (prefer quick launch because can access it if other windows are overing the screen)
     
  10. 2005/11/09
    Newt

    Newt Inactive

    Joined:
    2002/01/07
    Messages:
    10,974
    Likes Received:
    2
    Elegant, TonyT.
     
    Newt,
    #9

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.