I’ve been trying to setup an eMac with Tiger for my 2 year old son much like the aging Rev B iMac with Mac OS 9 that was used. I’m looking for a way to present a simplified game launcher like OS 9’s Launcher or preferably OS X’s Simple Finder. Simple Finder would work great except for the lockstep way it forces behavior like checksum verification for disk image mounting and other permission based issues with old classic apps.
I’ve decided to see if I can code a simple game launcher that looks/behaves like Simple Finder - a simple window with buttons of the application icons with filename below and prev/next controls and a set of direct links (1,2,3…) to the “pages” of all the games/apps at the bottom of the window. No scroll bars or other controls.
I don’t believe I need fancy interfaces for configuration. My thought was to read the contents of a folder that had aliases to the applescript apps that set the screen up, mount the disk images and run the games. I could configure the setup by adding or removing alias files. I do this now with Simple Finder but there have been too many issues to continue this way.
Is there any sample code for anything like this? Alternately does anyone know that this is really too much for AS and would require OBJ C or similar language?
Thanks in advance,
I am not an expert on AS Studio or the Simple Finder concept you implied in your post but in analyzing what you want to do, I think you can achieve it by creating a simple window interface in AppleScript Studio.
Basically, that’s all you would need. The simple window would have only buttons linked to the games application that would be launched or activated when clicked (or by using keyboard shortcuts).
If you have lots of games to link to, you can include a few buttons of the favorite games on the simple window and enable the activation of other games by clicking another button (“other games” button, for instance) which, when clicked, would open another window with button links to the other less important games.
I think that would be the general approach that I would use if I were you.
Hope this helps.
Forgot to add…you won’t need Obj-C or some esoteric programming methods to get this simple window up and running. Basically, if you just link the buttons to the games, make it “activate” the application and the game should launch. I know you can do it with a simple "activate"command.
Thanks for the reply archseed. If I’m understanding you correctly, I manually build a table of buttons that mimic the simple finder interface rather than reading in the directory listing.
Question: Can these “buttons” be displayed as icons? This is for a young child and the icons (pictures) are important.
Can you share any basic code that will get me started? I’ve managed to bung together some faceless scripts in AS to set the screen resolution, mount disk images, etc. The key here being faceless.
I think you can paste graphics on the button instead of plain text and the button should still work.
As for raw code, let me hack out a few simple buttons in a small window which would link-activate a particular application to give you a general idea. But give me a few days to do it as I am out of my office right now and may take time to get back to my Mac.
I am not back to my Mac yet but I thought I’d give you some ideas now that you can play around with.
I assume you already know the basics of creating windows in AS Studio and populating that window (usually we refer to it as window “main”) with buttons. To do what you want, i.e., you would have for each game a specific button that would launch the game application when clicked. They should be fairly straightforward to set up. Once you have buttons for each game in the window, connect them in the AppleScript pane accordingly (command-8 in the Interface Builder, I believe). In the IB, you will have to click some action check boxes (such as Click, Nib and then the AppleScript connection too).
To make the buttons launch the applications they are linked with, you would have to code as follows:
(Note: I am assuming only that you are setting up only two buttons. You can add as many buttons as you want. In example codes below, there is one button to activate “Safari” and another to activate “TextEdit”. The third button in the sample script below activates “iTunes” and is meant only to show you how to create a button with an image overlaid on it as you want to do for the games. Also, note that the image to be overlaid on the button that activates “iTunes” is, for this purpose, situated on the desktop. You can hardcode another path for the images if you wish).
property gameIcon : missing value
global safari_variable, textedit_variable, image_variable, my_Image
on awake from nib theObject
set safari_variable to "Safari"
set textedit_variable to "TextEdit"
set image_variable to "iTunes"
set pathToImage to path to desktop
set gameIcon to load image (POSIX path of pathToImage & "battleship.jpg")
set image of image view "my_Image" of window "main" to gameIcon
end awake from nib
on clicked theObject
set buttonName to the name of theObject as Unicode text
if buttonName is "activateSafari" then tell application the safari_variable to activate
if buttonName is "activateTextEdit" then tell application textedit_variable to activate
if buttonName is "imageButton" then tell application image_variable to activate
If you’re still not so sure of with overlaying buttons with graphics, you can refer to the following thread: http://bbs.applescript.net/viewtopic.php?id=12500. The only modification you will have to do after reading that thread is the coercion into POSIX path to get your image. If you don’t POSIX-coerce, you cannot get the image loaded and an error would occur telling you that the image variable (for instance gameIcon in the above code) is not defined.
If you have any further question, let me know. BTW, I can send you the sample code for the above AS Studio example by email if you wish but I will need to get back to my Mac to build the sample project in Xcode.
Thanks again. I didn’t want you to think I didn’t appreciate your help.
Currently I’m introducing myself to xcode, Obj-C, cocoa, etc. It’s going to take me a little longer to implement your advice without some hand-holding but I hope to be back in a few days with a report of success or some (hopefully) intelligent questions based on your generous input.