scripting

Should I choose scripting or compiled code for small tasks?

I'm a Java programmer, and I like my compiler, static analysis tools and unit testing frameworks as tools that help me quickly deliver robust and efficient code. The JRE is pretty much everywhere I would work, too. Given that situation, I can't see a reason why I would ever choose to use shell scripting, vb scripting etc, no matter how ...

Visual studio automation: Enumerate opened windows upon solution loading.

How to enumerate opened code windows (i.e. those windows where you edit documents) upon solution loading using macros? As you probably know, MSVS remembers opened documents, i.e. when you load solution, IDE will load previously opened files. What I want to do is to perform some actions with those windows upon solution loading. I tried ...

Copy files on Windows Command Line with Progress

Does anyone know of a windows commmand-line ( available on XP Pro or later by default ) that could copy a file while showing progress. I do not care if the progress indicator is in a terminal or a GUI window. This is intended to be used during batch file scripting ...

How do I create a custom type in PowerShell for my scripts to use?

I would like to be able to define and use a custom type in some of my PowerShell scripts. For example, let's pretend I had a need for an object that had the following structure: Contact { string First string Last string Phone } How would I go about creating this so that I could use it in function like the following: funct...

How can you find and replace text in a file using the Windows command-line environment?

I am writing a batch file script using Windows command-line environment and want to change each occurrence of some text in a file (ex. "FOO") with another (ex. "BAR"). What is the simplest way to do that? Any built in functions? ...

Is there replacement for cat on Windows

Hello. I need to join to binary files in *.bat script on Windows. How can I achieve that? ...

How do I access the non-IPM_SUBTREE Public Folder Tree with WMI?

I'm trying to verify when the OAB (Offline Address Book) root folder for a new OAB is created with powershell. Is there a WMI class that exposes this? I'm using powershell, but any examples or links will do. ...

Implementing scripts in c++ app

I want to move verious parts of my app into simple scripts, to allow people that do not have a strong knowleagd of c++ to be able to edit and implement various features. Because its a real time app, I need to have some kind of multi-tasking for these scripts, idealy I want it so that the c++ app calls a script function which then contin...

What is the best way to extract a version string from a file?

I want to use a file to store the current version number for a piece of customer software which can be used by a start-up script to run the binary in the correct directory. For Example, if the run directory looks like this: . .. 1.2.1 1.2.2 1.3.0 run.sh current_version And current_version contains: 1.2.2 I want run.sh to descend i...

Which Scripting language is best?

For writing scripts for process automisation in Linux platform, which scripting language will be better? Shell script, Perl or Python or is there anything else? I am new to all of them. So, am just thinking to which one to go for? ...

Grabbing every 4th file

I have 16,000 jpg's from a webcan screeb grabber that I let run for a year pointing into the back year. I want to find a way to grab every 4th image so that I can then put them into another directory so I can later turn them into a movie. Is there a simple bash script or other way under linux that I can do this. They are named like so.....

How to create batch file in Windows using "start" with a path and command with spaces.

I need to create a batch file which starts multiple console applications in a Windows .cmd file. This can be done using the start command. However, the command has a path in it. I also need to pass paramaters which have spaces as well. How to do this? E.g. batch file start "c:\path with spaces\app.exe" param1 "param with spaces" ...

How do I pass a variable to a mysql script?

I know that with mysql you can write SQL statements into a .sql file and run the file from the mysql command line like this: mysql> source script.sql How do I pass a variable to the script? For example, if I want to run a script that retrieves all the employees in a department, I want to be able to pass in the number of the department...

What does $$ mean in the bash shell?

I once read that one way to obtain a unique filename in bash for temp files was to use a double dollar sign ($$). This does produce a number that varies from time to time... but if you call it repeatedly, it returns the same number. (The solution is to just use the time.) I am curious to know what $$ actually is, and why it would be ...

Best win32 compiled scripting language?

What is the best compilable scripting language for Win32? I prefer .EXE's because I don't want to install the runtime on the servers first (my company administrates many via remote), but I need to be able to do things like NTFS permissions and (if possible) APIs over the network. There was a small Perl which appeared to be able to do m...

Web Scripting for Java

What is a good way to render data produced by a Java process in the browser? I've made extensive use of JSP and the various associated frameworks (JSTL, Struts, Tapestry, etc), as well as more comprehensive frameworks not related to JSP (GWT, OpenLaszlo). None of the solutions have ever been entirely satisfactory - in most cases the fr...

How do I get the full path to a Perl script that is executing?

I have Perl script and need to determine the full path and filename of the script during execution. I discovered that depending on how you call the script $0 varies and sometimes contains the fullpath+filename and sometimes just filename. Because the working directory can vary as well I can't think of a way to reliably get the fullpath...

Can anyone recommend a good modern alternative to bash?

Bash is getting a little long-in-the-tooth. Windows has PowerShell (formerly known as Monad), which is capable of dealing with richer objects than just lines of text. Is there any equivalent new powerful shell for Linux/Mac? It should be of similar expressiveness and functionality to Bash, but not afraid to tackle things in a differ...

Determine if a function exists in bash

Currently I'm doing some unit tests which are executed from bash. Unit tests are initialized, executed and cleaned up in a bash script. This script usualy contains an init(), execute() and cleanup() functions. But they are not mandatory. I'd like to test if they are or are not defined. I did this previously by greping and seding the sou...

is there a curl/wget option that says not to save files upon http errors?

I want to download a lot of urls in a script but I do not want to save the ones that lead to HTTP errors. as far as I read in the man they both don't provide such functionality. does anyone know about another downloader who does? ...