I have an application that is a simple button pressing app. I’m going to add on to it as it starts to work.
My problem is that when it starts up, it says to press B (keyboard or screen), and when you do it, it beeps and tells you to press space. When I press space, nothing happens! It’s set up to do something. To download the project, click here or above on “an application.” Here is the code (also included in the project):
--
-- iQuestionAppDelegate.applescript
-- iQuestion
--
-- Created by Dylan Weber on Friday, April 2, 2010.
-- Copyright 2010 Dylan Weber. All rights reserved.
--
script iQuestionAppDelegate
property parent : class "NSObject"
property thelabel : missing value
property a : missing value
property b : missing value
property c : missing value
property d : missing value
property e : missing value
property f : missing value
property g : missing value
property h : missing value
property i : missing value
property j : missing value
property k : missing value
property l : missing value
property m : missing value
property n : missing value
property o : missing value
property p : missing value
property q : missing value
property r : missing value
property s : missing value
property t : missing value
property u : missing value
property v : missing value
property w : missing value
property x : missing value
property y : missing value
property z : missing value
on displaygood()
thelabel's setStringValue_(some item of {"Good.", "Great.", "Wonderful."})
if _a then
set theitem to "_a:"
end if
if _b then
set theitem to "_b:"
end if
if _c then
set theitem to "_c:"
end if
if _d then
set theitem to "_d:"
end if
if _e then
set theitem to "_e:"
end if
if _f then
set theitem to "_f:"
end if
if _g then
set theitem to "_g:"
end if
if _h then
set theitem to "_h:"
end if
if _i then
set theitem to "_i:"
end if
if _j then
set theitem to "_j:"
end if
if _k then
set theitem to "_k:"
end if
if _l then
set theitem to "_l:"
end if
if _m then
set theitem to "_m:"
end if
if _n then
set theitem to "_n:"
end if
if _o then
set theitem to "_o:"
end if
if _p then
set theitem to "_p:"
end if
if _q then
set theitem to "_q:"
end if
if _r then
set theitem to "_r:"
end if
if _s then
set theitem to "_s:"
end if
if _t then
set theitem to "_t:"
end if
if _u then
set theitem to "_u:"
end if
if _v then
set theitem to "_v:"
end if
if _w then
set theitem to "_w:"
end if
if _x then
set theitem to "_x:"
end if
if _y then
set theitem to "_y:"
end if
if _z then
set theitem to "_z:"
end if
set myTimer to NSTimer's scheduledTimerWithTimeInterval_target_selector_userInfo_repeats_(3, me, theitem, missing value, true)
end displaygood
on a_(sender)
if _a then
end if
end a_
on b_(sender)
if _b then
beep
thelabel's setStringValue_("Press \"Space\".")
set _space to true
end if
end b_
on c_(sender)
if _c then
end if
end c_
on d_(sender)
if _d then
end if
end d_
on e_(sender)
if _e then
end if
end e_
on f_(sender)
if _f then
end if
end f_
on g_(sender)
if _g then
end if
end g_
on h_(sender)
if _h then
end if
end h_
on i_(sender)
if _i then
end if
end i_
on j_(sender)
if _j then
end if
end j_
on k_(sender)
if _k then
end if
end k_
on l_(sender)
if _l then
end if
end l_
on m_(sender)
if _m then
end if
end m_
on n_(sender)
if _n then
end if
end n_
on o_(sender)
if _o then
end if
end o_
on p_(sender)
if _p then
end if
end p_
on q_(sender)
if _q then
end if
end q_
on r_(sender)
if _r then
end if
end r_
on s_(sender)
if _s then
end if
end s_
on t_(sender)
if _t then
end if
end t_
on u_(sender)
if _u then
end if
end u_
on v_(sender)
if _v then
end if
end v_
on w_(sender)
if _w then
end if
end w_
on x_(sender)
if _x then
end if
end x_
on y_(sender)
if _y then
end if
end y_
on z_(sender)
if _z then
end if
end z_
on space_(sender)
if _space then
beep
end if
end space_
on applicationWillFinishLaunching_(aNotification)
thelabel's setStringValue_("Press \"B\".")
set _b to true
end applicationWillFinishLaunching_
on applicationShouldTerminate_(sender)
-- Insert code here to do any housekeeping before your application quits
return current application's NSTerminateNow
end applicationShouldTerminate_
end script