short countinitialfiles (void) { short message, ctfiles; CountAppFiles (&message, &ctfiles); if (message == 0) return (ctfiles); return (0); } /*countinitialfiles*/
DoStartup() { int theMessage; int nDocs; int thisDoc; AppFile docInfo; int ignore; /*======================================================*/ /* Get the number of documents and the startup message. */ /*======================================================*/ CountAppFiles(&theMessage,&nDocs); /*=================================================*/ /* If the user chose Print in Finder, then post an */ /* alert indicating that printing from the Finder */ /* is not supported and return to the Finder. */ /*=================================================*/ if (theMessage == appPrint) { StopAlert(CantPrintID,NULL); ExitToShell(); } /*====================================================*/ /* Else if the user selected one or documents then... */ /*====================================================*/ else if (nDocs > 0) { /*=====================================*/ /* Loop through each of the documents. */ /*=====================================*/ for (thisDoc = 1 ; thisDoc <= nDocs; thisDoc++) { /*===============================================*/ /* Get the startup information for the document. */ /*===============================================*/ GetAppFiles(thisDoc,&docInfo); /*===================================================*/ /* If the document is a text file, then read it into */ /* a window and tell the finder that the document */ /* has been processed. */ /*===================================================*/ if (docInfo.fType == 'TEXT') { OpenFile(docInfo.fName,docInfo.vRefNum); ClrAppFiles(thisDoc); } /*=================================================*/ /* Else substitute the document name into the text */ /* of an alert indicating that the document is of */ /* the wrong type and post the alert. */ /*=================================================*/ else { ParamText(docInfo.fName,"\p","\p","\p"); StopAlert(WrongTypeID,NULL); } } } }