scripting

Bash: how to supress newlines?

I'm trying to extract fields from a pipe-delimited file and provide them as arguments to an external program in a loop. The file contains lines like this: value1|value2 value3|value4 So I came up with: while read line; do echo -n "${line}" | awk -F '|' '{print $1}'; echo -n " something "; echo -n "${line}" | awk -...

Make new chat in Adium using Cocoa ScriptingBridge

The following AppleScript code works fine: tell application "Adium" to tell first account to make new chat with contacts {first contact} with new chat window But how can I do the same using Cocoa's ScriptingBridge? ...

Creating a scripting language

Hi All Can somebody please guide me in the right direction of creating a scripting language that targets the WSH (Windows Scripting Host)? I have googled for it, but there seem to be far fewer links related to this than when I originally searched for it a few months back. THank you ...

Printing Stdout In Command Line App Without Overwriting Pending User Input

In a basic Unix-shell app, how would you print to stdout without disturbing any pending user input. e.g. Below is a simple Python app that echos user input. A thread running in the background prints a counter every 1 second. import threading, time class MyThread( threading.Thread ): running = False def run(self): self....

What is the fastest way to compare two list of items?

I have two folders with approximately 10,000 files each. I'd like to write a script or program that can tell me if these folders are in sync and then tell me which files are missing from each to make them in sync. Therefore, after generating a list of files, what is the fastest algorithm to sort them for unique files? What I'm thinking...

Creating Mobile Cross-Platform Scripting Solution

I am having the dream to design a Mobile cross-platform scripting solution to achieve Developer only need to code once by scripting language(it's possible be Javascript or others need further investigation), then the solution will be able to generate the installation files for multiple mobile platforms like J2me, Android, Symbian, BlackB...

Get seconds since epoch in any POSIX compliant shell

I'd like to know if there's a way to get the number of seconds since the UNIX epoch in any POSIX compliant shell, without resorting to non-POSIX languages like perl, or using non-POSIX extensions like GNU awk's strftime function. Here are some solutions I've already ruled out... date +%s // Doesn't work on Solaris I've seen some...

What scripting language would you use to put text over a generated image ?

I got this question from my cousin: "What will be the best way to create a similar working website just like: http://www.plakletters.nl". I have looked into the website and think that to start of with i'm gonna help my cousin write a script that loads all fonts installed on the system into a dropdownlist. This dropdownlist will post a...

Add code to html pages automatically

I need to add some code to the of several html contained in a folder on my desktop. How can i do that? I am using a prototyping tool (Axure) on Mac and I want to add some html meta tags to the generated pages. These pages can be overwritten every time I generate the prototype. What I need is a sort of script that I can launch after re-...

Insert copyright message into multiple files

How would you insert a copyright message at the very top of every file? ...

Automatically Convert Prices on a Web Page to A Different Currency

Hi, I am interested in possible methods of automatically converting the prices given when a web page is loaded from the currency given to a specified currency. Ideally, the conversion would also make use of the current exchange rate to give valid prices. For example, in my specific case, I would like to convert the prices given in Eur...

PHP: Script Protection or Work around help

I need to create a PHP script that works more or less like a licence activation key, once activated then you are good. I have a main site (My website), and I have clients site (Licence Holder Website/also where the php script should be held) I was thinking would cURL Library be my solution to this? or not? or if anyone has a better s...

How to Keep to GPL Licence When Modifying a Script

Hi, In answering my own question, I came across this GreaseMonkey script that automatically converts currency values on a webpage. I would like to modify the script for my specific case, and I want to know how I should modify the script MetaData block to acknowledge the script's original author and respect the (letter and spirit of the...

Client-Side script to upload attachments to the Sharepoint 2007 list

Hello. I have no good script-writing experience. So, I have a list created on MOSS 2007 with about 1000 elements and attachments enabled. I need to attach to each list item file (*.jpg) from a local folder. I doesn't have administrator privileges at MOSS server, only contributor rights Here is my PoSh script: $web = new-Object system...

Unable to set variables in bash script in Mac OSX

Hello! I am attempting to automate moving files from a folder to a new folder automatically every night using a bash script run from applescript on a schedule. I am attempting to write a bash script on Mac OSX, and it keeps failing. In short this is what I have (all my ECHOs are for error checking): #!/bin/bash folder = "ABC" useracct...

Pass by reference in Boost::Python

Hi everybody. Consider something like: struct Parameter { int a; Parameter(){a = 0;} void setA(int newA){a = newA;} }; struct MyClass { void changeParameter(Parameter &p){ p.setA(-1);} }; Well, let's fast forward, and imagine I already wrapped those classes, exposing everything to python, and imagine also I instantiate...

Shell script to process files

I need to write a Shell Script to process a huge folder of nearly 20 levels.I have to process each and every file and check which files contain lines like select insert update When I mean line it should take the line till I find a semicolon in that file. I should get a result like this C:/test.java select * from dual C:/test.java ...

Easy to use AutoHotkey/AutoIT alternatives for Linux

Hi all, I'm looking for recommendations for an easy-to-use GUI automation/macro platform for Linux. If you're familiar with AutoHotkey or AutoIT on Windows, then you know exactly the kind of features I need, with the level of complexity. If you aren't familiar, then here's a small code snippet of how easy it is to use AHK: InputBox, ...

Get Active Directory Attributes for Users on Legacy Exchange Servers

I would like to create a CSV file of the users on our Exchange 2003 servers, and include some attributes from their AD account. In particular, I would like to pull certain AD values for the users with RecipientTypeDetails = LegacyMailbox. I have tried a few different methods for targeting and filtering (ldapfilter, filter, objectAttrib...

How to automatically insert code for an Xcode video demo

I've been watching some of the WWDC 2009 videos which include some video demos in Xcode. The presenters are using some sort of macro or script bound to a keyboard shortcut to automatically insert some pre-prepared code at the current caret location. Each time they press the key, the next prepared snippet is inserted. Does anybody know h...