Results 1 to 5 of 5
  1. #1
    5 Star Lounger
    Join Date
    Jul 2001
    Location
    Terneuzen, Netherlands
    Posts
    895
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Batch files / scripts in Windows (Win98 and higher)

    I want to run some programs (using the normal shortcuts). Some of these programs:
    1. <LI>Require a different resolution / color depth
      <LI>Require a CD to be inserted
      <LI>...
    For (1) I have found a little program that takes arguments to configure things.

    What I'd like is to click the shortcut and then have something executed similar to our old DOS-batch files. For instance:

    QRes /x=1600 <font color=blue>'Switch to 1600x1200 resolution</font color=blue>
    Msg "Insert the XXX CD now" <font color=blue>'Prompt to insert CD</font color=blue>
    XXX <font color=blue>'Start program</font color=blue>
    QRes /R <font color=blue>'Reset to original resolution</font color=blue>

    (of course I'll have to switch-off CD Auto-Notification)

    I think this can be done using VB-Script and/or INF-type files but have no clue what would be best / easiest...

    Anybody with some tips? [is this even the correct forum???]

    Erik Jan

  2. #2
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Batch files / scripts in Windows (Win98 and higher)

    I have tried to learn vb-script for such uses and found the documentation is mostly web-based stuff (how to embed the scripts in html, asp, etc.)

    But I know vb-script is the right way to go.

    There used to be a batch file enhancer called GET that would do almost anything. If you can find the utils to make your settings changes, launching apps from batch files is easy enough.
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  3. #3
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Batch files / scripts in Windows (Win98 and higher)

    A good book for VBScript is "VBScript in a Nutshell."

    The general idea is that you use the Shell object of the Windows Script Host to behave as though it were the command interpreter. Actually, it is the command interpreter.

    The rough translation is:
    <pre><font color=blue>Dim oShell
    Set oshell = Wscript.CreateObject("Wscript.Shell")
    oShell.Run "</font color=blue>QRes /x=1600<font color=blue>", 1, True</font color=blue> 'Switch to 1600x1200 resolution
    Msg<font color=blue>Box</font color=blue> "Insert the XXX CD now" 'Prompt to insert CD
    <font color=blue>oShell.Run "</font color=blue>XXX<font color=blue>", 1, True</font color=blue> 'Start program
    <font color=blue>oShell.Run "</font color=blue>QRes /R<font color=blue>", 1, True</font color=blue> 'Reset to original resolution</pre>

    Actually, if all of those commands need to occur in one session, and it looks as though they do, a batch file still might be the best solution. You can start it from VBScript in the same manner.

  4. #4
    5 Star Lounger
    Join Date
    Jul 2001
    Location
    Terneuzen, Netherlands
    Posts
    895
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Batch files / scripts in Windows (Win98 and higher)

    All, thanks for the suggestions. I indeed think WSH is the thing to go for. As was mentions, I looked for and found documentation on the Internet but... all I could find were individual pages which one could only read&print one-by-one (I HATE that). See e.g. www.winguides.com... this is great but seems targeted for online use... also MSDN seems to work like that... Nice if you have a basis already but not so nice if you need to learn from scratch (I think).

    Does anyone have a reference to a nice tutorial (ONE document please - many pages = OK) and a reference-to-commands (ONE document please) that I could print-out and read e.g. @home...???

    Thanks,

    EJ

  5. #5
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Vienna, Wien, Austria
    Posts
    5,009
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Batch files / scripts in Windows (Win98 and hi

    Another possibility is the Help files that come with the Windows Scripting Host on the MS site (search under downloads). There is a section about VBScript. It can be a bit of a cold towel job in places, but it might be some kind of signpost. HTH
    Gre

Posting Permissions

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