On Monday, January 19, 2004, at 10:33 AM, michael evans wrote: > > Robert: > > Thanks for the quick response. You are welcome. > > However, the tenor of your reply credits me with far more osx/xml/plist > knowledge and sophistication than I actually posses (which is a very > long-winded way of saying I'm completely clueless)... I was that way once, before I became less clueless, after which I became less clueless, with just a half-clue. > >> You need to have your PLIST set up correctly. > > What is the 'PLIST'? Where is the 'PLIST'? It is a resource, which will need to exist in your project's resource file. 'plst' is the type and the correct id = 0 You can find one in a built Carbon app, and just change to match, or I can send you a test app that you can use to make it. Instead, I posted the source to my cheapo thingie below. See way below, I cobbled up a cheapie PLIST for you too, just JPEG. You'll want to swap out "Mikey's Viewer" for your real app name, and I set the version to v2.0.0, and you'll want to check and change the copyrights, and any place you see things such as I mentioned here. Also, the app sig is set to MkYV > Your xml file below appears to refer to several image file > types/format. I > need only one: '.jpg'/ ostype = _"JPEG" See the below. > > I'm already scanning for FINDERINFO from my handleevants loop, so once > the > plist stuff is done correctly, I should be good to go (he said > hopefully...). Yah. > > <BEGIN FB WHINGE> > Shouldn't this rather important area be documented in FB-speak? > I don't care to become an expert in the XML standard. Keeping up with > FB > fills my technical plate... > <END FB WHINGE> Some nice person just uploaded a whole PLIST class to Version Tracker with tons of methods for the other guys. :) And their IDE already helps with that. Yes, you are quite correct. Apple doesn't document them very well either, even though they are a fundamental thing these days. > > <BEGIN FB SUGGESTION> > Why can't 'filetypes to trigger open in compiled app' be an FB DEF > function? > <snip<<END FB SUGGESTION> It's a good one, and might could be done later. But carbonacious chondritin' is the main priority right now. Once you acquaint yourself with this new Windows world we Mac'ers live in, you'll love PLISTs anyway. ;) > on 1/19/04 1:48 AM, Robert Covington at artlythere@... > wrote: > > <snip> > /* App Icon is set to 128, JPEG icons to 129 , version to v2.0.0, app sig to MkYV and various other. */ // BEGIN PLIST BELOW , this line not a portion, real thing starts with <?xmlVersion, ends with </plist> <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundleIdentifier</key> <string>com.artlythere.MikeysViewer</string> <key>CFBundleName</key> <string>Mikey's Viewer</string> <key>CFBundleExecutable</key> <string>Mikey's Viewer</string> <key>CFBundlePackageType</key> <string>APPL</string> <key>CFBundleSignature</key> <string>MkYV</string> <key>CFBundleDevelopmentRegion</key> <string>English</string> <key>CFBundleShortVersionString</key> <string>2.0.0</string> <key>CFBundleLongVersionString</key> <string>2.0.0, Copyright 2004 Michael Evans</string> <key>CFBundleGetInfoString</key> <string>Mikey's Viewer 2.0.0, Copyright 2004 Michael Evans</string> <key>CFBundleVersion</key> <string>2.0.0</string> <key>LSRequiresCarbon</key> <string>1</string> <key>NSAppleScriptEnabled</key> <string>No</string> <key>NSHumanReadableCopyright</key> <string>Copyright 2004 Michael Evans. All Rights Reserved.</string> <key>CFBundleIconFile</key> <string>128</string> <key>CFBundleDocumentTypes</key> <array> <dict> <key>CFBundleTypeName</key> <string>JPEG file</string> <key>CFBundleTypeRole</key> <string>Editor</string> <key>CFBundleTypeIconFile</key> <string>129</string> <key>CFBundleTypeOSTypes</key> <array> <string>JPEG</string> </array> <key>CFBundleTypeExtensions</key> <array> <string>jpg</string> <string>JPG</string> <string>jpeg</string> <string>JPEG</string> </array> </dict> </array> </dict> </plist> // END PLIST , this line not a portion // BEGIN FB3 Program, Robert Covington, beware line wraps! /* Simple PLIST saver, compacts, neutrino bashes, then gamma induction bypasses a text file into a 'plst' Resource of ID 0. */ /* Use: Run, choose the text file that has the above PLIST in it (just the XML, no comments as I have there) . Quit, then find the New PLIST resource, copy out 'plst' id of 0, paste into your project file. */ output file "PLIST Saver" Begin globals DIM gResRef% End globals LOCAL FN pGget1Res(type as long,ID as int,resFile as int) '~' DIM as int oldRes DIM as long @resH oldRes = FN CURRESFILE USERESFILE(resFile) resH = FN GET1RESOURCE(type,ID) USERESFILE(oldRes) END FN = resH '~'5 LOCAL FN pGchangedResource(rHndl&) '~' LONG IF FN HGETSTATE(rHndl&) AND _resource% LONG IF (FN GETRESATTRS(rHndl&) AND _resChanged%) <> _resChanged% CHANGEDRESOURCE(rHndl&) END IF END IF END FN '~'5 LOCAL FN pGreplaceRes(resHndl&,resTp&,resID,resName$) '~' DIM hndlFlags,OSErr dim @ newHndl& dim curRes DIM theSize& dim @ oldRes& dim @ TheResID% dim @ theResType& OSErr=0 theResType& = resTp& TheResID% = resID LONG IF resHndl& hndlFlags = FN HGETSTATE(resHndl&) LONG IF hndlFlags AND _resource% LOADRESOURCE(resHndl&) HNOPURGE(resHndl&) newHndl& = resHndl& OSErr = FN HANDTOHAND(newHndl&) HSETSTATE(resHndl&,hndlFlags) resHndl& = newHndl& END IF END IF LONG IF resHndl& curRes = FN CURRESFILE USERESFILE(gResRef) oldRes& = FN GET1RESOURCE(resTp&,resID) LONG IF oldRes& hndlFlags = FN HGETSTATE(oldRes&) HUNLOCK(oldRes&) HNOPURGE(oldRes&) theSize& = FN GETHANDLESIZE(resHndl&) SETHANDLESIZE(oldRes&,theSize&) OSErr = fn MemError IF OSErr THEN "Dump + Add Res" BLOCKMOVE [resHndl&],[oldRes&],theSize& HSETSTATE(oldRes&,hndlFlags) HNOPURGE(oldRes&) FN pGchangedResource(oldRes&) FN DISPOSHANDLE(resHndl&) LONG IF LEN(resName$) SETRESINFO(oldRes&,resID,resName$) END IF XELSE SETRESLOAD(_false) oldRes& = FN GET1RESOURCE(resTp&,resID) SETRESLOAD(_zTrue) "Dump + Add Res" LONG IF oldRes& IF LEN(resName$) = 0 THEN GETRESINFO(oldRes&,TheResID%,theResType&,resname$) RMVERESOURCE(oldRes&) DEF DISPOSEH(oldRes&) END IF ADDRESOURCE(resHndl&,resTp&,resID,resName$) SETRESATTRS(resHndl&,_resPurgeable%) FN pGchangedResource(resHndl&) OSErr = _noErr END IF USERESFILE(curRes) LONG IF FN RESERROR OR OSErr 'FN pGshowErr(1) END IF END IF END FN LOCAL FN pGreplaceXRes(resHndl&,resTp&,resID,resName$,resRef) '~' DIM oldRes oldRes = gResRef gResRef = resRef FN pGreplaceRes(resHndl&,resTp&,resID,resName$) gResRef = oldRes END FN clear local DIM ResFileRef% DIM curResRef% DIM outFS as FSSpec Local FN SavePlistRez(inH as handle,fs as ^FSSpec) outFs = fs FSpCreateResFile(@outFS,_"RSED",_"rsrc",_smSystemScript) curResRef% = FN CURRESFILE ResFileRef% = FN FSpOpenResFile (@outFs,_fsRdWrPerm) LONG IF inH FN pGreplaceXRes(inH,_"plst",0,"PList",ResFileRef%) END IF CloseRESFILE( ResFileRef%) USERESFILE(curResRef%) end FN clear local dim fName as str255 dim fs as FSSpec dim textH as handle dim size as long local FN OpenPLIST fName = FILES$(_FSSpecOpen ,"TEXT", , fs) long if fName[0] OPEN "I" ,#1,@fs size = lof(1,1) textH = fn newHandle(size) long if textH read file #1, [textH], size end if close #1 fs.name = "New PList Rez" FN SavePlistRez(textH,fs) end if end fn FN OpenPLIST