Jump to content
xisto Community

PatrickMc

Members
  • Content Count

    5
  • Joined

  • Last visited

Posts posted by PatrickMc


  1. You want to randomly copy a file from <SOURCE PATH> to <DESTINATION PATH>.

    Here is a script.

    # Script randomcopy.txt# Input argument source and dest paths.var str source_path, dest_path# Collect a list of files in source path.var str list; lf -n "*" $source_path > $list# Get a count of files in source path.var int count; set $count = { len $list }# Get number of seconds in current time.var str seconds; chex "12[" gettime() > $seconds# Generate a random number n between 1 and $countvar real nset $n = ( makereal(str($seconds)) / 60 * $count ) + 1# Get the $n'th file from our file list.var str file; lex makestr(real($n)) $list > $file# Copy $file to dest_path. Enclose both in double quotes as# they may contain spaces, etc.system copy ("\""+$file+"\"") ("\""+$dest_path+"\"")


    The script is in biterscripting ( http://www.biterscripting.com/ ) . Save the script as C:\Scripts\randomcopy.txt. Start biterscripting. Enter the following command. (Enter the whole command on just one line. The source_path and dest_path are arguments passed to the randomcopy.txt script.)

    script randomcopy.txt source_path("<SOURCE PATH>") dest_path("<DESTINATION_PATH>")

    Change the <SOURCE PATH> and <DESTINATION PATH> to appropriate paths and make sure to enclose the paths in double quotes. The script can also be called directly from MS DOS, batch, perl, php, vbs or task scheduler. See the help page on batch.

    Patrick

  2. Definitely consider using biterscripting. There is a good sample script posted at http://www.biterscripting.com/SS_WebPageToText.html that parses tags from a web page. It parses html tags, so you can convert it to parse BB tags. One good thing about it is that biterscripting is very simple to learn and in no time, you can create your own collection of scripts, which is what I did, and possibly productize your collection of scripts.

    It will be nice if you post some small sample scripts you create. They will be very useful to others as welll.

    Good luck with your project. Email me if you need any help. (I only read my posts mail whenever time permits - so, please be patient.)

    Patrick


  3. For timed and timer'ed commands, you can do something like the following in biterscripting.

    while (true)
    do
    # Do something.
    sleep (30*60) # Sleep for 30 mins * 60 seconds.
    done

    You can also use chex and gettime() to get exactly the mins (say into variable $min), and do something, if ( ($min==0) OR ($min==30) ) .

    If you want the loop to end when something happens, you can change the while statement to something like the following.

    while ( { lf -n "C:/XXX/..../reportfile.txt } == "") # UNtil there is a reportfile.txt available, for example.

    I think a free download is still available at http://www.biterscripting.com/ .

    Patrick Mc
    Sys Admin

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.