PDA

View Full Version : AppleScript and GUI




laur5730
Oct 31, 2009, 04:28 PM
Is it possible to make a GUI to an AppleScript I wrote?

Because I want this is:


------------
| [3] | <--- My ultimate writing skill :)
| [5] |
| [6] |
|__[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 :)


tell application "TextEdit"
activate
end tell

set x to 3
tell application "System Events"
repeat x times
keystroke "Hello"
keystroke return
end repeat
end tell

set y to 5
tell application "System Events"
repeat y times
keystroke "Hey there!"
keystroke return
end repeat
end tell

set z 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



chown33
Oct 31, 2009, 06:11 PM
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.

------------
| [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?

laur5730
Oct 31, 2009, 06:17 PM
------------
| [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?

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 :)

mysterytramp
Nov 1, 2009, 06:26 AM
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

laur5730
Nov 1, 2009, 06:49 AM
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

GorillaPaws
Nov 1, 2009, 07:04 AM
This (http://developer.apple.com/mac/library/documentation/AppleScript/Conceptual/AppleScriptX/AppleScriptX.html) 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.

laur5730
Nov 1, 2009, 08:02 AM
This (http://developer.apple.com/mac/library/documentation/AppleScript/Conceptual/AppleScriptX/AppleScriptX.html) 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.

I know there is a chance :D

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