scripting

Batch Script issue

Hello, for deleting files, I will be using the code below to remove the oldest file in the directory and run it every day. It came from the question of mine. Applying to the original batch script: SET BACKUPDIR=C:\PATH\TO\BACKUPS FOR /F %%i IN ('DIR /B /O-D %BACKUPDIR%') DO SET OLDEST=%%i DEL %BACKUPDIR%\%OLDEST% Something such as th...

Reload column names in ActiveRecord model class

I have a script using ActiveRecord that creates column names dynamically based on values read from a CSV file, something like this: FasterCSV.foreach('votes.csv', :headers => true) do |row| column_name = "roll_call_id_#{row['roll_call_id']}" if !Legislator.columns.map(&:name).include?(column_name) connection_pool.connection.add...

Double click on CMD script in Vista does not execute script!!!

I am running Vista Home Premium. I tried to write a script to do some simple automation.... it does not work! even the most simple script like: @echo ON dir . does not get executed and only an empty CMD shell pops open. This is really weird and I have never seen this before (but wrote many CMD scripts before) ftype cmdfile and bat...

How can I open an HTML file as a text file to read the code using VBScript?

I have a lot of HTML pages that need the same few lines of text changed on them. To reduce the time it will take to manually open each one in Notepad and find the text and replace it with the new text, I would like to create a script to do this for me. How can I open an HTML file, read the code the makes up the page and find & replace t...

Scanning Keypress in Python

I have paused a script for lets say 3500 seconds by using time module for ex time.sleep(3500). Now, my aim is to scan for keypresses while the script is on sleep, i mean its on this line. Its like I want to restart the script if a "keypress Ctrl+R" is pressed. For ex.. consider #!/usr/bin/python import time print "Hello.. again" whi...

Startup time in Solaris server using shell script

How to find the start up time of a Solaris 5.1 server using a shell script,need to know how much time it took to be on running state?I need to know how much time it took to come to running mode from starting mode? ...

.NET Web Scripting

I'm attempting to right a script to logon (username and password) on to a website and download a file. I've tried using the webClient and webBrowser classes to no avail, they don't seem to work for what I need them to do. Does anyone else have any suggestions? ...

Can Netsuite Suitescript modify a file in the file cabinet?

I have a large product list and need to generate a static file of it, and have that file be accessible in my website. Currently, I generate the list, and upload it to the file cabinet. I wish to automate this process. I would like to schedule a SuiteScript to run each night and generate this list and update a file in the file cabinet. C...

linux script simple arithmetic code

So I'm just working on some simple arithmetic code. Here's what I got: echo "The number should be 2"; declare -i input added input= date +%w let added="input/2" echo "$added" when I run it the output is 4 0 I'm trying to just get 2. What the heck am I doing wrong? ...

Should javascript code always be loaded in the head of an html document?

Is there a blanket rule in terms of how javascript should be loaded. I'm seeing people saying that it should go on the end of the page now. Thoughts? ...

bash script for searching from a list of files in directory

There are around 20 files in a directory . Each file has the string $str inside it. I want to write a script that picks out that row containing the string $str and dump into a file . Each file should dump the searched row into a different file . For example file1 dumps searched row to file called found1 and file2 dumps it to file cal...

How to iterate over positional parameters in a Bash script?

Where am I going wrong? I have some files as follows: filename_tau.txt filename_xhpl.txt fiename_fft.txt filename_PMB_MPI.txt filename_mpi_tile_io.txt I pass tau, xhpl, fft, mpi_tile_io and PMB_MPI as positional parameters to script as follows: ./script.sh tau xhpl mpi_tile_io fft PMB_MPI I want grep to search inside a loop, first...

Starting a Firefoxprofile in a startupscript?

How do you start a Firefox-profile in a startupscript? This want do: Set shell = CreateObject("WScript.Shell") progList = Array("C:\Program Files\Mozilla Firefox\firefox.exe" -P "PrimaryNew" -no-remote") For Each prog in progList 'WScript.Echo "File Name: " & prog shell.run """" & prog & """", 1, false WScript.sleep 1000...

how to implement objects for toy language ?

I am trying to make a toy language in c++. I have used boost spirit for the grammar, and hopefully for parser/lexer. The idea is a toy language where 'everything is an object' like javascript and some implementation of prototype based inheritance. I want to know how to implement the 'object' type for the language in c++. I saw source cod...

Best way to configure a run script?

I am tasked with supportting a run script that uses environment variables to determine which tools to use, which directories to grab source files from, etc. This does not seem like the best technique to me. It seems like it would be much better to have configuration files that set all these things and have the run script parse this inste...

How can I run an RDP file with VBScript?

So far I have: Set objShell = WScript.CreateObject("WScript.Shell") objShell.Run("""C:\Server01.rdp""") But when I run it, nothing happens. Is it even possible to run an RDP file with VBScript? If so, then what am I doing wrong? ...

Reasons for using a DLR-based language rather than C# for scripting tasks?

I'm considering embedding a scripting language into one of my software projects and have identified two options: compiling C# at run-time via CodeDOM and embedding a DLR-based scripting language. Both options would give me full access to the .NET Framework. The operation that I'd be scripting would be a user-defined transformation of a...

Using DOS file contents as command line arguments in BASH...

This is a follow-up to this question's answer. How can I modify the code so that the annoying CRLF of a DOS created file can be stripped away before being passed to xargs? Example file 'arglist.dos'. # cat > arglist.unix src/file1 dst/file1 src/file2 dst/file2 src/file3 dst/file3 ^c # sed 's/$/\r/' arglist.unix > arglist.dos The uni...

basic shell script

I have some video files all ending in .wmv .mov .mpg. I have music files ending in .mp3 .wma. And finally I have some text files all end in the extension .txt I wrote a shell script that generates subfolders, one for the music files, one for the video files, and one for the text files, and then organizes all of the files into the correc...

help with selecting rows using awk

I have a file as follows 2.54 Ghz val 2.53 Ghz val1 1.6 Ghz val2 800 Mhz val3 2.54 Ghz val4 2.53 Ghz val5 1.6 Ghz val6 800 Mhz val7 and the pattern continues ... I want to extract all 2.54 Ghz values in one file1 and all 2.53 Ghz values in another file2 , 1.60 Ghz values in file3 and 800 Mhz values in file4 ...