Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Batch files and scripts  (Read 6795 times)

0 Members and 1 Guest are viewing this topic.

mrwallace49

    Topic Starter


    Starter

    • Experience: Experienced
    • OS: Windows 7
    Batch files and scripts
    « on: July 23, 2014, 08:46:00 PM »
    Need some help.  I've been put in charge of a form of Internet Café for the Army.  We have 16 gaming computers that need games updated constantly, which requires that these games be logged into.  Currently I have to manually login, individually to each computer.  I have a program called Deep Freeze that will allow me to run batch files and tasks on computers at set times, along with windows update.  The programs I'm trying to update are League of Legends, Steam and Battlenet.  I've got to run these at least every other day.  More often if I can.  I haven't been able to find any form of script or programming on line from the support teams.  Any ideas would help.  I'm not a programmer, and I'm not a gamer.  I'm a hardware and server person who got stuck with gaming computers.  Any help would be greatly appreciated.

    Mike

    Geek-9pm


      Mastermind
    • Geek After Dark
    • Thanked: 1026
      • Gekk9pm bnlog
    • Certifications: List
    • Computer: Specs
    • Experience: Expert
    • OS: Windows 10
    Re: Batch files and scripts
    « Reply #1 on: July 23, 2014, 10:38:01 PM »
    What you see here is free advice, but don't consider it as being weak and finds. Apparently, you do have some IT experience, but you're not used to the idea of automating a Windows desktop machine. Apparently these computers you have, I assume, are Windows desktop machines and not part of the server that delivers two terminals.
    If that assumption is true, then what I'm about to say will apply in the case, you have given. The type of automated script, you need is the type of script that can start the program and enter all the options needed to perform the proper update. This can be done in Windows using the script engine called VBScript. And I will also assume you are not familiar with using VBScript and you're more comfortable with using something like Perl or Python.
    VBScript has specific functions to start a Windows program and take over the keyboard and introduce keystrokes into the program. It is beyond the scope of this post to give you a complete crash course in VBScript. I only mention it as it would be the most logical solution for someone with programming experience with Windows.
    Right this minute, I have some work I have to do, so I am going to have to cut this short. There is an alternative that you may use called auto hockey or something like that.
    Sorry have to leave right now, I'll be back in about an hour.
    « Last Edit: July 23, 2014, 11:18:18 PM by Geek-9pm »

    Geek-9pm


      Mastermind
    • Geek After Dark
    • Thanked: 1026
      • Gekk9pm bnlog
    • Certifications: List
    • Computer: Specs
    • Experience: Expert
    • OS: Windows 10
    Re: Batch files and scripts
    « Reply #2 on: July 23, 2014, 11:29:19 PM »
    In my first post I metioned Auto Key. Or Auto Hot Key.
    http://www.computerhope.com/tips/tip209.htm

    Here is even more information:
    Five apps for task automation
    1. AutoIT v3
    2. AutoHotkey
    3. Action(s)
    4. FastKeys
    5. TinyTask

    But my favorite is KeyText
    KeyText 3.13 and other Keyboard Macro Review PCMag
    Quote
    By Edward Mendelson
    I like utility programs that don't get in my face when I work but are available when I need them—and KeyText ($29.95, direct) does exactly that. KeyText is a keyboard-automation utility, one that stays out of your way until you press a predefined key combination like Ctrl-Alt-W (or any other combination you choose). Then it springs into action and performs complex feats that would normally require multiple keystrokes and multiple mouse presses. You can choose to leave the program completely unseen or let it display (as it does by default) an unobtrusive icon in the taskbar tray. There are plenty of other keyboard-automation programs, but none that matches KeyText's combination of power and invisibility.
    KeyText alternatives for All Platforms

    This post is in the DOS forum. But he OP wants to automate things that are very hard to automate inside  a command prompt. Many programs only respond in tghe GUI mode. So he needs a keyboard macro program.
    IMHO he needs to take a look at the many keyboard macro automation programs.

    mrwallace49

      Topic Starter


      Starter

      • Experience: Experienced
      • OS: Windows 7
      Re: Batch files and scripts
      « Reply #3 on: July 24, 2014, 09:34:26 AM »
      At this time we don't have a server in the system.  We do, how ever have the program, as I previously mentioned, called Faronics Deep Freeze.  This program allows us to run scripts at set times, Freeze the current configuration, so that the end user cannot make permanent changes to the computers and push other programs to the computers.  We also use another program by Faronics called Insight.  This allows us to lock the desktops and review what each user is doing on the desktop.  All desktops are running Windows 7 Professional 64 Bit.  The gaming computers that I'm most concerned about are Alien Ware computers.  I've got to launch League of legends, Steam, and Battle Net, allow them to update during the night, probably starting around 11pm, and finish at 10am.  I can shorten the length time once they upgrade our DSL line to Fiber, but for now our pipeline is so small that when all of our computers start upgrades things tend to bog down. 

      I have almost no programming experience in anything but batch file and limited basic.  I have never programmed in VB or any of the other languages for scripting, except to copy scripts that someone else wrote to accomplish what small things I've needed to do.  I eventually want to learn some VB, but haven't had the opportunity.

      Geek-9pm


        Mastermind
      • Geek After Dark
      • Thanked: 1026
        • Gekk9pm bnlog
      • Certifications: List
      • Computer: Specs
      • Experience: Expert
      • OS: Windows 10
      Re: Batch files and scripts
      « Reply #4 on: July 24, 2014, 10:44:19 AM »
      Understood. You have limited programming experience.
      In Windows the console keyboard has a priority level such that p[programs do not ignore it. But a command window t does not have a way to take control of another windows. Programs like Auto Text and Ky Test do not run in a Window. They are  vectorized into the low-level keyboard function and work in the background.

      This means that fun automation  can be done with such programs. Here is an hypothetical example. At a certain time the administrator (you) go to the keyboard and do a few keystrokes. One of these is a "Hot Key" that has been mapped to the automation program. Said program starts a countdown to start another program at t specific time.  The it gives the program the user name and password, waits a bit, then gives the command to start an update. The sechdules another program to start and a later time and then gives the username and password for that program.
      This does not require and programming ability. Just a very simple script. Like this:
      Code: [Select]
      Flintstone[tab]Wilma[enter] The above script fragment will insert the user name 'Flintstone' into the input then hit the tab key and insert the password 'Wilma' and hit the enter key.

      This is NOT the same as macros in Word or Excel. Rather it is at the system level and can do  anything a user  can do , except drink coffee and f---.   ;D
      The documentation explains that these kinds of scripts are for people that don't program.
      Quote
      KeyText  can also be set up to - click
      buttons, select menu items, run programs,
      display messages, simulate mouse clicks, etc. -
      even go to an Internet URL.

      Add to these features the Scheduler, and you
      can schedule reminders or run programs at
      specified times or intervals.

      Add to THIS the ability to look out for
      specified windows, and you have Windows
      automation! Let KeyText  fill in your
      password logins, or click buttons you click
      every time a certain dialog appears, completely
      automatically. Don't forget the "right-click
      anywhere" feature which makes form-filling
      easier than ever.

      This evaluation version has 10 text items
      available; we hope you enjoy trying them out!
      If you purchase online, the code to unlock the
      full version will be e-mailed to you instantly.
      Please look over some documentation fro KeyText or other programs of that type.
      KeyText User Manual
      Above is a PDF.

      Lemonilla



        Apprentice

      • "Too sweet"
      • Thanked: 70
      • Computer: Specs
      • Experience: Experienced
      • OS: Windows 7
      Re: Batch files and scripts
      « Reply #5 on: July 24, 2014, 12:30:16 PM »
      I don't use Steam or Battlenet, but I update League of Legends this way with Cmd:
      Code: [Select]
      start "C:\Riot Games\League of Legends\lol.launcher.exe"
      I have yet to find a way to "sense" when it finishes, so you will have to manually exit the updater.  Just a warning though, it will take priority of the screen over whatever game/program is running, so you will have to be careful when you run it that no one is on.

      You can also integrate what Geek-9pm is talking about through the 'cscript //nologo [file.vbs]' command.  This will allow you to run VB scripts as if they are external commands (which they are) withing your batch script. An example of this would look something like:
      Code: [Select]
      start "C:\Riot Games\League of Legends\lol.launcher.exe"
      cscript //nologo update_steam.vbs
      cscript //nologo update_Battlenet.vbs

      REM if you are running XP on these computers, the timeout command will error.
      REM wait 2000 sec for the updates to finish
      timeout /t 2000

      REM kill the tasks
      taskkill /im "lol.launcher.exe"
      ...
      Quote from: patio
      God Bless the DOS Helpers...
      Quote
      If it compiles, send the files.

      mrwallace49

        Topic Starter


        Starter

        • Experience: Experienced
        • OS: Windows 7
        Re: Batch files and scripts
        « Reply #6 on: July 25, 2014, 09:20:52 AM »
        I'm not worried about sensing when it ends.  Deep Freeze will reboot the machine at the specified time, 10am, to freeze the computer, anyway.  What I'm worried about is Steam and Battle Net.  Both require user name and login to update.  If I could get an answer from Steam, about the price of a Café account I might be able to do this without this problem, but so far, they will not reply to any requests for information.  If the cost is to much, we cannot do this since we don't make money from this facility.  This is a program to support the soldiers when they are off duty.

        foxidrive



          Specialist
        • Thanked: 268
        • Experience: Experienced
        • OS: Windows 8
        Re: Batch files and scripts
        « Reply #7 on: July 25, 2014, 09:46:41 AM »
        You can create a VBS script (in a batch file) that uses SENDKEYS to press the keys that perform the update function on a computer. 

        AutoIt is another tool that can press keys and click spots on the screen.
        Autohotkey is a tool that can do the same, from a hotkey on a machine.

        VBS is native to modern Windows, the other two are free.