Submit Your Article Forum Rules

Results 1 to 9 of 9

Thread: Simple Windows Script

  1. #1
    Senior Member
    Join Date
    Jul 2004
    Posts
    113

    Simple Windows Script

    I am very familiar with linux flavored scripting languages and need to figure out how to make/run a simple windows script.

    The script basically just needs to emulate a keystroke, wait a specified number of seconds and loop for a specified number of times.

    For example:
    hit the "F1" key, wait 3 seconds, repeat for a specific number of times.

    What scripting language should i use and what should the syntax of such a script look like?

    Thanks!

  2. #2
    Senior Member
    Join Date
    Apr 2006
    Location
    Boulder, CO USA
    Posts
    371
    Why would you want that?
    One application I can think of is for click fraud.

  3. #3
    Senior Member
    Join Date
    Jul 2004
    Posts
    113
    Quote Originally Posted by blitzen
    Why would you want that?
    One application I can think of is for click fraud.
    It's not for click fraud. I dont even see how a keystroke and a click would have the same script syntax.

    Anyway, my question actually doesnt even have anything to do with SEO or anything. I have a program that was poorly constructed that requires constant refreshing to show all of the files. Its really annoying to have to hit f5 every few seconds. The program isnt open source therefore I cant go into the code to tweak it.

    Anyway I'd like to be able to set up this script (maybe a VB script) to hit F5, then wait a few seconds and loop. I guess you would need a way to close the loop like a specified amount of time or a specified number of keystrokes, etc.

  4. #4
    WebProWorld MVP TrafficProducer's Avatar
    Join Date
    Jul 2003
    Posts
    1,958

    VBA

    VBA may be one way.

    This is used in MS Applications, e.g macros.

    Programming Applications. VBA. Visual Basic for Applications. Using Applications.
    Applications include programs which help a user archive a task and include Database, Spread Sheets, Word processing, etc...

    Some applications such as the Microsoft OfficeŽ range may be programmed to carry out routines that may not be a normal part of the application. For example to change all the names in a database to a different font, different color and UPPERCASE with a more simple press of keys. This may generally be done with the uses of Macro's, (recorded keyboard commands which may be used later). Marco's, in the case of Microsoft OfficeŽ the programming language used is a special version of Visual Basic known as VBA, (Visual Basic for Applications). Of course the use of Applications Programming is not be restricted to the Microsoft OfficeŽ range.

  5. #5

    Try AutoIt...

    AutoIt:

    http://www.autoitscript.com/autoit3/index.php

    Another option: "Push the F***** Button" (PTFB).
    http://www.brothersoft.com/utilities/automation/push_the_freakin_button_(ptfb)_pro_32543.html

    -A
    Europe vacation travel guide
    -a

  6. #6
    Junior Member
    Join Date
    Nov 2006
    Posts
    18

    Try winbatch

    You may want to try winbatch. It is a great product for automating windows applications. Lots of my customers use the product.

    Eddy Tan

  7. #7
    Junior Member
    Join Date
    Jan 2007
    Posts
    20
    Yea, i would use autoit also.
    This autoit script will do what you want.
    Code:
    While 1
    Send("{F1}")
    Sleep(3000)
    WEnd

  8. #8
    Senior Member
    Join Date
    Jul 2004
    Posts
    113
    I would use autoit, but yesterday i ended up making most of the script. I decided to go with a .vbs (Visual Basic Script).

    The only thing i need to figure out is how to loop it.

    Here's what I have so far:

    Code:
    Set obj = CreateObject("WScript.Shell")
    ' Activate Window - Using PID or Title
    obj.AppActivate("21064")
    WScript.Sleep(3000)
    obj.SendKeys("{F5}")

    Any suggestions? Any ideas on how to loop this? I guess to exit the loop I can either have an amount of time pass or have it count the number of times it performs. I also wouldnt mind have an "endless loop" that I can manually exit based on some keyboard command.

    Thanks,

    Rob

  9. #9
    Junior Member
    Join Date
    Jan 2007
    Posts
    20
    I haven't used .vbs much, but with Autoit if you wanted it to run 5 times then exit, this would be all the script you need.
    Maybe it will give you an idea for the .vbs script.

    Code:
    $x = 0
    While $x < 5
    Send("{F1}")
    Sleep(3000)
    $x + 1
    WEnd

Similar Threads

  1. Simple PHP Benchmark Script
    By Alice 888 in forum Web Programming Discussion Forum
    Replies: 0
    Last Post: 02-03-2007, 07:41 AM
  2. A simple security hint if you use Windows Xp.
    By kgun in forum Internet Security Discussion Forum
    Replies: 10
    Last Post: 06-27-2006, 02:16 PM
  3. Rem: Defeat Tenacious Adware With a Simple Script.
    By WPW_Feedbot in forum IT Discussion Forum
    Replies: 0
    Last Post: 02-03-2005, 02:01 PM
  4. simple script help
    By btg in forum Web Programming Discussion Forum
    Replies: 0
    Last Post: 10-27-2004, 03:51 PM
  5. Simple Store Locator Script in Javascript
    By ambassador in forum Web Programming Discussion Forum
    Replies: 7
    Last Post: 06-14-2004, 06:02 PM

Posting Permissions

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