Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Aug 2006
    Location
    Minnesota
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Internet Explorer Using a loop to process multiple lines of input.

    I want to know if the following is possible and if someone could show me the code that is needed.

    I have HTML code to go out to a server and get PDF documents from our (work) storage area.
    I would like to be able to have an open text input where I can type in document names (one per line) and have the program run the code for each document name and open a new window to display the documents.

    The code that gets me one document from the storage area is:

    <form action="http://server_name/cgi-bin/pdm/view.cgi" method=GET enctype="application/x-www-form-urlencoded">

    <INPUT TYPE="text" SIZE="10" NAME="name">

    <INPUT TYPE="hidden" NAME="ext" VALUE="PDF">

    <INPUT TYPE="submit" ACTION="http://server_name/cgi-bin/pdm/view.cgi" VALUE=". PDF" METHOD="GET">

    </form>

    This opens the document in the current window with Acrobat.
    We are using IE6

    I don't need a lot of error testing or for the routine to be user friendly, this is for my personal use to speed up my work. (The worst programs that I have ever seen were written by engineers for themselves.)

    It is ok if a bad document name opens blank window or not at all.

    The current code doesn't choke on bad document names, the screen just doesn't change.

    My skill level - really rank beginner. I have learned enough HTML to handle minimal tasks. I have hacked out a couple of minimal web sites and gotten the code above to work.

    I am a competent programmer in the old languages (Fortran, Quick Basic compiler). I.E. I understand things like looping and looking for the end of a list.

  • #2
    Senior Coder
    Join Date
    Apr 2005
    Posts
    1,051
    Thanks
    0
    Thanked 0 Times in 0 Posts
    so you want to read the two form inputs?

    or are there multiple forms structured the same way?

    ii'm sorry i'm not fully following you here.
    public string ConjunctionJunction(string words, string phrases, string clauses)
    {
    return (String)(words + phrases + clauses);
    }
    <--- Was I Helpfull? Let me know ---<

  • #3
    New to the CF scene
    Join Date
    Aug 2006
    Location
    Minnesota
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    No, just one list input (one document name per line) that will then send a series of commands as if I typed a series of single name inputs.

    I cannot open the files directly. The "view.cgi" goes to the server and gets the most recent revision of the document.

    If I want to scan through 40 items (often I can tell within a couple seconds if the document, engineering drawings, needs to be looked at farther), I need to either call them up one at a time or go through another routine where I can print them as a batch.

    One way might be to generate new windows that have the view.cgi command already filled in and launched. It would even be an improvement if they were created and I still needed to press enter on each one.

    That way I can create a stack of PDF files on my desktop and close the ones I don't need.

    Bill Fuhrmann

  • #4
    Senior Coder
    Join Date
    Apr 2005
    Posts
    1,051
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ok i think i get it now.

    Code:
    function textareaToArray(t)
    {
    	return t.value.split(/[\n\r]+/);
    }
    function runLines(ta)
    {
    	
    	for(i = 0; i < ta.length; i++)
    	{
    		var newWin=window.open('','name','height=400,width=500');
    		newWin.document.write('<html><head><title>Popup</title></head><body>');
    		newWin.document.write('<form action="http://server_name/cgi-bin/pdm/view.cgi" method=GET enctype="application/x-www-form-urlencoded">');
    		newWin.document.write('<INPUT TYPE="text" SIZE="10" NAME="name" VALUE="' + ta + '">');
    		newWin.document.write('<INPUT TYPE="hidden" NAME="ext" VALUE="PDF">');
    		newWin.document.write('</form>');
    		newWin.document.write('</body></html>');
    		newWin.document.close();
    		newWin.document.forms[0].submit();
    	}
    }
    ok, you'll need a textarea, and a button.

    onClick get the array of lines from the textarea and process them with runLines(ta) where ta is the textArray.

    let me know if that doesn't work for you.
    public string ConjunctionJunction(string words, string phrases, string clauses)
    {
    return (String)(words + phrases + clauses);
    }
    <--- Was I Helpfull? Let me know ---<

  • #5
    New to the CF scene
    Join Date
    Aug 2006
    Location
    Minnesota
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile

    THANKS!

    Haven't tried it yet but the logic looks to be what I was looking for.

    It may be a little bit before I get time to try it out.

    It looks like I need to run
    textareaToArray(t) (to convert the text area into Array TA
    then run
    runLines(ta) (to create the display windows for each item).

    Can they be combined into one routine?

    Bill Fuhrmann

  • #6
    Senior Coder
    Join Date
    Apr 2005
    Posts
    1,051
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by fuhrmann View Post
    THANKS!

    Haven't tried it yet but the logic looks to be what I was looking for.

    It may be a little bit before I get time to try it out.

    It looks like I need to run
    textareaToArray(t) (to convert the text area into Array TA
    then run
    runLines(ta) (to create the display windows for each item).

    Can they be combined into one routine?

    Bill Fuhrmann
    try...
    Code:
    function runLines(t)
    {
    	var ta = t.value.split(/[\n\r]+/)
    	for(i = 0; i < ta.length; i++)
    	{
    		var newWin=window.open('','name','height=400,width=500');
    		newWin.document.write('<html><head><title>Popup</title></head><body>');
    		newWin.document.write('<form action="http://server_name/cgi-bin/pdm/view.cgi" method=GET enctype="application/x-www-form-urlencoded">');
    		newWin.document.write('<INPUT TYPE="text" SIZE="10" NAME="name" VALUE="' + ta + '">');
    		newWin.document.write('<INPUT TYPE="hidden" NAME="ext" VALUE="PDF">');
    		newWin.document.write('</form>');
    		newWin.document.write('</body></html>');
    		newWin.document.close();
    		newWin.document.forms[0].submit();
    	}
    }
    
    
    <textarea name="myTA" id="myTA"></textarea><br />
    <input type="button" value="run" onclick="runLines(document.getElementById('myTA').value)" />
    public string ConjunctionJunction(string words, string phrases, string clauses)
    {
    return (String)(words + phrases + clauses);
    }
    <--- Was I Helpfull? Let me know ---<


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •