AppleScript and GUI

Discussion in 'Mac Programming' started by laur5730, Oct 31, 2009.

  1. macrumors newbie

    Joined:
    Oct 29, 2009
    #1
    Is it possible to make a GUI to an AppleScript I wrote?

    Because I want this is:

    Code:
    ------------
    |    [COLOR="Red"][3][/COLOR]    |       <--- My ultimate writing skill :)
    |    [COLOR="Red"][5][/COLOR]    |
    |    [COLOR="Red"][6][/COLOR]    |
    |__[Start]__|
    
    This is how the GUI should look like. 3 = X, 5 = Y, 6 = Z. So depends on what I wrote in my windows (The code) the script will change. Look in next code :)

    Code:
    tell application "TextEdit"
    activate
    end tell
    
    set [COLOR="Red"]x[/COLOR] to 3
    tell application "System Events"
    repeat x times
    keystroke "Hello"
    keystroke return
    end repeat
    end tell
    
    set [COLOR="Red"]y[/COLOR] to 5
    tell application "System Events"
    repeat y times
    keystroke "Hey there!"
    keystroke return
    end repeat
    end tell
    
    set [COLOR="Red"]z[/COLOR] to 6
    tell application "System Events"
    repeat z times
    keystroke "Last One"
    keystroke return
    end repeat
    end tell
    
    The red text what is variable in this script/application :)

    I hope very much this can be done. I have like 0.5% knowledge in AppleScript so I need to ask you gurus, hehe :p
     
  2. macrumors 603

    Joined:
    Aug 9, 2009
    #2
    When learning a language, it's best to follow a tutorial, rather than trying to do it entirely on your own. This is especially true if you know no other computer languages.

    Code:
    ------------
    |    [3]    |
    |    [5]    |
    |    [6]    |
    |__[Start]__|
    
    I can't tell what that's supposed to represent. Is it a window? If so what do the [3], [5], and [6] represent? Buttons? Selectable list items? Text-entry fields?
     
  3. thread starter macrumors newbie

    Joined:
    Oct 29, 2009
    #3
    It represents a text-entry field that will effect the AppleScript for what I write in the field. If you want me to draw a picture to show, I can do that :)
     
  4. macrumors 65816

    mysterytramp

    Joined:
    Jul 17, 2008
    Location:
    Maryland
    #4
    AppleScript has limited GUI options. "Display dialog" and "choose from list" are about it.

    If you're game, you can load Xcode (it's one of the optional installs on your OS X disk), which will give you full access to the operating system.

    There are other "wrappers" like Pashua that provide more of a UI without having to learn Xcode.

    mt
     
  5. thread starter macrumors newbie

    Joined:
    Oct 29, 2009
    #5
    I see now there is something called AppleScript Studio which is Xcode and AppleScript. So I searched for guides how to handle events when a button is pressed. But it seems they have removed it. Look at link, that was in 2008 so it is outdated, but that was how you did it...

    http://foolsworkshop.com/applescript/2008/05/activate-an-event-handler/
    that was before but it seems the AppleScript tab is gone...

    What should I do know to handle actions and events?

    Thanks in advance
     
  6. macrumors 6502a

    GorillaPaws

    Joined:
    Oct 26, 2003
    Location:
    Richmond, VA
    #6
    This is a good place to start.

    An btw, if you're still trying to bot WOW, there's a good chance you'll get caught and be perma-banned.
     
  7. thread starter macrumors newbie

    Joined:
    Oct 29, 2009
    #7
    I know there is a chance :D

    Ups, I have read a little for that link, but it does not help me here :(
     

Share This Page