SenHu

Member
  • Content count

    5
  • Joined

  • Last visited

Community Reputation

0 Neutral

About SenHu

  1. Are you allowed to use anything other than command prompt ? That will make parsing of the output easier. Here is a possible script. # Script ping15sec.txt var str output, lost while (true) do # Ping. Collect output into variable $output. system "ping 132.21.21.2" > $output # Get the lost packect count. It is after "Lost =" in $output. stex -c -r "^Lost;=;^[" $output > $lost stex -c -r "[^,^" $lost > null # $lost must be "0". If not, something went wrong. if ($lost <> "0") do # Do something to report error here. For now, we will just shout. echo "LOST " $lost " PACKETS AT TIME " gettime() done endif # Sleep for 60 seconds sleep 60 done Save the script in file C:/Scripts/ping15sec.txt, start biterscripting ( http://www.biterscripting.com ), enter the following command. script "C:/Scripts/ping15sec.txt"
  2. Yes, you can run the script directly from Vista command prompt by entering the following command at the command prompt. "C:\biterScripting\biterScripting.exe" "C:\delete.txt" You can also schedule this same command in task scheduler if needed.
  3. I recommend using a ? to separate the list of subfolders instead of /. This will allow you to enhance the script later to work at any level of directories. Here is a script in biterscripting. # Script delete.txt # Input arguments var str dir # Directory fro where to delete var str dont # List of subfolders not to delete, separated by ? # Get a list of all subfolders in $dir. var str list; lf -n "*" $dir ($ftype=="d") > $list # Process each subfolder one by one while ($list <> "") do # Get the next subfolder from the list. var str subfolder; lex "1" $list > $subfolder # $subfolder now contains the full path of subfolder var list name; stex -p "^/^l[" $subfolder > $name # $name contains only the name of the subfolder # Is this name in the list of not-to-delete $list ? if ( { sen ("^"+$name+"^") $dont } <= 0 ) # This subfolder is not in the list of not-to-delete subfolders. Delete it. system delete ("\""+$subfolder+"\"") endif done This script will work in all Windows versions. I haven't tested it, so test it first. To test, 1. Save the script in, say, C:\delete.txt. 2. Install biterscripting from http://www.biterscripting.com or any other site you can google up. It's free. 3. Start biterscripting. Run the delete.txt script with the following command. script "C:\delete.txt" That's it. Sen
  4. The original poster wants to Here is a script in biterscripting (http://www.biterscripting.com/install.html) . Will work on all windows versions. # Get the modification time stamp of file C:/dir2/afterme.txt. var str timestamp; af "C:/dir2/afterme.txt" if ($fexists) set $timestamp = $fmtime; endif # If afterme.txt does not exist, then $timestamp will remain empty. # Get a list of *.tada files in directory C:/dir1 which were modified after $timestamp. var str filelist; lf -n "*.tada" "C:/dir1" ($fmtime >= $timestamp) > $filelist # Copy files one by one. while ($filelist <> "") do var str file; lex "1" $filelist > $file system copy ("\""+$file+"\"") "C:/dir2" done # Modify the modification timestamp for the afterme.txt file. echo > "C:/dir2/afterme.txt" # We are done ! Sen
  5. Good suggestions and code so far. Here is an alternate way. Here is a biterscript (biterscripting script). var str input, output; cat "txtsetup.sif" > $input # Extract everything upto "[SourceDisksFiles]\n" stex "^[SourceDisksFiles]\n^]" $input > $output # Add "example.dll = 1,,,,,,3_,2,0,0,,1,2\n" echo "example.dll = 1,,,,,,3_,2,0,0,,1,2\n" >> $output # Add remaining portion of $input echo $input >> $output # Write file back. echo $output > "txtsetup.sif" biterscripting scripting or batch language is free at http://www.biterscripting.com . Sen