TweetFollow Us on Twitter

Launch Doc
Volume Number:2
Issue Number:2
Column Tag:Assembly Lab

Launch Doc Utility in MacAsm

By Paul F. Snively, Columbus, IN, MacTutor Contributing Editor

Whew! This program, which started out being a simple little thing, got complicated in a hurry!

Welcome to Launch Doc, the MacTutor document launching utility.


A little bit of background is in order. I recently acquired a 512K upgrade for what I had affectionately dubbed my "Meager Mac." Needless to say, one of the more exciting things about owning a Fat Mac is having the ability to run Switcher. I had a copy of Switcher 2.0 (ancient history, yes, I know) lying around which I immediately started tinkering with.

It didn't take long to discover Switcher's ability to create "sets" which, when double-clicked from the Finder, would launch all of my favorite applications. Now a problem arose: how do you specify an application's document ("Write/Paint Set," for example) as the startup application?

Answer: you don't, unfortunately. This frustrated me; it would have been really nice to be able to launch my set automatically upon bootup.

Hang on when you double-click a document icon in Finder it knows what application to launch. Why not do something similar, like write an application which maintains a document name and, when executed (excuse me, launched), determines the owner and launches it (passing it a Finder Info handle to the document).

Well, that's the story of Launch Doc in a nutshell. It's probably worth pointing out that the version of Switcher that I now have (4.4) allows you to start up with Switcher and your favorite set simply by calling the set "Switcher.StartUp." If you have a set by that name and make Switcher the startup application, booting that disk will get you into whatever applications you have in the set. Thanks, Andy.

This doesn't make Launch Doc useless, though. If nothing else, Launch Doc came in handy during the last stages of its own development, since I used it to cause its own source code to be launched whenever I booted the disk. Furthermore, I use Launch Doc to launch another very long term document/application: my saved game for Infocom's A Mind Forever Voyaging!

Now for an overview:

There are two INCLUDE directives in the source. The first is a must, the second is convenient, but only possible on a 512K or higher machine. Failing a 512K system, list the file and find the EQUates for CurApName and AppParmHandle. They're used by Launch Doc. Use the equates instead of the include.

The globals are straightforward and minimal: a launch parameter block, room for a pointer, and room for a short (64 character, counting the length byte) string.

The source assembles to "Buffer.Bin" and resource compiles to "Launch Doc." The type is APPL (naturally), the creator is LDOC, and the Finder flags are $2000 (the bundle bit is set).

The resources follow. First is the signature. Any Mac application that has its own icon must have a signature, the icon(s), FREF(s), and a BNDL.

The icon list follows. I cannot tell a lie: I design my icons last, and for testing purposes use a solid black icon. After the code is done, I use ResEdit to create my real icon. I then launch the application under TMON, use the Load Res user area routine to load the ICN# for the application, and print a dump of the hex codes that make up the icon and its mask. I then go back and edit the source to reflect the object code. It almost takes longer to describe than to do, and as far as I'm concerned, it's quicker than using icon editors and converters! [Note: Chris Yerga's nifty icon converter package in assembly might change your mind. It produces source code listings from icon binary files. See MacTutor, Jan. 1986.-Ed]

Next comes the FREF (file reference) resource. There's only one file to refer to with Launch Doc: the application itself. Its local ICN# ID is 0.

Next is the bundle. This is necessary for the Finder to install the program on the desktop.

