Become a fan of Slashdot on Facebook

 



Forgot your password?
typodupeerror
×
Programming Technology

What's the Best Way to Handle Scripting Under XP? 167

ChrisZermatt asks: "I've got to build a custom workflow for a customer that has a photography business. His photographers take hundreds of thousands of photos a year, and since he's recently moved entirely to digital, he wants to automate a lot of his current processes. Ideally I'd be able to plonk a recent Mac running Tiger into his shop, and use a combination of AppleScript, iView Pro, Photoshop and an FTP program to handle all his needs. Sadly, he insists on using *cheap* PC's running Windows, so a Mac isn't an option for this project. So, what should I use on the Windows side of things to build a custom workflow?"
"iView lets you control the program using VBS or Javascript, but they don't really offer much in the way of advice on building a Windows workflow. I need to be able to copy/move a ton of files around and link the above mentioned programs. I'd really rather *not* spend money on something like VisualBasic. What are the alternatives for scripting on Windows?"
This discussion has been archived. No new comments can be posted.

What's the Best Way to Handle Scripting Under XP?

Comments Filter:
  • by nocomment ( 239368 ) on Thursday July 21, 2005 @01:05PM (#13125834) Homepage Journal
    put linux on it.

    Or jsut make "Batch" files.
  • Well, besides the obvious Perl, etc., it is entirely possible that you can accomplish what you wish using the Stupid Command Program (cmd.exe).

    I just loaded ImageMagick and sed on a peecee running W2K for my current gig and put a little .bat file in that converts a buncha tiffs to pdfs and sed's an import script to change the file extensions.

    If the script wants to do a lot of logic, then Perl, Python, and that ilk may be more to your liking.

    Mark
    • Re:Perl, etc. (Score:2, Insightful)

      by Miros ( 734652 ) *
      Dont forget PHP! PHP-cli is actually quite awesome for windows stuff, and if you can handle glade, you can even make some rapid efficient graphical apps. My only tip would be to avoid vbs like the plague.
      • I tried php-cli a couple years ago on windows and it blew goats. Has it gotten better? I also toyed with php-gtk on it but it kept crashing. I eventually lost interest in it and went back to using linux.
    • Get cygwin.. and write shell scripts...

      Of course, it could be pain when you have spaces in your file names.
  • Batch files! (Score:3, Informative)

    by One Div Zero ( 851169 ) on Thursday July 21, 2005 @01:09PM (#13125877)
    I use batch files to operate a software level RAID solution! It's easy!

    RAID.bat
    xcopy c: d: /e /k /i /c
  • VBA is the standard scripting language in Microsoft-land, or use Python [python.org] with the Win32 stuff [python.org].

    Damien
    • I've done this myself. In my case, it was to automate a job that queried a SQL Server and synchronized a file system with the database (think VERY crude content management here) using Python 2.3. os.walk() is your friend! :+)

      If you need to do image manipulation too, then you might also want to check out a tool like ThumbsPlus Commander (http://www.cerious.com/tpcommand.shtml [cerious.com]). You can probably also use this from Python with Win32 extensions.

      You know, you can still have fun putting solutions together un
    • VBA is actually not used to write scripts. It's used as an embedded automation/macro language in applications like Office and it is the language engine behind VB6. You can't write VBA code and have it run on the desktop by itself, that's why they call it "Visual Basic for Applications."

      The scripting engine on Windows is called Windows Script Host and it runs VBScript (different than VBA) and JavaScript (as well as other languages; it's pluggable) on the desktop.

      That said, if I had to do this, I'd probab

  • AutoIT (Score:4, Informative)

    by acaldwel ( 741921 ) on Thursday July 21, 2005 @01:10PM (#13125886)
    Take a look at http://www.autoitscript.com/autoit3/ [autoitscript.com]. It can automate windows GUIs and you can convert your scripts to .EXE files for easy of deployment.

    -Adam
  • Old saying (Score:4, Informative)

    by MarkGriz ( 520778 ) on Thursday July 21, 2005 @01:10PM (#13125890)
    . Ideally I'd be able to plonk a recent Mac running Tiger into his shop, and use a combination of AppleScript, iView Pro, Photoshop and an FTP program to handle all his needs. Sadly, he insists on using *cheap* PC's running Windows, so a Mac isn't an option for this project.

    Perhaps you could explain to him the meaning of being "Penny wise, Pound foolish"
    • Re:Old saying (Score:3, Insightful)

      by MarkGriz ( 520778 )
      (replying to myself)

      Actually, on second thought, since he's paying YOU, maybe you should just keep quiet.

      I'm sure there are some horrendously complex ways to do what you want with XP which should generate loads of billable hours for you.
    • What kind of person tries to develop applications without the proper tools? Visual Basic is a lot cheaper than a Macintosh.

      On the other hand, if one is knowledgeable, it is very possible to write VBScript or JScript scripts with just a text editor. Those can drive Photoshop and iView Pro, and can talk ftp as well. I guess I shouldn't be too surprised at the submitter's ignorance, given the number of people suggesting batch files (yuck!).

      If VBScript and JScript don't turn your crank, then it is quite po

      • Its a perfect ask slashdot routine. My employer doesn't want to do it this way, I dont want to do it that way, how can I do it but still look cool in front of my friends?
  • Windows Script (Score:4, Informative)

    by neura ( 675378 ) on Thursday July 21, 2005 @01:11PM (#13125921)
    • This is a good suggestion. You can use JScript or VBScript, usually without installing anything on the Windows PC, unless they have a really old system.

      You can also use JScript in Microsoft.NET. The compilers for C#, JScript, and VB.NET are included when you download the .NET framework, which is free.

      Look in c:\Windows\Microsoft.NET\Framework\version for CSC.EXE, JSC.EXE, and VBC.EXE. You may already have them.

  • by arnie_apesacrappin ( 200185 ) on Thursday July 21, 2005 @01:11PM (#13125922)
    This [sourceforge.net] project on source forge has native ports of many GNU utilities for windows. It includes a Z-shell. I have created many small automation projects with it and have had good results. I'm guessing you could use ZSH scripts as a manangement tool around the VBS or JS code.

  • Monad [wikipedia.org] is supposed to do this, in Longhorn; but it might be possible to get the beta version working with .NET.
  • Python? (Score:4, Informative)

    by Grab ( 126025 ) on Thursday July 21, 2005 @01:12PM (#13125933) Homepage
    Depends on the processes. However if what you're after is something to take in a bunch of files, call a command-line program (or programs) to munge them in some way, and spit them out elsewhere, Python isn't a bad tool for connecting the dots. It's not blindingly fast itself, but if you're just using it for scripting then no problems there.

    Python's default GUI provision is a bit basic though. If you want to build a Python user interface quickly, the PMW widget set (http://pmw.sourceforge.com/ [sourceforge.com] is worth a look.

    Grab.
    • Oops, that's http://pmw.sourceforge.net./ [pmw.sourceforge.net] Should have used preview... ;-)
    • In batch processing like this Pythons speed is extremely unlikely to be an issue. Use PIL [pythonware.com] or ImageMagik [imagemagick.org] for the image processing.

      And if you provide a GUI, for gods sake don't do it with Tkinter, or anything that builds on top of it. It's like stabbing yourself in the balls. Use wxPython, or PythonCard, or Wax, or (if you can pay the license fees) PyQt. Not Tkinter. Ever.

  • Use Macro Express [macros.com]. It's like Automater, but with more programming constructs and less user interface. It isn't exactly intuitive, but it does the job.
  • For an off-the-shelf implementation, batch files/cmd files work for simple work flows. But can be really clumsy if they get large and you need to do a lot of branching. In this case, VBScript is a better choice (in spite of its reputation).

    If a really complex workflow is needed, why not try using Ant? It's not just a build tool (look at the list of tasks that come with it, specifically FTP) .
    • I second VBscript. Worked awesome to organize my workflow for a semester long robotics program with 12 other students. I had it drop new files in an unorganized folder and with a simple gui pop up and confirm before sending them to different folders. Never did fix it to pop the windows up sequentially though but it worked and only took a few hours to work out in script.
  • Here's some advice: avoid working for cheapskates. If someone doesn't want to pay for the right tool for the job, they are extremely cheap and will probably screw you over. Surely the guy will save more than the $2000 it costs to buy a Mac from automation. Last I checked, windows doesn't have anything equivalent to AppleScript, at least not for controlling graphical apps.
    • While I don't agree about the applescript bit -- there's good automation stuff for windows, and applescript itself is a pretty loathsome language -- I do have to agree with "don't work for cheapskates".

      I mean, obviously you have to put food on the table, but I wouldn't exactly put in loads of extra hours and go the extra mile if it looks like you're going to get nothing in return for it. Do the job, use something adequate, collect your bill, job over. Then when he wants more, you can bill it as another j
    • >> Here's some advice: avoid working for cheapskates

      If only it were that easy.
    • Realistically, windows running on cheap hardware is exactly the way to do this. Just because you don't know how to do thing without applescript, doesn't mean it's not possible.

      It sounds like all he is doing is importing a bunch of photos into photoshop and exporting them out of ftp. Photoshop can do most of this with batch processing already and anything you can't do with photoshop natively you can use windows scripting to do.

      Pretending that using a Mac is the only way of doing something is just ignoran
      • Agreed. The photoshop batch tool is actually quite good. The best part about doing that, is that they have a recorder, so all you have to do it perform the actions you want and it records them into a little macro that you can then choose to run on selected photos, or even on whole directories.. Just make sure you get the opening and saving right, and you can do most of the photo processing right in photoshop itself. It's so easy to set them up, that you could probably show the client how to do it himsel
    • The problem isn't the technology. It's a training issue.

      If I guy comes to me asking for a solution on a Mac... you know what I tell him?

      Go talk to alienw, because it's going to take me longer to get up to speed on how to do it than it will take him to just do it.

  • You're joking right? (Score:5, Informative)

    by Ahnteis ( 746045 ) on Thursday July 21, 2005 @01:15PM (#13125968)
    Nope, you're not. [sob]

    Windows Scripting [microsoft.com]

    Also happens to be the first result on Google for "windows scripting host".
    • The question asked (Score:3, Insightful)

      by fm6 ( 162816 )
      For once, "Have you even heard of Google?" is not the correct response. The dude didn't ask "Can I script under windows", he asked "What's the best way to do scripting under windows." And that's a tricky question -- Windows is hardly the most scripting-friendly OS.

      Microsoft naturally comes out on top when you google for Windows scripting. But that doesn't mean that MS scripting technology is the best choice. On the contrary, Microsoft scripting relies heavily on their usual kludgey, baroque libraries and

      • For system-administration scripting, Windows can be annoying. For anything application-level, it is either (A) the same as other OSes, or (B) better. I'd like to see someone argue otherwise without resorting to hand-waving about "baroque libraries". (COM is designed for scripting, nothing baroque about using it there.)

        The biggest issue is that you don't get as many little tools as you would with a Unix OS, but for a single installation, that's not that big of a deal.
        • COM is designed for scripting, nothing baroque about using it there.
          Sure, COM is great for accessing libraries from scripts. But I stand behind my "baroque" comment. Too many COM libaries, including the ones bundled with Windows, are unnecessarily complex.
    • Mod parent down. Unless you've ever done anything useful with WSH. Even DOS batch files are more capable.

      The only useful thing WSH can do is mess with COM objects, which is kinda useless by itself.
  • Python (Score:5, Insightful)

    by frag thief ( 757953 ) on Thursday July 21, 2005 @01:18PM (#13126010)
    If it was me, I'd do it all in Python. It even has FTP libs built in. Plus, when you're ready to dump the Windows boxes you can run the same Python scripts or Linux or a Mac.
    • Then why not just dump Windows now.

      Cygwin + GUI Apps + bash or python + DCOP

      The above should make for a potent combination allowing for scriptable applications, and the user would still think they're using Windows stuff.

  • by Futurepower(R) ( 558542 ) on Thursday July 21, 2005 @01:22PM (#13126059) Homepage

    As someone else said, use AutoIt. AutoIt [autoitscript.com] is by far the best open source software for automating Windows installs and other tasks in which the program pretends to be a user. There's an IDE with an Intellisense-like interface and a compiler. Be sure you get AutoIt with the SciTE IDE [autoitscript.com], the site is a little confusing.

    AutoHotkey [autohotkey.com] came from the same source as AutoIt, is also open source, and is also impressive.

    --
    If your gov't chose killing as policy (CIA trained Arabs in 1980), expect others to choose the same.
    • I second that. Here [edgeofnowhere.cc] (similar here [stevefishwick.co.uk]) is an example of GUI scripting within it. If it's good enough to write a bot in for games, it will almost certainly do anything you want it to on the apps side.

    • One tip about AutoIt: Install the latest version of AutoIt. Then install the version of SciTE that includes AutoIt. We have found that just installing SciTE with AutoIt gives error messages.

      The web site is a little bit confusing, but the AutoIt help messages are quite clear.
  • Get a Mac (Score:1, Troll)

    by klui ( 457783 )
    Get a Mac.
  • by anotherone ( 132088 ) on Thursday July 21, 2005 @01:25PM (#13126088)
    Don't underestimate the power of Photoshop's scripting. I also do some work for a photographer and between actions and photoshop scripts, just about everything except some of the actual art is automated.
  • I think there solutions to this need, but let me take an aside and comment say that some problems have no solutions.

    Solvable:
    Problem: I need to add a number to 7 to get 6. What number should I use?
    Answer: Use the number -1. 7 + -1 = 6.

    Unsolvable:
    Problem: I need to add a positive number to 7 to get 6. What number should I use?
    Answer: Find another client. :-)

    Many times I see a customer choose something cheap to save money, only to find it costs them more to learn, maintain, and use that solution that it
  • Okay, if you're working for a photographer, a $200 difference shouldn't be outrageous for him to spend.... Dell desktop [dell.com] for $300 (not including software you'd have to buy) versus The Mac Mini [apple.com] for $500, which sounds like it comes with the things you want... Take the 20 minutes to show him how you'd like to do things that could be much easier.
    • You're seriously suggesting a Mac Mini for pro photography work?

      Holy hell, it's like Mike Meyers in "All Things Scottish" whenever the subject of Macs comes up...

      • heh. "If it's not a Mac, it's Crap!!!!" ...

        Seriously, I just read the summary: Ideally I'd be able to plonk a recent Mac running Tiger into his shop, and use a combination of AppleScript, iView Pro, Photoshop and an FTP program to handle all his needs.

        ... and suggested that he tells his boss what he wants.

        Macs are pretty nifty little machines, and the Mac Mini is probably underpowered for Photoshop, depending on what you want to do. But if it does what he wants, why not use it?
      • *ahem* I cut my teeth using Photoshop 3 on a 40 MHz 68k Quadra with 24 MB RAM. Yes, Photoshop CS 2 might be a shade slow on a 1.25 GHz Mini compared to a dual-2.7 GHz G5, but I assure you that it will run, and be completely usable... just as it is on my Mini at home and my G3/800 iBook. Besides, he's talking about scripting and automating... click a few buttons and let it run overnight. No big deal.

        Now, for the original question: do you have your own portable Mac? Demonstrate to your boss that everything h
  • How cheap is your boss that he can't even afford a Mini Mac to do what you wanted to do in the first place ? They're what, 500$ ? :P

    Ask Slashdot always boils down to the same thing : How can I do something expensive for nothing with no willpower and/or skill.

    There is no such thing as a free lunch.
  • by FriedTurkey ( 761642 ) * on Thursday July 21, 2005 @02:14PM (#13126873)
    If you want to appease the /. crowd you should install a bunch of open source tools. If your not a zealot, you should just use Windows Scripting Host which is already installed on an XP machine. Here is a three step example to get you started.

    1. Open up notepad

    2. Create a file with a vbs extension like "test.vbs".

    3. Save the following text:

    MsgBox "test"

    Now just click on the file in Windows Explorer. There are whole websites to using VBScript.

    I don't care about Mod points or I would of just said use some open source tool. I use open source tools all the time when it is the right tool for the job.
  • Python + Win32CoM (Score:5, Informative)

    by Gopal.V ( 532678 ) on Thursday July 21, 2005 @02:18PM (#13126929) Homepage Journal
    The last windows scripting I did was to convert a PHB excel spread sheet into a bugzilla report. It was converting the typical shared spread sheet on a folder share variety of bug reporting into proper bugzilla-like one (there are better ways, but it works).

    More over I like python - it has win32com which is damn easy to use, at least with Excel objects. Writing the script took me less than a day, while entering the bugs manually would have taken me over a week (imagine 2200 bugs of varying severity, and descriptions). The real challenge was to convert the OLE objects into attachements (screenshots, logs..). Truly they were idiots for maintaining all this in a SINGLE EXCEL File !!.

    But the point being, python+win32com is as easy as any other windows scripting host. Looks like there's python support for Photoshop [oreillynet.com] as well.

    Python is an average general purpose language. It's not fast like C++, doesn't have something like CPAN , nor is it very complicated or interesting. But it is often easy to write, read and throw away (or upload to your hacks/).

  • by booch ( 4157 ) <slashdot2010NO@SPAMcraigbuchek.com> on Thursday July 21, 2005 @02:20PM (#13126958) Homepage
    Well, half circle, I guess.

    Here's a parable (story) I once heard, which seems rather fitting. It's about offering to give the customer what they want, but making it clear what it will cost when they want something that's not to their benefit.

    A consultant was writing a custom application for a company. The program was written to work on a PC. One of the executives at the company used a Mac, so he insisted that they make the program work on his Mac. The consultant says "sure, we can do that". The consulant comes back with an estimate on the cost of making the program work on the Mac: $50,000 and 6 months. The executive decided to use a PC.

    So my advice to you is this: provide the guy with 2 estimates -- one for your Mac solution, and one for a solution using the limited tools he's forcing you to use. Don't forget to factor in the Mac hardware costs, your research time, the extra time it will take to work with tools you are not familiar with, and perhaps a premium for working with tools you don't like. Maybe the difference will change his mind; maybe it will change yours.
    • This works, but only if your customer is either stupid or beholden to you. The smart customer, in that situation, would have said something like, "That's nice. We'll give you a call after we discuss that", and called someone who wasn't going to lie to them. Of course, the need for the Mac port should have been specified up front, too.

      Exactly whats being created here isn't perfectly clear, of course, but based on the description of the OPs preferred solution, I see no reason anyone competent couldn't implem

    • The client isn't forcing the poster into using limited tools. He's just specified a platform. What the poster fails to mention is if the client is already running a Windows based shop and already has money invested in XP machines and software, which is probably why the client wants a Windows solution.

      What the poster *should* do is subcontract the bulk of the job to someone who knows how to do this in Windows and take a cut off the top instead of bitching about how the job would be so much better if he c

      • Sub-contracting / charging a premium -- what's the difference?

        I did tell the poster to factor in the cost of the Mac into the equation, and see if it actually came out better for the client to build it for the PC.

        Sheesh. ;)
  • Easy remedy (Score:2, Funny)

    by Anonymous Coward
    Buy a Mac mini, and conceal it in some hulking ATX case with a few lights on the front and some loud fans in the back.

    Then just do what you gotta do to make OS X look like Windows. He'll never know the difference. If he asks about it, tell him it's Longhorn.
  • It works very well. There is an interpreter for Win32.

    Look here [ruby-lang.org]

  • You can do just about anything with non-sandboxed javascript on the windows scripting host. If you need a GUI, HTA's are good too, and can be styled to look like native windows apps.

    Irfanview has command line parameters for most of its features, which makes it useful for image manipulation.

    For ftp, you could try outputting your commands to a text file then running the ftp.exe that comes with windows on it.

    If you need a great deal more, a full cygwin install will give you almost every tool you'd ever want
  • There's a nice Windows installer for Ruby [rubyforge.org] and a nice set of Ruby bindings [rubyforge.org] for ImageMagick.
  • iMatch (Score:3, Informative)

    by jayrtfm ( 148260 ) <jslash@sophontCOFFEE.com minus caffeine> on Thursday July 21, 2005 @03:50PM (#13128139) Homepage Journal
    iMatch [photools.com] has a basic language scripting built in, can control other programs, can handle RAW, hundreds of thousands of images in its database, simple image editing, yada yada yada..... it's a mature app.

    The programmer is very responsive and active on the user forum.
  • I don't know what you mean by custom workflow, or processes. I mean what are you really trying to do?

    Windows is easily scripted using Windows Scripting Host. You can use Jscript, VBScript, and other third party languages. If all you are trying to do is automate some processing on a directory of files, move some files around, maybe create a directory structure... whatever. That's the way to do it. You can setup little icons to click and it runs the process, or schedule them to run, whatever.

    But if you
  • It's built into Windows Scripting Host, you can use it with VBS, and it will do everything you need in that regard.
  • MacroExpress (Score:2, Interesting)

    by SporkLand ( 225979 )
    I have found Macro Express( http://www.macros.com/ [macros.com]) to be the best way to script things under Windows. It lets you quickly write scripts that interact with various programs in the system to get useful things done. It even lets you get down to the level of sending messages to a Window's message handler, although I've never needed anything that complicated.

    It's only downside is that it is a bit timing sensitive, and is pseudo difficult to get synchronized with the programs it is interacting with in the abse
  • Check out WinBatch [winbatch.com]. For Windows stuff it really rocks; it's easy, fast, powerful, can be compiled (if you get the version with compiler - do it). It's $500 bones, but I've found it well worth it.

    Plus, there are a zillion forum postings so odds are if you're trying to figure out how to do something odd, someone else has taken a stab at it.

    Or you could just use Perl.

  • Just setup everything on a Mac Mini and bring it in and set it next to the Windows machine. Do a run thru of everything on the Mac. And when he says "You've already got it running!?" Just say "No. I've got to convert everything so that it works on this Windows machine here first. I just wanted to let you see a demo."
  • I've seen people use perl and make (from cygwin) on Windows to automate tasks, but that was mostly in software development process automation. I have no idea how to automate GUI apps on Windows, but why not have a look at the NetPBM tools and ImageMagick, which can do a lot of things in batch. Or go right away and use something else then Windows on these PCs, e.g. NetBSD or Linux.

    - Hubert
  • KiXtart (Score:5, Informative)

    by Halvard ( 102061 ) on Thursday July 21, 2005 @09:54PM (#13131344)
    KiXtart [kixtart.org] is about the greatest thing since sliced bread. From the home page:

    What's KiXtart

    The KiXtart free-format scripting language has rich built-in functionality for easy scripting. It also supports COM (providing access to ADSI, ADO, WMI, etc) and thus is easily extensible. With the amazing KiXforms GUI for KiXtart, there is so little, if anything you can't accomplish with KiXtart.

    And because of the User Defined Functions (about 500 ready UDF's on korg already), there is very little you need to code by yourself as much of the complex things have already been coded for you!

    KiXtart is developed by Ruud van Velsen of Microsoft Netherlands

    KiXtart is now provided to you as CareWare. Please see "KiXtart: Do You Care?" for full details.

    It's pretty incredible, it's free, it allows you to do things you can't otherwise do at login with paying a lot of money (and did it sooner I believe), is written by an MS employee.

  • There have been many scripting suggestions given. Before selecting one, you may wish to identify some other items first.

    Does your workflow need to be a GUI application? Can it be a set of console applications? Can it be a web based application? I currently work with a system that scans and scores school assessment test documents. The section I work with, the input side, tracks the document workflow with an Oracle backed web application. How you intend to manage the workflow of the images may have an

  • In the long ago, I would have suggested DeBabelizer. [equilibrium.com] It was once the king of image batch scripting, and may still be. Now I am not so much suggesting it -- I've been out of the business for a while, and don't know how it's regarded now -- as recommending it for your consideration. So, consider.... And if you ever convince them to move to Mac, the fact that there are both Mac & Windows versions may make the transition easier.
  • by chriskenrick ( 89693 ) on Sunday July 24, 2005 @09:47PM (#13153098)
    How "custom" are the requirements for this software? Keeping track of thousands and thousands of photos isn't a new problem, and there are heaps of programs around that do just that (eg IMatch, ACDSee, Fotostation, Portfolio). I'd be very surprised if this didn't work out more cost effectively than a custom solution.
  • I use Perl under Cygwin myself.
    http://cygwin.com/ [cygwin.com]
    You could use a move native Perl like ActiPerl.

    Recently, I played around with the Perl Win32 libraries. They do the usual API access, but one of them (forget which) lets you simulate keyclicks. There's a sample program on the web somewhere that has a 5-line Perl script launching Excel, and enter data in Excel cells.

    What I like to see: a scripting engine with a Konfabulator like UI. Konfabulator isn't open-source, but I would like a client-side scripting engin

Any circuit design must contain at least one part which is obsolete, two parts which are unobtainable, and three parts which are still under development.

Working...