Isn't an OOP macro language overkill?

Discussion in 'Mac Programming' started by mysterytramp, Oct 28, 2008.

  1. mysterytramp macrumors 65816

    mysterytramp

    Joined:
    Jul 17, 2008
    Location:
    Maryland
    #1
    This morning I had to process about 5,000 lines of data from a web site into an Excel table (2007 for Win XP). Transmission glitches added two or three cells to a couple of hundred rows. I needed to append one cell to the cell to the left and then move a cell over. A word processor might have done the task but brute force seemed the least pleasant option. It seemed like a simple matter of recording a macro.

    At work, I use Excel with the full Ballmer-blessed Office experience. In this environment, I mistakenly believed Excel would record a "copy" and a "paste." Instead, it hard-code the original values into the macro. Hit the keystroke and the cursor moves around and plunks that data into a new cell. Worthless.

    Also worthless was F1, and don't even ask about our IT department. Cussing, I googled and found several web sites with author's showing off their VBA prowess with complex data manipulation. (M$, BTW, kept pointing me to broken links. Go figure.) Finally I found something that almost fit my purposes. After about a half hour, I had a working macro.

    1) I bet the exercise would have gone a lot faster if VBA were more procedural than object-oriented. Maybe for a giant project, an object-oriented macro language makes sense. But for crying out loud, it's a MACRO. Nobody is going to land the damn space shuttle with VBA!

    2) That is one crappy editor for VBA. I don't understand how Microsoft jockeys aren't going blind; the company's interfaces are based on pixel sized icons.

    3) I completed the work with greater appreciation for Apple's lowly scripting language. Granted, I know Applescript better, but I bet if I had a spreadsheet with a decent AS dictionary (Mariner Calc perhaps?), I could have completed the job in 10 minutes, with a script I could use again. This VBA mess I wrote will never again see the light of day.

    Excuse the rant ...

    mt
     
  2. lee1210 macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #2
    Unix commandline tools, FTW!

    Pull stuff from a website/URL:
    curl or wget

    Parse it:
    quick perl script
    awk
    sed
    others, i'm sure

    Correct a few glitches:
    More awk, sed, and so on
    vi (but essentially using sed commands)

    It may be too late now, but i'm sure plenty of folk here will help you out in stringing the stuff together in the future if needed.

    -Lee
     
  3. mysterytramp thread starter macrumors 65816

    mysterytramp

    Joined:
    Jul 17, 2008
    Location:
    Maryland
    #3
    I thought about posting here but the project had to be done stat. Plus IT has a pretty big clamp on what we're allowed to add to our computers, so if it didn't come with a standard Windows/Office installation, it couldn't be used.
     
  4. yeroen macrumors 6502a

    yeroen

    Joined:
    Mar 8, 2007
    Location:
    Cambridge, MA
    #4
    lee120 is right

    sometimes (ok, always) the UNIX command-line is just better for these sorts of things.

    Would the IT control-freaks object to installing cygwin (assuming they even know what it is) ?. Even cygwin's poor cousin, Windows PowerShell, would be helpful (and it may already be installed).
     
  5. lee1210 macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #5
    cygwin is essential when one must use windows. I am using a windows machine now, but the vast majority of my screen is covered with xterms ssh'd to linux servers, by means of a rootless x-server running in cygwin. I keep a few local xterms open to run some local scripts, parse things locally, etc.

    mysterytramp: Are your IT folk paranoid enough to prevent you from installing any local software? Or are they simply unwilling to support things they haven't installed? If the latter, you should be able to do a cygwin install yourself and have a real shell available in a few hours.

    -Lee
     
  6. AlmostThere macrumors 6502a

    #6
    Excel can also read tabular data directly from a web site.
     
  7. mysterytramp thread starter macrumors 65816

    mysterytramp

    Joined:
    Jul 17, 2008
    Location:
    Maryland
    #7
    Yes. We're under pretty strict orders that NOTHING can be installed without their approval. They're not bad, but they aren't app folks. They're network people. If a user wants to add something, it might make more work for them, so better to deny it.

    mt
     
  8. mysterytramp thread starter macrumors 65816

    mysterytramp

    Joined:
    Jul 17, 2008
    Location:
    Maryland
    #8
    I realize my original post was a little long, but basically that's what I was doing. But because of a glitch either in the Web site or in Excel, in about 100 or so rows, 8 columns became 9 and 10.

    mt
     

Share This Page