#!/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 "$@" RevGZfunction 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 1f revstackfalse cSaveTypeSame cSaveFolderRevGZ ULucida Grande UVerdana WVerdana Menubar 1cREVGeometryCachestackID1008 cREVGeneralscriptChecksumHI;>VqHF bookmarks handlerListgetPrefsFileName getDestFile tempScript prevHandlergetPrefsFileNamescriptSelectionchar 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 fcREVGeometryCacheIDs104690801768610081125899929965100310469078758841007112589992996610041125899929967100511258999299681006cREVGeometrycachetotal6order  cREVGeneralscriptChecksum@4aJ(F bookmarks handlerList,preOpenStack resumeStack readPrefs moveStack tempScript prevHandler preOpenStackscriptSelection char 89 to 88script

on 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 1Im cREVGeneral revUniqueID 1125899929965FileU?--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 FileCompress Expand - &Quit/Q cREVGeneralscriptChecksumE"`_%NXC revUniqueID 1125899929966 bookmarks handlerListmenuPick tempScript prevHandlermenuPickscriptSelectionchar 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

EditUt--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 !Edit0Cu&t/X &Copy/C &Paste/V Clea&r - Preferences... cREVGeneralscriptChecksum#;~ JfK4 revUniqueID 1125899929967 bookmarks handlerListmenuPick tempScript prevHandlermenuPickscriptSelectionchar 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

HelpU}--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... cREVGeneralscriptChecksumg 7e EDF revUniqueID 1125899929968 bookmarks handlerListmenuPick tempScript prevHandlermenuPickscriptSelectionchar 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

 Compresson 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 ^JK cREVGeneralscriptChecksume;qg{u revUniqueID 1046907875884 bookmarks handlerListGmouseUp doCompress dragEnter dragDrop mouseLeave mouseRelease dragLeave tempScript prevHandlermouseUpscriptSelectionchar 712 to 711script

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

Expandon 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^JL cREVGeneralscriptChecksumU_kJ DjM revUniqueID 1046908017686 bookmarks handlerListQmouseUp doExpand dragEnter dragDrop dragLeave mouseLeave mouseRelease setFileType tempScript prevHandlermouseUpscriptSelectionchar 698 to 697script

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

Prefs2k# Preferences WVerdana ULucida Grande cREVGeneralscriptChecksumُ B~ bookmarks handlerList tempScript prevHandlerscriptSelection 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 # cREVGeneralscriptChecksum 3(LV $d D bookmarks handlerList,preOpenStack clearPrefs readPrefs writePrefs tempScript prevHandler writePrefsscriptSelectionchar 812 to 811script 

on 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 groupi~on mouseUp if the hilite of btn "Folder" then enable grp "Select" else disable grp "Select" end if end mouseUp H cREVGeneralscriptChecksumo3b'Ŝ revUniqueID 1046908425509 bookmarks handlerListmouseUp tempScript prevHandlermouseUpscriptSelectionchar 113 to 112script

on 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 2Same place as original cREVGeneral revUniqueID 1046908339814 Folder`d HIn a specified location cREVGeneral revUniqueID 1046908339814 bookmarks handlerList tempScript prevHandlerscriptSelection char 1 to 0script   New Field 1  cREVGeneral revUniqueID 1046908468552 Save processed filesCancelExJon mouseUp clearPrefs save this stack close this stack end mouseUp d cREVGeneralscriptChecksum t revUniqueID 1046908551345 bookmarks handlerListmouseUp tempScript prevHandlermouseUpscriptSelection char 24 to 23scriptk

on mouseUp

clearPrefs

save this stack

close this stack

end mouseUp

DoneMxWon mouseUp writePrefs clearPrefs save this stack close this stack end mouseUp d cREVGeneralscriptChecksum9K%AṋB revUniqueID 1046908557165 bookmarks handlerListmouseUp tempScript prevHandlermouseUpscriptSelection char 75 to 74script

on mouseUp

writePrefs

clearPrefs

save this stack

close this stack

end mouseUp

Selecty6J@ 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 NR cREVGeneralscriptChecksum~,=k revUniqueID 1046908492380 bookmarks handlerListmouseUp tempScript prevHandlermouseUpscriptSelection char 95 to 94scriptK

on 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