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

Community Search:
MacTech Search:

Software Updates via MacUpdate

ExpanDrive 5.4.6 - $49.99
ExpanDrive builds cloud storage in every application, acts just like a USB drive plugged into your Mac. With ExpanDrive, you can securely access any remote file server directly from the Finder or... Read more
Apple Pages 6.1.1 - Apple's word pr...
Apple Pages is a powerful word processor that gives you everything you need to create documents that look beautiful. And read beautifully. It lets you work seamlessly between Mac and iOS devices, and... Read more
Apple Numbers 4.1.1 - Apple's sprea...
With Apple Numbers, sophisticated spreadsheets are just the start. The whole sheet is your canvas. Just add dramatic interactive charts, tables, and images that paint a revealing picture of your data... Read more
Apple Keynote 7.1.1 - Apple's prese...
Easily create gorgeous presentations with the all-new Keynote, featuring powerful yet easy-to-use tools and dazzling effects that will make you a very hard act to follow. The Theme Chooser lets you... Read more
Espresso 5 - Powerful HTML, XML, CSS, an...
Espresso is back. For people who make delightful, innovative, and fast websites -- in an app to match. Espresso helps you write, code, design, build, and publish with flair and efficiency.... Read more
Vitamin-R 2.47 - Personal productivity t...
Vitamin-R creates the optimal conditions for your brain to work at its best by structuring your work into short bursts of distraction-free, highly focused activity alternating with opportunities for... Read more
Dash 4.0.3 - Instant search and offline...
Dash is an API documentation browser and code snippet manager. Dash helps you store snippets of code, as well as instantly search and browse documentation for almost any API you might use (for a full... Read more
Posterino 3.3.6 - Create posters, collag...
Posterino offers enhanced customization and flexibility including a variety of new, stylish templates featuring grids of identical or odd-sized image boxes. You can customize the size and shape of... Read more
Together 3.8.3 - Store and organize all...
Together helps you organize your Mac, giving you the ability to store, edit and preview your files in a single clean, uncluttered interface. Features Smart storage. With simple drag-and-drop... Read more
iClock Pro 3.4.9 - Customize your menuba...
iClock Pro is a menu bar replacement clock for Apple's default clock. iClock Pro is an update, total rewrite and improvement to the popular iClock. Have the day, date and time in different fonts and... Read more

Latest Forum Discussions

See All

Minimalist puzzle game, Cuts, free on iO...
If you're looking for a gorgeous puzzle experience on iOS devices, developer's aesthetically interesting puzzler, Cuts, is discounted to free on the iOS App Store right now. [Read more] | Read more »
Anime tactical RPG, War of Crown, comes...
If you're looking for another tactical RPG fix to go alongside your Fire Emblem Heroes campaigns check out Gamevil's newest, anime-inspired tactics RPG, War of Crown, which comes out tomorrow. [Read more] | Read more »
Fantasy MMORPG MU Origin adds new modes,...
MU Origin, Webzen’s highly popular fantasy MMORPG is getting ready to shake things up for the second time this year, as a new update makes its way to the Google Play and App Store from today. Introducing new systems, modes, and events, the land of... | Read more »
Blizzard is looking to hire a mobile dev...
A new thread on the popular video game rumor forum, NeoGAF, uncovered an interesting job listing over at Blizzard Entertainment. It appears the studio behindStarCraft, World of WarCraft, Hearthstone,andOverwatch is looking to bring on a new hire... | Read more »
Legend of Zelda meets Cooking Mama in ne...
Dungeon Chef is what happens when you mix the RPG elements (and style) of a Legend of Zelda game, with cooking elements. Although, now that The Legend of Zelda: Breath of the Wild also has cookingelements, so maybe the gameplay is not so novel.... | Read more »
ChordFlow (Music)
ChordFlow 1.0.0 Device: iOS Universal Category: Music Price: $6.99, Version: 1.0.0 (iTunes) Description: ChordFlow is a chord sequencer with a unique 4-track polyphonic arpeggiator, extensive chord library, MIDI out and Ableton Link... | Read more »
The Walking Dead: A New Frontier is out...
The newest season of Telltale Games'The Walking Dead is well underway. After the release of the third episode, "Above the Law" about a month ago, episode four, "Thicker Than Water" is hot and ready for more zombies and gut-wrenching emotional... | Read more »
Best games we played this week
Another week, another new wave of mobile games do dive into. We've dug through the list of apps that came out this week to tell you which apps are worth your sweet time. And while there weren't too many games this week, there were some big ones.... | Read more »
Vignettes (Games)
Vignettes 1.0.1 Device: iOS Universal Category: Games Price: $2.99, Version: 1.0.1 (iTunes) Description: Vignettes is a casual but unique exploration game without text or characters, where objects shapeshift as you spin them around... | Read more »
Get Me Outta Here is an 80s retro shoote...
Are you ready to fight some aliens? Because Crescent Moon Games has released the retro shooter Get Me Outta Here on iOS devices today. [Read more] | Read more »

Price Scanner via

HyperX Ships Pulsefire FPS Gaming Mouse, Winn...
Your reporter is a longtime fan of gaming mice for general purpose coomnputing use, finding them typically superior in comfort and performance. HyperX, a division of Kingston Technology Company, Inc... Read more
Penske Truck Leasing Unveils “Penske Fleet” M...
Penske Truck Leasing has introduced a free mobile app called “Penske Fleet” to benefit its full-service truck leasing and contract maintenance customers. The mobile app enables Penske’s customers to... Read more
DEVONthink To Go 2.1.3 For iOS Adds New Declu...
DEVONtechnologies has updated DEVONthink To Go, its iOS companion to DEVONthink for Mac. Enhancements and bug fixes in Version 2.1.3 include DEVONtechnologies’ new decluttering service for clipping... Read more
Use Apple’s Education discount to save up to...
Purchase a new Mac or iPad using Apple’s Education Store and take up to $300 off MSRP. All teachers, students, and staff of any educational institution qualify for the discount. Shipping is free: -... Read more
Apple refurbished Apple Watches available sta...
Apple is now offering Certified Refurbished Series 1 and Series 2 Apple Watches for 14-16% off MSRP, starting at $229. An Apple one-year warranty is included with each watch. Shipping is free: Series... Read more
15-inch Touch Bar MacBook Pros, Apple refurbi...
Apple is offering Certified Refurbished 2016 15″ Touch Bar MacBook Pros for $360 to $420 off original MSRP. An Apple one-year warranty is included with each model, and shipping is free: - 15″ 2.6GHz... Read more
13-inch MacBook Airs on sale for up to $150 o... has 13″ MacBook Airs on sale for up to $150 off MSRP including free shipping: - 13″ 1.6GHz/128GB MacBook Air (sku MMGF2LL/A): $869.99 $130 off MSRP - 13″ 1.6GHz/256GB MacBook Air (sku... Read more
15-inch Touch Bar MacBook Pros on sale for $1...
B&H Photo has the new 2016 15″ Apple Touch Bar MacBook Pros in stock today and on sale for up to $200 off MSRP. Shipping is free, and B&H charges NY sales tax only: - 15″ 2.7GHz Touch Bar... Read more
15-inch 2.7GHz Touch Bar MacBook Pros on sale...
Amazon has 2016 15″ 2.7GHz Apple Touch Bar MacBook Pros in stock today and on sale for $150-$200 off MSRP. Shipping is free: - 15″ 2.7GHz Touch Bar MacBook Pro Space Gray (sku MLH42LL/A): $2599 $200... Read more
Apple now offering Certified Refurbished 13-i...
Apple is now offering Certified Refurbished 2016 13″ Touch Bar MacBook Pros for $270-$300 off original MSRP. An Apple one-year warranty is included with each model, and shipping is free: - 13″ 2.9GHz... Read more

Jobs Board

*Apple* Retail - Multiple Positions - Apple,...
Job Description: Sales Specialist - Retail Customer Service and Sales Transform Apple Store visitors into loyal Apple customers. When customers enter the store, Read more
*Apple* Solutions Consultant - Apple (United...
# Apple Solutions Consultant Job Number: 56881986 Middletown, NY, New York, United States Posted: Apr. 17, 2017 Weekly Hours: 40.00 **Job Summary** As an Apple Read more
*Apple* Mobile Master - Best Buy (United Sta...
**489879BR** **Job Title:** Apple Mobile Master **Location Number:** 000402-Utica-Store **Job Description:** **What does a Best Buy Apple Mobile Master do?** At Read more
Music Marketing Lead, iTunes & *Apple*...
# Music Marketing Lead, iTunes & Apple Music Job Number: 56868140 Culver City, California, United States Posted: Apr. 17, 2017 Weekly Hours: 40.00 **Job Summary** Read more
Best Buy *Apple* Computing Master - Best Bu...
**498001BR** **Job Title:** Best Buy Apple Computing Master **Location Number:** 000356-Manassas-Store **Job Description:** **What does a Best Buy Apple Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.