AppleScripts and interface built; but how do I put them together?

Discussion in 'Mac Programming' started by c726e6f6e, May 5, 2009.

  1. c726e6f6e macrumors newbie

    Joined:
    Aug 27, 2004
    #1
    So I'm running Leopard, I've got the developer tools installed, and I'm trying to make what I would think would be a super simple file rename utility for a game I play. I've built the interface in Interface Builder (although the background image refuses to appear when I run the Simulator), and I've got the AppleScripts done; it's just putting it all together in Xcode and Interface Builder that's vexing me.

    To give you an idea of what the app does, here's how it works:

    When you launch the app, it brings up a small window with three elements: a decorative image (a PNG file), a label and a toggle button which, when pressed (and depending on the toggle state), runs one of two AppleScripts which rename some files and folders from one state to another.

    Here's the list of files and folders in state 1:

    ./gfx/FX/
    ./gfx/fonts/
    ./map/!!terrain/
    ./map/terrain/
    ./map/!!topology.bmp
    ./map/topology.bmp

    Here's the list of files and folders in state 2:

    ./gfx/!!FX/
    ./gfx/!!fonts/
    ./map/terrain/
    ./map/!!terrain/
    ./map/topology.bmp
    ./map/!!topology.bmp

    When the app launches, it should run a third AppleScript I've got that looks up the file names and sets the toggle state of the button based on whether ./gfx/FX/ exists or ./gfx/!!FX/ does. Then when you click the button it runs the file/folder rename AppleScript that corresponds to the appropriate state.

    So here's my questions:
    How do I get it to run the first AppleScript on launch to detect which toggle state it sets the button to and set the toggle state of the button based on the AppleScript's return code?
    How do I link the file rename AppleScripts to the button toggle states?
    How do I get the image to actually show up when I run it in the Simulator?

    Thanks in advance!
     
  2. c726e6f6e thread starter macrumors newbie

    Joined:
    Aug 27, 2004
    #3

Share This Page