Whenever I make a code it I willb e able to compile it in Xcode then when I press run nothing happens…It should open a window that shows records of happenings but it doesn’t, i have tried blue j. the later version but it is jsut meesed and nothing works… what is wrong??? any suggestions???
Model: G5 dual core
AppleScript: latest… I think…
Browser: Safari 417.8
Operating System: Mac OS X (10.4)
Hi,
It would help if you post part of the script, especially that part that deals with the opening of the window. As it is, it is hard to figure out completely what your problem might be.
Do you have your window designated as “visible whan launched”?
You said when you press something (I presume it’s a button) nothing happens. Do you have that button attached to a handler that specifies what todo “on clicked” the button?
Help us figure out your problem so we can help you.
Looking forward to your further posts.
archseed
Yes I do have it marked as “visible” but I mean when click “run” nothing happens.it doesn’t even open the small window that says recorded successfully at
with # of errors. My brother says that that version of xcode sucks and I should use blue jay but that is just so confusing and bugged.Here is the cde see what is wrong if anything is… when i run it in applescript it always runs and opens the window…(oh yah it is real short and sucks and doesn’t do much because I am a beginner, I started like a week ago…)
(* copyright © BJ creations *)
set dif1 to display dialog "What do you use?" buttons {"iMac", "Dell"}
set dif1_res to button returned of dif1
if dif1_res is "iMac" then
display dialog "Yay for you, you are an intelligent person who knows the right answers in life!"
else if dif1_res is "Dell" then
display dialog "You really don't know the difference between smart and dumb.You are obviously consumed by Bill Gaytes' wrath!!! Do yourself a favor, and buy a Mac, make the right choices!"
end if
Look it over and see if anything is wrong…
Model: G5 dual core
AppleScript: latest… I think…
Browser: Safari 417.8
Operating System: Mac OS X (10.4)
Hi,
Well, at least we are getting somewhere. Your script works as a pure AppleScript, I tried it.
As an AS Studio application, it should be fairly simple. I don’t know how you made up your window or how you want it done but this is how I would go about it - considering a very simple scenario as follows:
you want to create a window with buttons “Ask”, “Mac” and “Dell”. These buttons are to be attached to handlers (on clicked handlers typically) so that when these buttons are clicked, there will be a specific response based on the script that is attached to each button.
The general steps then are as follows (assuming that you have already built the window and the 3 buttons in it):
- make this window “visible” when launched so that it will show when you click on your program to run it. you do this in the Attribute pane for the window.
-so that the buttons will respond to action (events), click each button in the Interface Builder (IB) and then press command-8 to reveal the AppleScript pane. in this pane, for each button, check appropriate options such as nib, and action (click). these are the two most likely boxes you will check since you want to title each button when the program starts, and since you want the buttons to respond to click. also, in this pane you should give the name of the buttons (see the empty box at the very top of the pane) so that you can reference them in your script. for instance, you may refer to the one of the buttons as “mac_button”. then, when you want to work on that button, always refer to it but its button name “mac_button” (not “Mac” since Mac is only a button title).
-
below the portion of the pane that says “Event Handlers”, there is another section named “Script”. Check the box to the left of the name of your script. this insures that your application will be linked to your AppleScript codes. When you click this box, the handlers are automatically written for you in the script window such as handlers like “awake from nib-end awake” and “On clicked theObject - end clicked”. All you have to do is insert your appropriate scripts inside these handlers.
-
in the awake from nib handler, insert your script code to set the title of each button to “Mac”, “Dell” and “Ask”. these are only titles so that users can identify them. do not confuse this with the button name (like mac_button). they are different. your code to set the title may be: [set title of button “mac_button” of window “main” to “Mac”].
-
now to get some action when each button is clicked, go the “on clicked theObject” handler in the script editing window and insert the appropriate codes for each button. for instance, you may have some codes like below in the “on clicked theObject” handler:
on clicked theObject
if the name of the button is “mac_button” then display dialog “Great! Youj have made the right choice!”
or
if the name of the button is “ask_button” then display dialog “Please choose your preference for computers by clicking the specific button in the window.” buttons {“OK”} giving up after 3 with icon 1
--in this same on clicked block, enter the codes for the remaining button (dell_button).
end clicked
-
given the above, you should be able to create a window with functioning buttons easily.
i hope the above general guidelines would give you a headstart. the general idea is for every object you have on your window, they should be attached to specific handlers for them to respond to your AppleScript commands.
good luck!
archseed
Thx it really helped I have gotten xcode to work after fiddling for a couple hours and i am making templates buttons ond icons. You were a great help!
Model: G5 dual core
AppleScript: latest… I think…
Browser: Safari 417.8
Operating System: Mac OS X (10.4)