#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Location
    San Antonio, TX
    Posts
    5
    Rep Power
    0

    Unhappy I need help with VBscripting!


    Hello,

    I am a system administrator just beginning to learn VB and ASP scripting. I'm trying to integrate the code with an HTML site I have created for installing printer packages on my network.

    Bascially, the main page contains a form with a text box where the user enters the name of the printer, and clicks the submit button. This page then calls another ASP page with the code. I have a portion of the code working - when I type in the printer name, and click submit, the querystring returns the value of PrinterName=whatever was typed in the textbox.

    In this example, say the user has typed in 45-111 as the printer name. I need to append that name with a .pwc extension, then have it search thru a single directory. If it finds 45-111.pwc, I need it to open the file. If it doesn't find 45-111.pwc, I need to issue some type of error (i.e. document.write("Printer " & strPrinterName & " is an invalid printer.")

    I know that this is pretty elementary stuff for all of you - I'm still trying to learn (but I need to get this script finished!). Any help would be GREATLY appreciated!

    Thanks!
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Posts
    11
    Rep Power
    0
    Hi!

    Try using FileSystemObject (FSO) to determine if a file exists in your system. Here's an example on that portion of the code solution:

    http://www.aspfaqs.com/aspfaqs/ShowFAQ.asp?FAQID=78

    This assumes that your file has to be on the web server, but I don't know all of your application prerequisites/requirements.

    This might also help you out:
    http://www.w3schools.com/asp/asp_ref_filesystem.asp

    In what way do you want to "open" the file. Just for display or for editing purposes?

    Regards,
  4. #3
  5. /(bb|[^b]{2})/

    Join Date
    Nov 2001
    Location
    Somewhere in the great unknown
    Posts
    5,163
    Rep Power
    793
    In the future please use a more appropriate subject title. Follow the link in the sticky at the top of this forum for more information on how to post.
    Thanks, and welcome to the community...
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Location
    San Antonio, TX
    Posts
    5
    Rep Power
    0

    Lightbulb ASP/VB scripting with FSO execution


    Jokre, thanks for the URLs - they were very helpful. I'm going to delve back into working on my ASP page today.

    To answer your question, it probably would have been better if I had said execute rather than open. The .PWC files are prism package files that launch the installation of applications (or in this case, printers) on workstations with the prism client installed.

    Thanks again for your help!
    -DesertSky


    Onslaught: my apologies on the thread subject...it was not my intention to annoy the moderator on the very first post!
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2001
    Location
    Dublin
    Posts
    413
    Rep Power
    14
    i think you can use the windows scripting host runtime method CreateObject("WScript.Shell").Run( ... )
  10. #6
  11. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Location
    San Antonio, TX
    Posts
    5
    Rep Power
    0
    Thanks for the help - the page is working now. BUT, I am having problems pointing the server.mapPath to a directory outside of the ASP page's home directory. I've detailed the problem on the ASP discussion board at:

    http://forums.devshed.com/t64840/s.html

    If anyone can offer their expertise, I'd appreciate it!

    Thanks!

IMN logo majestic logo threadwatch logo seochat tools logo