The remaining resources are the elements of Launch Doc's user interface. Ideally, the only one of these items that you will ever see is the dialog box, which is used to edit the name of the document to launch. The alert boxes are error messages; they let you know that something has gone wrong somewhere. Possible error conditions include errors writing the document name to disk (most likely a disk full error), an inability to read the file information for the document (the specified document probably isn't on the default volume or the document name is null), an inability to launch applications (why would you want to? I don't call it Launch Doc for nothin'), and an inability to find the application that created the document (the document is on the volume but the application isn't).

The main program is largely a collection of subroutine calls. Ordinarily this would be considered good design, but it did cause some problems. My code could be politely described as "workmanlike," and if I weren't already past deadline I'd take a stab at cleaning it up. This is left as an exercise for the reader.

First all of the managers are initialized with the exception of the window manager. I wanted to avoid a double-flicker effect from launching Launch Doc and then launching another application in rapid succession. The result was several _InitWindows throughout the code (anytime a dialog or alert is about to come up), but I think it was worth it.

GetDocName is an interesting routine. Something that most Mac programmers are aware of, but not many seem to use, is that an application can have a data fork as an integral part of the application. This is great for programs that only need one data file. Since I wanted to save a document name on a continuing basis, using Launch Doc's own data fork seemed like a good idea. This idea is not original with me; the public domain game Megaroids uses the same technique to save the high score. GetDocName opens the data fork of the current application (by using the system global CurApName) and tries to read the first 64 bytes of the data fork into the FileName global. If the read fails, the routine CLR.B's FileName (effectively creating a zero-length string). In any event, the local variable structure is dropped and the routine returns.

'EditMaybe' is the heart of the user interface to Launch Doc. EditMaybe determines whether the mouse button is being held down. If it is not, EditMaybe closes Launch Doc's data fork and returns, otherwise it tosses up a dialog box showing the current document name and allowing the user to edit it and save it or exit to the Finder.

How? First the _GetNewDialog trap is used to bring up the dialog box. _GetDItem is used to get the handle to item #4 (the editable text item). _SetIText is used to set the dialog's text equal to the string in the FileName global. _SelIText is used to select the whole item for editing. Finally, _ModalDialog is used to interact with the user. Thanks to the fact that all other items are disabled, only clicking on the buttons or pressing Return or Enter has any effect.

You may have noticed the flim-flamming around with the stack on some of the dialog related toolbox traps. The reason for this is that the toolbox wants pointers to the parameters, not the parameters themselves. Since I refuse to allocate global space for something that is only going to be thrown away (as a great deal of the _GetDItem info is), I just allocated space on the stack and then used the PEA x(SP) instructions to push pointers to them. It necessitates some extra mental keeping track of the stack, but it's worth it - the end result is that the results are on the stack, where they should be.

_SetIText simply sets a text item to the string passed to it. It is used in this instance to make the editable text item in the dialog equal to the document name which was read from the data fork.

_SelIText is used to select any portion (or all) of an editable text item. I used it to select the entire name. This causes the dialog to behave in much the same manner as the Standard File package or Disk Initialization package, both of which select the entire name on editable items. The reason for this is that the user, if he or she is going to change anything, is likely to change the whole thing.

_ModalDialog is then used to interact with the user. The editable text is disabled, so it can be edited without returning to the caller every time an event occurs in that field (we don't care abou individual events; we only care about the end result). Pressing Return or Enter has the same effect as clicking on the OK button.

If the user selects OK, EditMaybe uses the _GetIText toolbox trap to read the newly edited (maybe) filename into the FileName global. It then uses the _Write OS trap to write the string back out to the data fork of Launch Doc. If there was a problem with the write, an alert is displayed. EditMaybe _Closes the file, checks D4 to see what it should do upon returning, and returns.

If the user selects Finder, EditMaybe closes the data fork, checks D4 and returns.

If Finder was hit or there was a _Write error, the Z flag will be set upon returning from EditMaybe and Launch Doc will RTS its way to the Finder. Otherwise GetDocInfo will be called.

GetDocInfo uses _GetFileInfo to determine two very pertinent pieces of information about the document to launch: its type and creator.

If there was a problem getting the info, an alert box tells the story. If you try to launch an application with Launch Doc (type = APPL), the same thing happens.

LoadFileInfo is interesting. There is a little known access method on the Macintosh which uses a parameter called ioFDirIndex, which is neither more nor less than the number of the file on the volume. It so happens that the _GetVolInfo OS trap returns, among other things, the number of files on the volume. Armed with that information and the ioFDirIndex means of using _GetFileInfo, LoadFileInfo can get the info on every file on the volume without having to know a single filename. First, it determines how many files are on the volume. It then allocates a pointer large enough to hold all of the information for all of the files. A simple loop then reads the info into the block.

FindAppl searches the block containing the file info for a file whose creator matches the creator of the document and whose type is APPL. If it fails to find such a file, an alert gives the user the message, otherwise _GetFileInfo is used (again), this time with a pointer to a block for the name, which is what we really need (for _Launch).

BuildFInfo customizes the Finder Info handle to represent the fact that we want to open a document of whatever type is in D6. We only want to open one file, and it's on the default volume. The file version number is zero (it always is, according to IM) and the name is given.

Upon returning from BuildFInfo, Launch Doc points A0 to the _Launch parameter block, which in turn points to the name of the application to launch. Launch Doc configures the parameter block to use the standard screen and sound buffers, and _Launch is called.

That's it! Thanks to BuildFInfo, the application will behave exactly as if you had double-clicked on the document's icon from the Finder.

The major concepts embodied in Launch Doc are the use of the _GetDItem, _SetIText, _GetIText, and _SelIText traps for altering the contents of dialog boxes, the use of the data fork of an application for storing recurrent but changing program globals (you could, of course, save the entire global variable area in the data fork if you needed to), and building the Finder Info handle so that the application is forced to open the document. I think that the source code is well-documented; practically every line is commented and major routines are preceded by a block of comments.

Well, Andy Hertzfeld has made my original motivation for writing Launch Doc obsolete, but I'm sure that there will be other utilities that I will want to launch a document for upon bootup, and perhaps you will think of some too!

;SAVE "Launch Doc.Asm"
*Launch Doc
*Copyright (c) 1985
*Written 10/85 by Paul F. Snively
*This utility maintains a document file
*name internally which it uses to find
*the name of the application that created it.
*It then creates a "Finder Information Handle"
*which it passes to the application as it launches
*it, thereby causing the application to open the
*specified document.  The primary reason for this
*is that documents can't be specified as the startup
*application with the Set Startup function in the
*Special menu.
*Why would you want to start up under a document?
*Easy.  If you have Switcher, you probably have at
*least one disk with a couple of your favorite
*applications, Switcher, and a Switcher document
*that, when double-clicked, launches your applications
*under Switcher.  Wouldn't it be nice to be able to specify
* that Switcher document as the startup application?
*"Mater artium necessitas."
*- Latin proverb

INCLUDE "Library.Asm"
INCLUDE "Equates.Asm";Only with 512K!
 DEFV 8,LParmBlk ;Launch parameter block
 DEFV L,FileList ;Pointer to start of file list
 DEFV 64,FileName;Name of document
 TFILE  "Buffer.Bin"
 RFILE  "Launch Doc",APPL,LDOC,$2000
 STR  "Launch Doc 1.0 Copyright (c) 1985 MacTutor"
 RSRC ICN#,128
 HEX  000011B8 09F777C8
 HEX  09F007C8 09FFBFC8
 HEX  09E003C8 08E00388
 HEX  08400108 0FFFFFF8
 ASC  "APPL";File type
 DATA /0;ICN# localID
 STR  "";File name
 ASC  "LDOC";Signature
 DATA /0;Res ID of autograph
 DATA /2-1;# of res types - 1
 ASC  "FREF";Res type
 DATA /1-1;# of res's - 1
 DATA /0;localID
 DATA /128;Res ID
 ASC  "ICN#";Res type
 DATA /1-1;# of res's - 1
 DATA /0;localID
 DATA /128;Res ID
 DATA /100,/100,/190,/400 ;boundsRect
 DATA /1;procID
 DATA #1,#0 ;visible,unused
 DATA #0,#0 ;goAwayflag,unused
 DATA 0 ;refCon
 DATA /256;itemsID
 STR  "";title
 DATA /100,/100,/170,/400 ;boundsRect
 DATA /257;itemsID
 DATA /%0101010101010101  ;stages
 DATA /100,/100,/170,/400 ;boundsRect
 DATA /258;itemsID
 DATA /%0101010101010101  ;stages
 DATA /100,/100,/180,/400 ;boundsRect
 DATA /259;itemsID
 DATA /%0101010101010101  ;stages
 DATA /100,/100,/180,/400 ;boundsRect
 DATA /260;itemsID
 DATA /%0101010101010101  ;stages
 DATA /4-1;# of items - 1
 DATA 0 ;Placeholder for item handle
 DATA /70,/20,/90,/80;Display rectangle
 DATA #4;item type (button)
 STR  "OK";button contents
 DATA 0 ;Placeholder for item handle
 DATA /70,/100,/90,/170 ;Display rectangle
 DATA #4;item type (button)
 STR  "Finder"   ;button contents
 DATA 0 ;Placeholder for item handle
 DATA /10,/10,/29,/250  ;Display rectangle
 DATA #8+128
 STR  "The current document to launch is:"   ;statText
 DATA 0 ;Placeholder for item handle
 DATA /39,/10,/56,/250  ;Display rectangle
 DATA #16+128
 STR  "";editText
 DATA /2-1;# of items - 1
 DATA 0 ;Placeholder for item handle
 DATA /45,/230,/65,/290 ;Display rectangle
 DATA #4;item type (button)
 STR  "OK";button contents
 DATA 0 ;Placeholder for item handle
 DATA /10,/55,/29,/325  ;Display rectangle
 DATA #8+128;item type (statText)
 STR  "I couldn't save the document name!"
 DATA /2-1;# of items - 1
 DATA 0 ;Placeholder for item handle
 DATA /45,/230,/65,/290 ;Display rectangle
 DATA #4;item type (button)
 STR  "OK";button contents
 DATA 0 ;Placeholder for item handle
 DATA /10,/55,/29,/325  ;Display rectangle
 DATA #8+128;item type (statText)
 STR  "I couldn't get info on the document!"
 DATA /2-1;# of items - 1
 DATA 0 ;Placeholder for item handle
 DATA /55,/230,/75,/290 ;Display rectangle
 DATA #4;item type (button)
 STR  "OK";button contents
 DATA 0 ;Placeholder for item handle
 DATA /10,/55,/51,/325  ;Display rectangle
 DATA #8+128;item type (statText)
 STR     "I can only launch documents, not applications!"
 DATA /2-1;# of items - 1
 DATA 0 ;Placeholder for item handle
 DATA /55,/230,/75,/290 ;Display rectangle
 DATA #4;item type (button)
 STR     "OK"    ;button contents
 DATA 0 ;Placeholder for item handle
 DATA /10,/55,/51,/325  ;Display rectangle
 DATA #8+128;item type (statText)
 DATA #58 ;String length
 ASC  "I couldn't find the application "
 ASC  "that created the document!"
 SEG  1,52
START BSR InitManagers  ;Standard Initialization
 BSR  GetDocName ;Get name of document
 BSR  EditMaybe  ;Allow for opportunity to edit
 BNE.S  NoExit ;We don't want to leave yet
Exit  RTS ;This gets us back to Finder
NoExit  BSR GetDocInfo  ;Get document information
 BNE.S  Exit;If there was a problem
 BSR  LoadFileInfo ;Get the goods on all files
 BSR  FindAppl ;Find the application for doc
 BNE.S  Exit;If there was a problem
 BSR  BuildFInfo ;Build Finder Info Handle
 LEA  LParmBlk(A5),A0;Point to launch parm blk
 MOVE.L #$0000,4(A0) ;Screen,sound buffers
 TBX  Launch;And launch it!
* InitManagers:  This routine initializes all major  managers
*except for the Window Manager, which is done in
*EditMaybe if necessary.  The reason for this is
*that in most instances Launch Doc will simply do
*its thing (which involves no video output at all)
*and since the application that it launches will
*undoubtedly do an _InitWindows, the double flash
*would be both annoying and redundant.
InitManagersPEA  -4(A5) ;Standard Init Sequence
 TBX    InitGraf ;Init QuickDraw
 TBX    InitFonts;Init Font Manager
 MOVE.L #$0000FFFF,D0;Flush all events
 OST    FlushEvents
 CLR.L  -(SP)  ;No restart procedure
 TBX    InitDialogs;Init Dialog Manager
 TBX    TEInit ;Init Text Edit
 TBX    InitCursor ;Use arrow cursor
* GetDocName:  Reads the document name into a global
*string variable from the data fork of the application.
* Uses: A0,A1,A6,D3
GetDocName   LINKA6,#-50  ;50 bytes of local vars
 LEA    -50(A6),A0 ;Point to data structure
 CLR.W  22(A0) ;Use default volume
 CLR.B  26(A0) ;File version 0
 CLR.L  28(A0) ;Use vol buffer
 LEA    CurApName,A1
 MOVEA.LA1,18(A0);Use current appl name
 OST    Open;Open the file
 MOVE.W 24(A0),D3;ioRefNum
 MOVE.L #64,36(A0) ;Try to read 64 bytes
 LEA    FileName(A5),A1
 MOVEA.LA1,32(A0);Where to store 64 bytes
 MOVE.W #1,44(A0);Relative to beginning of file
 MOVE.L #0,46(A0);Very beginning of file
 OST    Read;Read the document name
 TST.W  16(A0) ;Everything OK?
 BEQ.S  .1;Go if so
 CLR.B  FileName(A5) ;Else make null string
.1 UNLK A6;Drop data structure
 RTS    ;And return to caller
* EditMaybe:A complex routine that checks if the mouse
*button is being held down and, if it is, opens a
*dialog box which displays the current document
*to launch and allows the user to edit it.  If the
*user clicks OK, the new filename is written to the
*data fork of the application.  Otherwise, the write
*is bypassed.  A flag is set accordingly, which upon
*returning from the subroutine will either dump the
*user back into the Finder or continue with the launch.
* Uses: A0,A1,A2,A6,D4,D5,D6
EditMaybe LINK A6,#-50  ;50 bytes of local variables
 LEA    -50(A6),A2 ;Point to data structure
 CLR.W  -(SP)  ;Room for toolbox Boolean
 TBX    Button ;Is the mouse button down?
 MOVE.W (SP)+,D4 ;Retrieve result
 BEQ    .2;Go if no mouse down
 TBX    InitWindows;Needed for dialog box
 CLR.L  -(SP)  ;Room for result
 MOVE.W #$100,-(SP);Dialog # 256
 CLR.L  -(SP)  ;Let system allocate memry
 MOVE.L #-1,-(SP);Put in front
 TBX    GetNewDialog ;Get the dialog box
 MOVE.L (SP)+,D5 ;Get result (Dialog Ptr)
 CLR.W  -(SP)  ;Room for itemType
 CLR.L  -(SP)  ;Room for itemHandle
 CLR.L  -(SP)  ;Room for dispRect
 CLR.L  -(SP)
 MOVE.L D5,-(SP) ;Dialog Ptr to stack
 MOVE.W #4,-(SP) ;Item # 4 (Editable Text)
 PEA    18(SP) ;ADDR of itemType
 PEA    18(SP) ;ADDR of itemHandle
 PEA    14(SP) ;ADDR of dispRect
 TBX    GetDItem ;Get Dialog Item
 MOVE.L 8(SP),D6 ;Get handle
 ADD.W  #14,SP ;Drop result
 MOVE.L D6,-(SP) ;Handle to Item
 PEA    FileName(A5) ;String
 TBX    SetIText ;Make Text Item = File Name
 MOVE.L D5,-(SP) ;Dialog Ptr to stack
 MOVE.W #4,-(SP) ;Item #4 (Editable Text)
 MOVE.W #0,-(SP) ;From position 0
 MOVE.W #64,-(SP);To position 64 (whole thing)
 TBX    SelIText ;Select the text
 CLR.W  -(SP)  ;Room for result of dialog
 CLR.L  -(SP)  ;No filter proc
 PEA    4(SP)  ;Ptr to result
 TBX    ModalDialog;Get answer from user
 MOVE.W (SP)+,D4 ;Get result of Modal Dialog
 SUBQ.W #1,D4  ;Will be EQ on "OK"
 BNE    .1;Bypass write
 MOVE.L D6,-(SP) ;Handle to text item
 PEA    FileName(A5) ;String 255 of File Name
 TBX    GetIText ;Get the new File Name
 CLR.L  12(A2) ;No completion routine
 MOVE.W D3,24(A2);ioRefNum
 LEA    FileName(A5),A1   ;Point to buffer
 MOVE.L A1,32(A2);Buffer to write from
 MOVE.L #64,36(A2) ;Write 64 bytes
 MOVE.W #1,44(A2);Relative to start of file
 MOVE.L #0,46(A2);Beginning of file
 MOVEA.LA2,A0  ;Move to A0 for OSTrap
 OST    Write  ;Write string
 MOVE.W 16(A2),D4;Is everything OK?
 BEQ    .1;Go if ok (Z set)
 CLR.W  -(SP)  ;Room for result of alert
 MOVE.W #$101,-(SP);Alert # 257
 CLR.L  -(SP)  ;No filter proc
 TBX    StopAlert;Do Alert
 ADDQ.W #2,SP  ;Drop result
.1 MOVE.L D5,-(SP) ;Dialog Ptr to stack
 TBX    DisposDialog ;Done with dialog
.2 CLR.L12(A2) ;No completion routine
 MOVE.W D3,24(A2);ioRefNum
 MOVEA.LA2,A0  ;Move to A0 for OSTrap
 OST    Close  ;Close the file
 TST.W  D4;Set flags
 UNLK A6;Drop data structure
 RTS    ;And return to caller
* GetDocInfo:  A routine which determines the type and
* creator of the document to launch.  It returns the type in D6
* and the creator in D7.
* Uses: A0,A1,A6,D0,D6,D7
GetDocInfoLINK A6,#-80  ;80 bytes of local variables
 LEA    -80(A6),A0 ;Point to data structure
 CLR.L  12(A0) ;No completion routine
 LEA    FileName(A5),A1 ;Pointer to filename
 MOVE.L A1,18(A0);Put pointer in data structure
 CLR.W  22(A0) ;Use default volume
 CLR.B  26(A0) ;File version # 0
 CLR.W  28(A0) ;Index # 0
 OST    GetFileInfo;Get the information
 MOVE.L 32(A0),D6;Get file type
 MOVE.L 36(A0),D7;Get file creator
 TST.W  16(A0) ;What was the result?
 BEQ.S  .1;Go if no problem
 TBX    InitWindows;Needed if not done before
 CLR.W  -(SP)  ;Room for result of alert
 MOVE.W #$102,-(SP);Alert # 258
 CLR.L  -(SP)  ;No filter proc
 TBX    StopAlert;Do Alert
 ADDQ.W #2,SP  ;Drop result
 BRA.S  .3;Exit this routine
.1 CMP.L#$4150504C,D6;Is type = APPL?
 BNE.S  .2;If not, go ahead
 TBX    InitWindows;Needed if not done before
 CLR.W  -(SP)  ;Room for result
 MOVE.W #$103,-(SP);Alert # 259
 CLR.L  -(SP)  ;No filter proc
 TBX    StopAlert;Do Alert
 ADDQ.W #2,SP  ;Drop result
.3 MOVE.L #-1,D0 ;Reset Z flag
 BRA.S  .4;Leave
.2 MOVE.L #0,D0  ;Set Z flag
.4 UNLK A6;Drop data structure
 RTS    ;And return to caller
* LoadFileInfo:  A routine which loads all of the information
*on all of the files on the default volume.  Uses the
*not well known "ioFDirIndex" access mode to get
*info without knowing filenames.
* Uses: A0,A6,D0,D3
LoadFileInfoLINK A6,#-64  ;64 bytes of local variables
 LEA    -64(A6),A0 ;Point to data structure
 CLR.L  12(A0) ;No completion routine
 CLR.W  22(A0) ;Default volume
 CLR.W  28(A0) ;Use ioVRefNum only
 OST    GetVolInfo ;Get the volume info
 MOVE.W 40(A0),D3;Get # of files on volume
 MOVE.W D3,D0  ;Copy it to D0
 EXT.L  D0;Make it long
 MULU #80,D0;How much room for file info
 OST    NewPtr ;Create new pointer
 MOVE.L A0,FileList(A5) ;Save pointer
.1 CLR.L12(A0) ;No completion routine
 CLR.L  18(A0) ;NIL name pointer
 CLR.W  22(A0) ;Use default volume
 CLR.B  26(A0) ;File version # 0
 MOVE.W D3,28(A0);ioFDirIndex # goes here
 OST    GetFileInfo;Get the file information
 ADDA.L #80,A0 ;Point to next block
 SUBQ #1,D3 ;Next file #
 BNE.S  .1;Do it again
 UNLK A6;Drop data structure
 RTS    ;And return to caller
* FindAppl: A routine which searches the file info list for
*the application which created the document to launch.
* Uses: A0,A1,D0
FindApplMOVEA.L  FileList(A5),A0 ;Get pointer
 OST    GetPtrSize ;How big is block?
 MOVEA.LD0,A1  ;Move size to A1
 ADDA.L A0,A1  ;Point past end of block
.1 CMP.L36(A0),D7;Same creator?
 BEQ.S  .2;Go if so
.4 ADDA.L #80,A0 ;Next info block
 CMPA.L A0,A1  ;Done?
 BNE.S  .1;If not, continue
 TBX    InitWindows;Needed if not done before
 CLR.W  -(SP)  ;Room for result of alert
 MOVE.W #$104,-(SP);Alert # 260
 CLR.L  -(SP)  ;No filter proc
 TBX    StopAlert;Do Alert
 ADDQ.W #2,SP  ;Drop result
 MOVEQ  #-1,D5 ;Reset Z flag
.3 MOVE.L FileList(A5),A0 ;Get pointer
 OST    DisposPtr;Get rid of it
 TST.L  D5;Set flags
 RTS    ;Return to caller
.2 CMP.L#$4150504C,32(A0) ;Is type APPL?
 BNE.S  .4;Go if not
 MOVEA.LA0,A1  ;Copy pointer
 MOVE.L #64,D0 ;64 byte block
 OST    NewPtr ;Make new pointer
 MOVE.L A0,18(A1);Store the pointer
 MOVE.L A1,A0  ;Back to A0
 OST    GetFileInfo;Get the name this time
 MOVE.L 18(A0),LParmBlk(A5) ;Move pointer to globals
 CLR.L  D5;Set Z flag
 BRA.S  .3;Exit
* BuildFInfo:  A routine which builds the Finder Info handle to
*pass to the application, causing it to open the
*specified document.
* Uses: A0,A1,D0
BuildFInfo  MOVEA.L  AppParmHandle,A0  ;Finder info handle
 MOVE.L #13,D0   ;Constant size value
 ADD.B  FileName(A5),D0 ;Adjust for filename len.
 OST    SetHandleSize;Set the handle size
 MOVEA.L(A0),A1  ;Dereference the handle
 CLR.W  (A1);Open file
 MOVE.W #1,2(A1) ;One file
 CLR.W  4(A1)    ;Default volume
 MOVE.L D6,6(A1) ;File type
 CLR.B  10(A1)   ;File version # 0
 MOVE.B FileName(A5),D0 ;Length of filename
 ADDQ #1,D0 ;Add one for length byte
 LEA    12(A1),A1;Point to filename area
 LEA    FileName(A5),A0 ;Point to filename
 OST    BlockMove;Move the name
 RTS    ;Return to caller
 SEG  0,32,VAR.LEN,$20
Apple Inc.
Microsoft Corpora
Google Inc.

MacTech Search:
Community Search:

Software Updates via MacUpdate

Herald 5.0.1 - Notification plugin for M...
Note: Versions 2.1.3 (for OS X 10.7), 3.0.6 (for OS X 10.8), and 4.0.8 (for OS X 10.9) are no longer supported by the developer. Herald is a notification plugin for, Apple's Mac OS X email... Read more
Firetask 3.7 - Innovative task managemen...
Firetask uniquely combines the advantages of classical priority-and-due-date-based task management with GTD. Stay focused and on top of your commitments - Firetask's "Today" view shows all relevant... Read more
TechTool Pro 7.0.6 - Hard drive and syst...
TechTool Pro is now 7, and this is the most advanced version of the acclaimed Macintosh troubleshooting utility created in its 20-year history. Micromat has redeveloped TechTool Pro 7 to be fully 64... Read more
PhotoDesk 3.0.1 - Instagram client for p...
PhotoDesk lets you view, like, comment, and download Instagram pictures/videos! (NO Uploads! / Image Posting! Instagram forbids that! AND you *need* an *existing* Instagram account). But you can do... Read more
SuperDuper! 2.7.3 - Advanced disk clonin...
SuperDuper! is an advanced, yet easy to use disk copying program. It can, of course, make a straight copy, or "clone" -- useful when you want to move all your data from one machine to another, or do... Read more
MacJournal 6.1.5 - Create, maintain, and...
MacJournal is the world's most popular journaling software for the Mac. MacJournal 6 adds a calendar mode that show entries from any journal, geolocation, word count, and progress tracking, as well... Read more
Skim 1.4.10 - PDF Reader and note-taker...
Skim is a PDF reader and note-taker for OS X. It is designed to help you read and annotate scientific papers in PDF, but is also great for viewing any PDF file. Skim includes many features and has a... Read more
FontExplorer X Pro 4.2.2 - Font manageme...
FontExplorer X Pro is optimized for professional use; it's the solution that gives you the power you need to manage all your fonts. Now you can more easily manage, activate and organize your... Read more
SoftRAID 5.0.5 - High-quality RAID manag...
SoftRAID allows you to create and manage disk arrays to increase performance and reliability. SoftRAID's intuitive interface and powerful feature set makes this utility a must have for any Mac OS X... Read more
DEVONthink Pro 2.8.2 - Knowledge base, i...
Save 10% with our exclusive coupon code: MACUPDATE10 DEVONthink Pro is your essential assistant for today's world, where almost everything is digital. From shopping receipts to important research... Read more

Latest Forum Discussions

See All

Weather or Not - Reports and Forecasts...
Weather or Not - Reports and Forecasts for your Calendar 1.0.0 Device: iOS iPhone Category: Weather Price: $2.99, Version: 1.0.0 (iTunes) Description: Weather or Not is a beautiful and intuitive way to check the weather and... | Read more »
Sago Mini Road Trip (Education)
Sago Mini Road Trip 1.0 Device: iOS Universal Category: Education Price: $2.99, Version: 1.0 (iTunes) Description: Go for a fun-filled drive with Jinja the cat. Pick a destination, select a vehicle and hit the road. What will Jinja... | Read more »
New Tower Defense Game, Kingdom Rush: Or...
New Tower Defense Game, Kingdom Rush: Origins, is Available Today Posted by Jessica Fisher on November 20th, 2014 [ permalink ] iPad Only App - Designed for the iPad | Read more »
Sunburn! (Games)
Sunburn! 1.0.0 Device: iOS Universal Category: Games Price: $2.99, Version: 1.0.0 (iTunes) Description: Your ship is gone. Your crew is scattered. One option remains. Gather your crew... and jump into the sun. Reunite your... | Read more »
Tapventures Review
Tapventures Review By Jennifer Allen on November 20th, 2014 Our Rating: :: ODDLY COMPELLINGUniversal App - Designed for iPhone and iPad Tapventures is an increasingly hands-off one-tap RPG, but expect it to hook you despite your... | Read more »
Who Wore it Best? The Hunger Games: Girl...
With The Hunger Games: Mockingjay Part 1 out this weekend, Who Wore it Best? pits two Hunger Games tie-ins, Girl on Fire and Panem Run, against each other in a brutal and pointless fight to the death. I wonder where we got that idea from? | Read more »
Ironkill Review
Ironkill Review By Jennifer Allen on November 20th, 2014 Our Rating: :: LACKLUSTER PUNCHINGUniversal App - Designed for iPhone and iPad Ironkill is a freemium focused fighting game that doesn’t offer particularly thrilling fights... | Read more »
Real-Time Multiplayer Match-3 RPG Crusad...
Real-Time Multiplayer Match-3 RPG Crusaders Quest Set to Launch Next Month Posted by Ellis Spice on November 20th, 2014 [ permalink ] | Read more »
Checkpoint Champion Review
Checkpoint Champion Review By Jennifer Allen on November 20th, 2014 Our Rating: :: SPEEDY DRIFTINGUniversal App - Designed for iPhone and iPad Checkpoint Champion is a drift-focused racing game that’s ideal for short but fun gaming... | Read more »
MediaFire iOS 8 Native Update Brings New...
MediaFire iOS 8 Native Update Brings New “Power Upload” Feature to iPad and iPhone Posted by Jessica Fisher on November 20th, 2014 [ | Read more »

Price Scanner via

64GB iPod touch on sale for $249, save $50
Best Buy has the 64GB iPod touch on sale for $249 on their online store for a limited time. Their price is $50 off MSRP. Choose free shipping or free local store pickup (if available). Sale price for... Read more
15″ 2.2GHz Retina MacBook Pro on sale for $17...
 B&H Photo has the 2014 15″ 2.2GHz Retina MacBook Pro on sale for $1799.99 for a limited time. Shipping is free, and B&H charges NY sales tax only. B&H will also include free copies of... Read more
New Logitech AnyAngle Case/Stand Brings Flexi...
Logitec has announced the newest addition to its suite of tablet products — the Logitech AnyAngle. A protective case with an any-angle stand for iPad Air 2 and all iPad mini models, AnyAngle is the... Read more
2013 15-inch 2.0GHz Retina MacBook Pro availa...
B&H Photo has leftover previous-generation 15″ 2.0GHz Retina MacBook Pros available for $1499 including free shipping plus NY sales tax only. Their price is $500 off original MSRP. B&H will... Read more
16GB Retina iPad mini on sale today for $199,...
 Staples has 2nd generation 16GB Retina iPad minis on sale for $199 on their online store for a limited time. Their price is $100 off MSRP. Choose free shipping or free local store pickup (if... Read more
Developers Start Designing Apps for Apple Wat...
Apple has announced the availability of WatchKit, software that gives developers a set of tools to easily create experiences designed specifically for Apple Watch. Apple’s developer community can now... Read more
C Spire Launches iPad Air 2 and iPad Mini 3 o...
C Spire has announced that iPad Air 2 with Wi-Fi + Cellular and iPad mini 3 with Wi-Fi + Cellular are now available on its 4G LTE network. C Spire offers both new iPads with a range of data plans... Read more
Are You On Your Last PC? – The ‘Book Mystique
Will your current PC be your last? Quite possibly so if you define “personal computer” as a traditional desktop or laptop form factor machine according to some commentators. So then, the upshot that... Read more
Save up to $180 on MacBook Airs with Apple re...
The Apple Store has Apple Certified Refurbished 2014 MacBook Airs available for up to $180 off the cost of new models. An Apple one-year warranty is included with each MacBook, and shipping is free.... Read more
16GB iPad mini available for $219, save $30
Walmart has 16GB iPad minis (1st generation) available for $219 on their online store. Their price is $30 off MSRP. Choose free shipping or free store pickup (if available). Price for online orders... Read more

Jobs Board

*Apple* Solutions Consultant (ASC)- Retail S...
**Job Summary** The ASC is an Apple employee who serves as an Apple brand ambassador and influencer in a Reseller's store. The ASC's role is to grow Apple Read more
Project Manager, *Apple* Financial Services...
**Job Summary** Apple Financial Services (AFS) offers consumers, businesses and educational institutions ways to finance Apple purchases. We work with national and Read more
*Apple* Store Leader Program - College Gradu...
Job Description: Job Summary As an Apple Store Leader Program agent, you can continue your education as you major in the art of leadership at the Apple Store. You'll Read more
*Apple* Retail - Multiple Positions (US) - A...
Sales Specialist - Retail Customer Service and Sales Transform Apple Store visitors into loyal Apple customers. When customers enter the store, you're also the Read more
Senior Event Manager, *Apple* Retail Market...
…This senior level position is responsible for leading and imagining the Apple Retail Team's global event strategy. Delivering an overarching brand story; in-store, Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.