#!/bin/sh # MetaCard 2.4 stack # The following is not ASCII text, # so now would be a good time to q out of more exec mc $0 "$@" RevGZ function getPrefsFileName if the platform = "Win32" then put specialFolderPath(26) into tPrefsFolder else put specialFolderPath("Preferences") into tPrefsFolder end if if last char of tPrefsFolder is not "/" then put "/" after tPrefsFolder if there is not a folder tPrefsFolder then create folder tPrefsFolder put tPrefsFolder & "RevGZ.prefs" into tPath return tPath end getPrefsFileName function getDestFile sourceFile put the cSaveType of this stack into saveType put the cSaveFolder of this stack into saveFolder set the itemDel to "/" put the last item of sourceFile into shortName if char -3 to -1 of shortName = ".gz" then delete char -3 to -1 of shortName else put ".gz" after shortName end if if saveType = "folder" and saveFolder is not empty and there is a folder saveFolder then return saveFolder & shortName else if saveType = "Same" then put shortName into last item of sourceFile return sourceFile else -- also catches folder setting with no valid folder put shortName into last item of sourceFile ask file "Save processed file as:" with sourceFile return it end if end getDestFile 1 f revstack false cSaveType SamecSaveFolder RevGZ U Lucida Grande U Verdana W Verdana Menubar 1 cREVGeometryCache stackID 1008 cREVGeneral scriptChecksum HI;>VqHF bookmarks handlerList getPrefsFileName getDestFiletempScript prevHandler getPrefsFileNamescriptSelection char 414 to 413script
function getPrefsFileName
if the platform = "Win32" then
put specialFolderPath(26) into tPrefsFolder
else
put specialFolderPath("Preferences") into tPrefsFolder
end if
if last char of tPrefsFolder is not "/" then put "/" after tPrefsFolder
if there is not a folder tPrefsFolder then create folder tPrefsFolder
put tPrefsFolder & "RevGZ.prefs" into tPath
return tPath
end getPrefsFileName
function getDestFile sourceFile
put the cSaveType of this stack into saveType
put the cSaveFolder of this stack into saveFolder
set the itemDel to "/"
put the last item of sourceFile into shortName
if char -3 to -1 of shortName = ".gz" then
delete char -3 to -1 of shortName
else
put ".gz" after shortName
end if
if saveType = "folder" and saveFolder is not empty and there is a folder saveFolder then
return saveFolder & shortName
else if saveType = "Same" then
put shortName into last item of sourceFile
return sourceFile
else
-- also catches folder setting with no valid folder
put shortName into last item of sourceFile
ask file "Save processed file as:" with sourceFile
return it
end if
end getDestFile
Pon preOpenStack readPrefs end preOpenStack on resumeStack readPrefs end resumeStack on readPrefs put getPrefsFileName() into prefsName if there is not a file prefsName then put "Ask" into saveBtn put "" into saveFolder else put URL ("file:" & prefsName) into prefs set the itemDel to "" get lineOffset("Save", prefs) put item 2 of line it of prefs into saveBtn if saveBtn is not among the items of "Ask,Same,Folder" then put "Same" into saveBtn if saveBtn = "Folder" then get lineOffset("Folder", prefs) put item 2 of line it of prefs into saveFolder else put "" into saveFolder end if if saveBtn = "Folder" and (saveFolder is empty or there is not a folder saveFolder) then put "Same" into saveBtn put empty into saveFolder end if get lineOffset("RevGZ", prefs) put item 2 of line it of prefs into tRect set the itemDel to comma set the topLeft of window "RevGZ" to item 1 to 2 of tRect end if set the cSaveType of this stack to saveBtn set the cSaveFolder of this stack to saveFolder end readPrefs on moveStack put getPrefsFileName() into prefsName put URL ("file:" & prefsName) into prefs get lineOffset("RevGZ", prefs) if it > 0 then set the itemDelimiter to "" put the rect of of window "RevGZ" into item 2 of line it of prefs else put "RevGZ" & the rect of window "RevGZ" & cr after prefs end if put prefs into URL ("file:" & prefsName) end moveStack f cREVGeometryCacheIDs 1046908017686 10081125899929965 10031046907875884 10071125899929966 10041125899929967 10051125899929968 1006 cREVGeometrycache total 6order cREVGeneral scriptChecksum @4aJ(F bookmarks handlerList ,preOpenStack resumeStack readPrefs moveStacktempScript prevHandler preOpenStackscriptSelection char 89 to 88scripton preOpenStack
readPrefs
end preOpenStack
on resumeStack
readPrefs
end resumeStack
on readPrefs
put getPrefsFileName() into prefsName
if there is not a file prefsName then
put "Ask" into saveBtn
put "" into saveFolder
else
put URL ("file:" & prefsName) into prefs
set the itemDel to "¶"
get lineOffset("Save¶", prefs)
put item 2 of line it of prefs into saveBtn
if saveBtn is not among the items of "Ask,Same,Folder" then put "Same" into saveBtn
if saveBtn = "Folder" then
get lineOffset("Folder¶", prefs)
put item 2 of line it of prefs into saveFolder
else
put "" into saveFolder
end if
if saveBtn = "Folder" and (saveFolder is empty or there is not a folder saveFolder) then
put "Same" into saveBtn
put empty into saveFolder
end if
get lineOffset("RevGZ¶", prefs)
put item 2 of line it of prefs into tRect
set the itemDel to comma
set the topLeft of window "RevGZ" to item 1 to 2 of tRect
end if
set the cSaveType of this stack to saveBtn
set the cSaveFolder of this stack to saveFolder
end readPrefs
on moveStack
put getPrefsFileName() into prefsName
put URL ("file:" & prefsName) into prefs
get lineOffset("RevGZ¶", prefs)
if it > 0 then
set the itemDelimiter to "¶"
put the rect of of window "RevGZ" into item 2 of line it of prefs
else
put "RevGZ¶" & the rect of window "RevGZ" & cr after prefs
end if
put prefs into URL ("file:" & prefsName)
end moveStack
Menubar 1 I m cREVGeneral revUniqueID 1125899929965 File U?--The following menuPick handler was generated by the Menu Manager. on menuPick pWhich switch pWhich case "Compress" send mouseUp to btn "Compress" of stack "RevGZ" break case "Expand" send mouseUp to btn "Expand" of stack "RevGZ" break case "Quit" quit break end switch end menuPick File Compress Expand - &Quit/Q cREVGeneral scriptChecksum E"`_%NXCrevUniqueID 1125899929966 bookmarks handlerList menuPicktempScript prevHandler menuPickscriptSelection char 231 to 230script--The following menuPick handler was generated by the Menu Manager.
on menuPick pWhich
switch pWhich
case "Compress"
send mouseUp to btn "Compress" of stack "RevGZ"
break
case "Expand"
send mouseUp to btn "Expand" of stack "RevGZ"
break
case "Quit"
quit
break
end switch
end menuPick
Edit Ut--The following menuPick handler was generated by the Menu Manager. on menuPick pWhich switch pWhich case "Cut" cut break case "Copy" copy break case "Paste" paste break case "Clear" put "" into the selection break case "Preferences..." case "Preferences" go to stack "Prefs" as modal break end switch end menuPick ! Edit 0Cu&t/X &Copy/C &Paste/V Clea&r - Preferences... cREVGeneral scriptChecksum #;~ JfK4revUniqueID 1125899929967 bookmarks handlerList menuPicktempScript prevHandler menuPickscriptSelection char 335 to 334script--The following menuPick handler was generated by the Menu Manager.
on menuPick pWhich
switch pWhich
case "Cut"
cut
break
case "Copy"
copy
break
case "Paste"
paste
break
case "Clear"
put "" into the selection
break
case "Preferences..."
case "Preferences"
go to stack "Prefs" as modal
break
end switch
end menuPick
Help U}--The following menuPick handler was generated by the Menu Manager. on menuPick pWhich switch pWhich case "Help" answer information "Use the Preferences to set the location" & cr & "for processed files." & cr & \ "Then click on the appropriate button" & cr & "and select the file to process," & cr & \ "or drag'n'drop files on to the buttons." break case "About RevGZ..." answer information "A utility stack to compress & expand files" & cr & \ "using Revolution's in-built compression facilites." & cr & \ cr & "Version 1.2 5th September, 2005" break end switch end menuPick A % Help &Help - &About RevGZ... cREVGeneral scriptChecksum g 7e EDFrevUniqueID 1125899929968 bookmarks handlerList menuPicktempScript prevHandler menuPickscriptSelection char 402 to 401script--The following menuPick handler was generated by the Menu Manager.
on menuPick pWhich
switch pWhich
case "Help"
answer information "Use the Preferences to set the location" & cr & "for processed files." & cr & \
"Then click on the appropriate button" & cr & "and select the file to process," & cr & \
"or drag'n'drop files on to the buttons."
break
case "About RevGZ..."
answer information "A utility stack to compress & expand files" & cr & \
"using Revolution's in-built compression facilites." & cr & \
cr & "Version 1.2 5th September, 2005"
break
end switch
end menuPick
Compress on mouseUp answer file "Select file to compress:" put it into tFile if tFile is empty then exit mouseUp doCompress tFile end mouseUp on doCompress pFile put getDestFile(pFile) into tNewFile set the fileType to "" put compress(URL ("binfile:" & pFile)) into URL ("binFile:" & tNewFile) beep end doCompress on dragEnter set the acceptDrop to true set the hilite of me to true end dragEnter on dragDrop put the dragData into tFile doCompress tFile set the hilite of me to false end dragDrop on mouseLeave set the hilite of me to false end mouseLeave on mouseRelease set the hilite of me to false end mouseRelease on dragLeave set the hilite of me to false end dragLeave ^ J K cREVGeneral scriptChecksum e;qg{urevUniqueID 1046907875884 bookmarks handlerList GmouseUp doCompress dragEnter dragDrop mouseLeave mouseRelease dragLeavetempScript prevHandler mouseUpscriptSelection char 712 to 711scripton mouseUp
answer file "Select file to compress:"
put it into tFile
if tFile is empty then exit mouseUp
doCompress tFile
end mouseUp
on doCompress pFile
put getDestFile(pFile) into tNewFile
set the fileType to ""
put compress(URL ("binfile:" & pFile)) into URL ("binFile:" & tNewFile)
beep
end doCompress
on dragEnter
set the acceptDrop to true
set the hilite of me to true
end dragEnter
on dragDrop
put the dragData into tFile
doCompress tFile
set the hilite of me to false
end dragDrop
on mouseLeave
set the hilite of me to false
end mouseLeave
on mouseRelease
set the hilite of me to false
end mouseRelease
on dragLeave
set the hilite of me to false
end dragLeave
Expand on mouseUp answer file "Select file to expand:" put it into tFile if tFile is empty then exit mouseUp doExpand tFile end mouseUp on doExpand pFile put getDestFile(pFile) into tNewFile setFileType pFile try put decompress(URL ("binfile:" & pFile)) into URL ("binfile:" & tNewFile) beep catch errmsg beep answer error "Oops! That doesn't seem to be a compressed file!" end try end doExpand on dragEnter set the acceptDrop to true set the hilite of me to true end dragEnter on dragDrop put the dragData into tFile doExpand tFile set the hilite of me to false end dragDrop on dragLeave set the hilite of me to false end dragLeave on mouseLeave set the hilite of me to false end mouseLeave on mouseRelease set the hilite of me to false end mouseRelease on setFileType pFile set the itemDel to "/" put last item of pFile into fName put char -4 to -1 of fName into tExten switch tExten case ".txt" set the fileType to "ttxtTEXT" break case ".rev" set the fileType to "RevoRSTK" break case ".mc" set the fileType to "McrdMSTK" break default set the fileType to "" end switch end setFileType f ^ J L cREVGeneral scriptChecksum U_kJDjMrevUniqueID 1046908017686 bookmarks handlerList QmouseUp doExpand dragEnter dragDrop dragLeave mouseLeave mouseRelease setFileTypetempScript prevHandler mouseUpscriptSelection char 698 to 697scripton mouseUp
answer file "Select file to expand:"
put it into tFile
if tFile is empty then exit mouseUp
doExpand tFile
end mouseUp
on doExpand pFile
put getDestFile(pFile) into tNewFile
setFileType pFile
try
put decompress(URL ("binfile:" & pFile)) into URL ("binfile:" & tNewFile)
beep
catch errmsg
beep
answer error "Oops! That doesn't seem to be a compressed file!"
end try
end doExpand
on dragEnter
set the acceptDrop to true
set the hilite of me to true
end dragEnter
on dragDrop
put the dragData into tFile
doExpand tFile
set the hilite of me to false
end dragDrop
on dragLeave
set the hilite of me to false
end dragLeave
on mouseLeave
set the hilite of me to false
end mouseLeave
on mouseRelease
set the hilite of me to false
end mouseRelease
on setFileType pFile
set the itemDel to "/"
put last item of pFile into fName
put char -4 to -1 of fName into tExten
switch tExten
case ".txt"
set the fileType to "ttxtTEXT"
break
case ".rev"
set the fileType to "RevoRSTK"
break
case ".mc"
set the fileType to "McrdMSTK"
break
default
set the fileType to ""
end switch
end setFileType
Prefs 2 k# Preferences W Verdana U Lucida Grande cREVGeneral scriptChecksum ُ B~ bookmarks handlerList tempScript prevHandler scriptSelection char 1 to 0script PSon preOpenStack readPrefs end preOpenStack on clearPrefs put "" into fld "Save folder" disable grp "Select" set the hilitedButtonName of group "Save group" to "Same" end clearPrefs on readPrefs put getPrefsFileName() into prefsName if there is not a file prefsName then clearPrefs else put URL ("file:" & prefsName) into prefs set the itemDel to "" get lineOffset("Save", prefs) put item 2 of line it of prefs into saveBtn get lineOffset("Folder", prefs) put item 2 of line it of prefs into tSaveFolder if saveBtn is not among the items of "Ask,Same,Folder" then put "Same" into saveBtn if saveBtn = "Folder" and (tSaveFolder is empty or there is not a folder tSaveFolder) then put "Same" into saveBtn put empty into tSaveFolder end if set the hilitedButtonName of grp "Save group" to saveBtn if saveBtn = "Folder" then enable grp "Select" put tSaveFolder into fld "Save folder" else disable grp "Select" end if get lineOffset("Prefs", prefs) put item 2 of line it of prefs into tRect if tRect is a rect then set the rect of window "Prefs" to tRect end if end readPrefs on writePrefs put getPrefsFileName() into prefsName put empty into prefList put "Save" & the hilitedButtonName of grp "Save group" & cr after prefList put "Folder" & fld "Save folder" & cr after prefList put "RevGZ" & the rect of window "RevGZ" & cr after prefList put "Prefs" & the rect of window "Prefs" & cr after prefList put prefList into URL ("file:" & prefsName) end writePrefs # cREVGeneral scriptChecksum 3(LV $dD bookmarks handlerList ,preOpenStack clearPrefs readPrefs writePrefstempScript prevHandler writePrefsscriptSelection char 812 to 811scripton preOpenStack
readPrefs
end preOpenStack
on clearPrefs
put "" into fld "Save folder"
disable grp "Select"
set the hilitedButtonName of group "Save group" to "Same"
end clearPrefs
on readPrefs
put getPrefsFileName() into prefsName
if there is not a file prefsName then
clearPrefs
else
put URL ("file:" & prefsName) into prefs
set the itemDel to "¶"
get lineOffset("Save¶", prefs)
put item 2 of line it of prefs into saveBtn
get lineOffset("Folder¶", prefs)
put item 2 of line it of prefs into tSaveFolder
if saveBtn is not among the items of "Ask,Same,Folder" then put "Same" into saveBtn
if saveBtn = "Folder" and (tSaveFolder is empty or there is not a folder tSaveFolder) then
put "Same" into saveBtn
put empty into tSaveFolder
end if
set the hilitedButtonName of grp "Save group" to saveBtn
if saveBtn = "Folder" then
enable grp "Select"
put tSaveFolder into fld "Save folder"
else
disable grp "Select"
end if
get lineOffset("Prefs¶", prefs)
put item 2 of line it of prefs into tRect
if tRect is a rect then set the rect of window "Prefs" to tRect
end if
end readPrefs
on writePrefs
put getPrefsFileName() into prefsName
put empty into prefList
put "Save¶" & the hilitedButtonName of grp "Save group" & cr after prefList
put "Folder¶" & fld "Save folder" & cr after prefList
put "RevGZ¶" & the rect of window "RevGZ" & cr after prefList
put "Prefs¶" & the rect of window "Prefs" & cr after prefList
put prefList into URL ("file:" & prefsName)
end writePrefs
save group i ~on mouseUp if the hilite of btn "Folder" then enable grp "Select" else disable grp "Select" end if end mouseUp H cREVGeneral scriptChecksum o3b'Ŝ revUniqueID 1046908425509 bookmarks handlerList mouseUptempScript prevHandler mouseUpscriptSelection char 113 to 112scripton mouseUp
if the hilite of btn "Folder" then
enable grp "Select"
else
disable grp "Select"
end if
end mouseUp
Ask `d Always ask cREVGeneral revUniqueID 1046908339814 Same `d 2 Same place as original cREVGeneral revUniqueID 1046908339814 Folder `d H In a specified location cREVGeneral revUniqueID 1046908339814 bookmarks handlerList tempScript prevHandler scriptSelection char 1 to 0script New Field 1 cREVGeneral revUniqueID 1046908468552 Save processed files Cancel Ex Jon mouseUp clearPrefs save this stack close this stack end mouseUp d cREVGeneral scriptChecksum trevUniqueID 1046908551345 bookmarks handlerList mouseUptempScript prevHandler mouseUpscriptSelection char 24 to 23script kon mouseUp
clearPrefs
save this stack
close this stack
end mouseUp
Done Mx Won mouseUp writePrefs clearPrefs save this stack close this stack end mouseUp d cREVGeneral scriptChecksum 9K%AṋBrevUniqueID 1046908557165 bookmarks handlerList mouseUptempScript prevHandler mouseUpscriptSelection char 75 to 74script on mouseUp
writePrefs
clearPrefs
save this stack
close this stack
end mouseUp
Select y 6 J @ cREVGeneral revUniqueID 1046908712686 Browse... Epon mouseUp answer folder "Select the folder to save processed files:" with fld "Save folder" put it into tFolder if tFolder is not empty then if last char of tFolder <> "/" then put "/" after tFolder put tFolder into fld "Save folder" end if end mouseUp N R cREVGeneral scriptChecksum ~,=krevUniqueID 1046908492380 bookmarks handlerList mouseUptempScript prevHandler mouseUpscriptSelection char 95 to 94script Kon mouseUp
answer folder "Select the folder to save processed files:" with fld "Save folder"
put it into tFolder
if tFolder is not empty then
if last char of tFolder <> "/" then put "/" after tFolder
put tFolder into fld "Save folder"
end if
end mouseUp
Save folder : d " cREVGeneral revUniqueID 1046908503804