PatrickMc
Members-
Content Count
5 -
Joined
-
Last visited
About PatrickMc
-
Rank
Newbie
-
Copy A File And Rename It With Increment If Exist in VBScript
PatrickMc replied to oxida's topic in Programming
Jayarama The following commands in biterscripting will do just that. cat "http : // bangmsrira1:8080 / SampleProject/Book1.Xls" > x.xlssystem start x.xls If the file does not exist, you will get an error. If the file exists, it will be opened in Excel. (I have had to add spaces in the URL so the forum won't format it further.) Patrick -
Copy A File And Rename It With Increment If Exist in VBScript
PatrickMc replied to oxida's topic in Programming
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 -
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
-
Best Way To Backup A Website?
PatrickMc replied to rpgsearcherz's topic in Websites and Web Designing
You can use biterscripting ( http://www.biterscripting.com/ ) to copy or download web pages. For example, the following command will copy this web page to file C:/Backup/Xisto.html . Patrick -
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