|
From: <cre...@us...> - 2006-07-26 19:44:10
|
Revision: 1471 Author: creecode Date: 2006-07-26 10:39:52 -0700 (Wed, 26 Jul 2006) ViewCVS: http://svn.sourceforge.net/frontierkernel/?rev=1471&view=rev Log Message: ----------- minor formatting tweaks Modified Paths: -------------- ODBs/trunk/frontierRoot/system/verbs/builtins/export/card/doExport.fvc Modified: ODBs/trunk/frontierRoot/system/verbs/builtins/export/card/doExport.fvc =================================================================== --- ODBs/trunk/frontierRoot/system/verbs/builtins/export/card/doExport.fvc 2006-07-26 17:37:58 UTC (rev 1470) +++ ODBs/trunk/frontierRoot/system/verbs/builtins/export/card/doExport.fvc 2006-07-26 17:39:52 UTC (rev 1471) @@ -1,111 +1,151 @@ -FrontierVcsFile:1:scpt:system.verbs.builtins.export.card.doExport +FrontierVcsFile:3:scpt:system.verbs.builtins.export.card.doExport on doExport (adr, kind, location, compression) { - \xC7Changes - \xC73/18/04; 7:42:04 PM by JES - \xC7Add file extenion on Mac as well as Windows -- needed for proper OS X typing, and mime-type sending in static web servers. Also, smart-limit file name to 31 characters (limit imposed by OS 9 and Carbon API). - bundle { \xC7be sure kind and type are compatible + «Changes + «5/14/06; 6:52:35 PM by TAC + «minor formatting tweaks + «3/18/04; 7:42:04 PM by JES + «Add file extenion on Mac as well as Windows -- needed for proper OS X typing, and mime-type sending in static web servers. Also, smart-limit file name to 31 characters (limit imposed by OS 9 and Carbon API). + «Mon, Jan 26, 1998 at 5:10:25 PM by PBS + «Append file suffixes if pref is set to true + + bundle { // be sure kind and type are compatible on check () { if kind == "Folder" { if typeOf (adr^) != tableType { scriptError ("Only tables can be exported in this format.")} else { - return}}; \xC7it's ok + return}}; // it's ok + if typeOf (adr^) != scriptType { if kind != "Packed object" { scriptError ("Only scripts can be exported in this format.")} else { return}}}; check ()}; - local (f, fname, objectname); - bundle { \xC7set fname - local (tablename, quotedname); - objectname = nameOf (adr^); - if string.hasSuffix (\xD2"]\xD3, adr) { - quotedname = \xD2["\xD3 + objectname + \xD2"]\xD3} + + local (f, fName, objectName); + + bundle { // set fName + local (tableName, quotedName); + + objectName = nameOf (adr^); + + if string.hasSuffix ("\"]", adr) { + quotedName = "[\"" + objectName + "\"]"} else { - quotedname = objectname}; - tablename = nameOf (address (string (adr) - ('.' + quotedname))^); + quotedName = objectName}; + + tableName = nameOf (address (string (adr) - ('.' + quotedName))^); + if kind == "Desktop script" { - fname = objectname} - else { //calculate name based on object name and parent table name - local (longname = tablename + '.' + objectname); - if system.environment.isMac { //limit to 31 chars (with extension) - if sizeOf (longname) > 26 { //don't add table name - longname = objectname}; - if sizeOf (longname) > 26 { //truncate object name - longname = string.mid (longname, 1, 26)}}; - fname = longname}; - objectname = fname; + fName = objectName} + else { // calculate name based on object name and parent table name + local (longName = tableName + '.' + objectName); + + if system.environment.isMac { // limit to 31 chars (with extension) + if sizeOf (longName) > 26 { // don't add table name + longName = objectName}; + + if sizeOf (longName) > 26 { // truncate object name + longName = string.mid (longName, 1, 26)}}; + + fName = longName}; + + objectName = fName; + case typeOf (adr^) { scriptType { if kind == "Desktop script" { - fname = fname + ".ftds"} + fName = fName + ".ftds"} else { - fname = fname + ".ftsc"}}; + fName = fName + ".ftsc"}}; wptextType { - fname = fname + ".ftwp"}; + fName = fName + ".ftwp"}; outlineType { - fname = fname + ".ftop"}; + fName = fName + ".ftop"}; tableType { - fname = fname + ".fttb"}} + fName = fName + ".fttb"}} else { - fname = fname + ".fatp"}; + fName = fName + ".fatp"}; + if compression != "None" { - fname = fname + compression}}; + fName = fName + compression}}; + case location { "File" { - local (lastfolder = user.export.lastfolder); - if not (lastfolder endswith file.getPathChar ()) { - lastfolder = lastfolder + file.getPathChar ()}; - if not file.exists (lastfolder) { - lastfolder = file.folderFromPath (Frontier.getProgramPath ())}; - f = lastfolder + fname; - \xC7Append file suffixes if pref is set to true - \xC7Mon, Jan 26, 1998 at 5:10:25 PM by PBS + local (lastFolder = user.export.lastFolder, pc = file.getPathChar ()); + + if not (lastFolder endsWith pc) { + lastFolder = lastFolder + pc}; + + if not file.exists (lastFolder) { + lastFolder = file.folderFromPath (Frontier.getProgramPath ())}; + + f = lastFolder + fName; + if not defined (user.prefs.appendFileSuffixes) { user.prefs.appendFileSuffixes = false}; + if user.prefs.appendFileSuffixes { local (suffix = "." + string.lower (Frontier.getFileType (typeOf (adr^)))); + if kind == "Desktop script" { suffix = ".ftds"}; + f = f + suffix}; + if not file.putFileDialog ("Export to what file?", @f) { return (false)}; - user.export.lastfolder = file.folderFromPath (f)}; + + user.export.lastFolder = file.folderFromPath (f)}; "Eudora attachment" { local (folder = Eudora.getScriptPrefsFolder () + "Outgoing Frontier Objects:"); file.sureFolder (folder); - f = folder + fname}}; - local (packedfile); + f = folder + fName}}; + + local (packedFile); + if compression == "None" { - packedfile = f} - else { \xC7must create it in a temporary location + packedFile = f} + else { // must create it in a temporary location local (tempfolder = file.getSpecialFolderPath ("", "Temporary Items", true)); - packedfile = tempfolder + objectname}; + + packedFile = tempfolder + objectName}; + case kind { "Packed object" { - export.sendObject (adr, packedfile)}; + export.sendObject (adr, packedFile)}; "Desktop script" { - export.sendToDesktop (adr, packedfile)}; + export.sendToDesktop (adr, packedFile)}; "Script Editor format" { - export.sendOSAScript (adr, packedfile)}; + export.sendOSAScript (adr, packedFile)}; "Folder" { - export.sendFolder (adr, packedfile + file.getPathChar ())}}; + export.sendFolder (adr, packedFile + file.getPathChar ())}}; + if compression != "None" { - local (sitfile = f); - if sitfile endsWith ".hqx" { - sitfile = sitfile - ".hqx"}; - local (flbinhex = compression == ".sit.hqx"); - stuff.createArchive (sitfile, {packedfile}, flbinhex); - file.delete (packedfile); + local (sitFile = f); + + if sitFile endsWith ".hqx" { + sitFile = sitFile - ".hqx"}; + + local (flBinHex = compression == ".sit.hqx"); + + stuff.createArchive (sitFile, {packedFile}, flBinHex); + + file.delete (packedFile); + Frontier.bringToFront ()}; + if location == "Eudora attachment" { Eudora.launch (); + try { Eudora.attachFiles (Eudora.getCurrentMessageObject (), f)} else { try { Eudora.attachFiles (Eudora.createMessage (), f)} else { - scriptError ("Couldn't attach the exported object to a Eudora message.")}}}} \ No newline at end of file + scriptError ("Couldn't attach the exported object to a Eudora message.")}}}} + + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |