REVO2700 Zip Extract Sampler on preopenstack -- Initialise the stack, putting empty into the files -- list and making sure the instruction field is visible set the text of field "Files" of card "Main" of me to empty set the blendLevel of field "Label" of card "Main" of me to 0 end preopenstack function archiveReturnContents pArchive local tResult, tItems if there is no file pArchive then return empty -- We need to open the archive first before -- we do anything. The archive only needs to be opened -- for reading, as we are not going to change it. revZipOpenArchive pArchive, "read" put the result into tResult -- Check the archive has opened correctly if tResult is not empty then answer "Error opening archive. The zip library answered: " & tResult return empty end if put revZipEnumerateItems(pArchive) into tItems return tItems end archiveReturnContents -- Given an absolute folder path, returns the name of the folder function nameFolder pPath set the itemDelimiter to slash return item -1 of pPath end nameFolder -- Given an absoute file path, returns the name of the file function nameFile pPath set the itemDelimiter to slash return item -1 of pPath end nameFile -- Shows the instruction label with a simple visual effect. -- This could easily be changed to use one of Revolution's -- build in visual effects, including quicktime or a MacOS X -- core image effect. on labelShow if the blendLevel of field "Label" of card "Main" of me is 0 then exit labelShow end if repeat with x=100 down to 0 step -2 set the blendLevel of field "Label" of card "Main" of me to x end repeat end labelShow -- Hides the instruction label. on labelHide if the blendLevel of field "Label" of card "Main" of me is 100 then exit labelHide end if repeat with x=0 to 100 step 2 set the blendLevel of field "Label" of card "Main" of me to x end repeat end labelHide S U Tahoma cRevStandaloneSettings 4scriptLibraries Animation Revolution Zip MacOSX true OSX,name Zip Extract SamplerMacOS,documentType UNIX,fileSelector trueWindows trueMacOS,longVersion Zip Extract Sampler 1.0.0.0Windows,LegalCopyright #2006 All rights reserved worldwideUNIX,pageSetup trueOSX,documentType Windows,documenticonFile v//Marcus-van-houd/marcusvanhoudt/Desktop/Masters/2.7.3-gm-1/Runtime/Windows/x86-32/Support/Sample Icons/genericdoc.icoinclusions select answerDialog trueOSX,documentExtension Windows,FileDescription 'Zip Extract Sampler 1.0.0.0 for WindowsOSX,longVersion Zip Extract Sampler 1.0.0.0 MacOSfat falseUNIX,printerChooser trueOSX,copyright #2006 All rights reserved worldwideWindows,buildU3 falseMacOS,MinimumSize 15000MacOS,versionnumber1 1MacOS,Release FinalMacOS,versionnumber2 0MacOS,versionnumber3 0name Zip Extract SamplerOSX,identifier com..zipextractsampler MacOS,Region 1OSX,shortVersion 1.0.0.0Windows,fileversion1 1Windows,fileversion2 0Windows,productversion1 1Windows,fileversion3 0Windows,productversion2 0Windows,fileversion4 0Windows,productversion3 0cursors false OSX,info #Zip Extract Sampler Version 1.0.0.0Windows,productversion4 0 MacOS68k falseMacOS,dynamicMemory trueMacOSX PowerPC-32 false askDialog trueWindows,iconFile v//Marcus-van-houd/marcusvanhoudt/Desktop/Masters/2.7.3-gm-1/Runtime/Windows/x86-32/Support/Sample Icons/genericapp.icoOSX,signature ????Windows,ProductName Zip Extract SamplerMacOS,PreferredSize 15000UNIX,colorChooser trueMacOSX x86-32 false MacOSPPC falseMacOS,creator ????Windows,companyname cREVGeneral scriptChecksum +WL6v bookmarks handlerList Jpreopenstack archiveReturnContents nameFolder nameFile labelShow labelHidetempScript prevHandler archiveReturnscriptSelection char 890 to 889stackfileversion script
on preopenstack
-- Initialise the stack, putting empty into the files
-- list and making sure the instruction field is visible
set the text of field "Files" of card "Main" of me to empty
set the blendLevel of field "Label" of card "Main" of me to 0
end preopenstack
function archiveReturnContents pArchive
local tResult, tItems
if there is no file pArchive then return empty
-- We need to open the archive first before
-- we do anything. The archive only needs to be opened
-- for reading, as we are not going to change it.
revZipOpenArchive pArchive, "read"
put the result into tResult
-- Check the archive has opened correctly
if tResult is not empty then
answer "Error opening archive. The zip library answered: " & tResult
return empty
end if
put revZipEnumerateItems(pArchive) into tItems
return tItems
end archiveReturnContents
-- Given an absolute folder path, returns the name of the folder
function nameFolder pPath
set the itemDelimiter to slash
return item -1 of pPath
end nameFolder
-- Given an absoute file path, returns the name of the file
function nameFile pPath
set the itemDelimiter to slash
return item -1 of pPath
end nameFile
-- Shows the instruction label with a simple visual effect.
-- This could easily be changed to use one of Revolution's
-- build in visual effects, including quicktime or a MacOS X
-- core image effect.
on labelShow
if the blendLevel of field "Label" of card "Main" of me is 0 then
exit labelShow
end if
repeat with x=100 down to 0 step -2
set the blendLevel of field "Label" of card "Main" of me to x
end repeat
end labelShow
-- Hides the instruction label.
on labelHide
if the blendLevel of field "Label" of card "Main" of me is 100 then
exit labelHide
end if
repeat with x=0 to 100 step 2
set the blendLevel of field "Label" of card "Main" of me to x
end repeat
end labelHide
Main @ S cREVGeneral bookmarks handlerList tempScript prevHandler scriptSelection char 1 to 0script Files )pTon dragEnter -- This will hold the list of files/folders the user -- has dragged onto the field local tData -- Get the drag data we need, and exit straight -- away if it is empty put the dragData["files"] into tData if tData is empty then exit dragEnter -- We can only accept one archive at a time. if the number of lines of tData > 1 then exit dragEnter -- The file has to be a zip archive, check its extension local tFilename put line 1 of tData into tFilename set the itemDelimiter to "." if item -1 of tFilename is not "zip" then exit dragEnter -- At this stage, the drop is going to be accepted, -- so hide the instruction label and accept the drop. labelHide set the acceptDrop to true end dragEnter on dragDrop local tFile put the dragData["files"] into tFile set the text of me to archiveReturnContents(tFile) end dragDrop on dragLeave -- This message is sent if the user decides not to drop the object -- This handler just makes the instruction label reappear if appropriate if the text of me is empty then labelShow end dragLeave J ? cREVGeneral scriptChecksum |O1-t'gUφrevUniqueID 1155052883391 bookmarks handlerList dragEnter dragDrop dragLeavetempScript prevHandler dragDropscriptSelection char 1108 to 1107script 2on dragEnter
-- This will hold the list of files/folders the user
-- has dragged onto the field
local tData
-- Get the drag data we need, and exit straight
-- away if it is empty
put the dragData["files"] into tData
if tData is empty then exit dragEnter
-- We can only accept one archive at a time.
if the number of lines of tData > 1 then exit dragEnter
-- The file has to be a zip archive, check its extension
local tFilename
put line 1 of tData into tFilename
set the itemDelimiter to "."
if item -1 of tFilename is not "zip" then exit dragEnter
-- At this stage, the drop is going to be accepted,
-- so hide the instruction label and accept the drop.
labelHide
set the acceptDrop to true
end dragEnter
on dragDrop
local tFile
put the dragData["files"] into tFile
set the text of me to archiveReturnContents(tFile)
end dragDrop
on dragLeave
-- This message is sent if the user decides not to drop the object
-- This handler just makes the instruction label reappear if appropriate
if the text of me is empty then labelShow
end dragLeave
` @ = Label . d cREVTable currentview Drag Archive to view Contents cREVGeneral revUniqueID 1155052924250 Drag Archive to view Contents Clear Mp {on mouseUp -- Clear the file list and show the instruction label put empty into field "Files" labelShow end mouseUp | R 6 cREVGeneral scriptChecksum }B=?jn*7revUniqueID 1155053681579 bookmarks handlerList mouseUptempScript prevHandler mouseUpscriptSelection char 67 to 66scripton mouseUp
-- Clear the file list and show the instruction label
put empty into field "Files"
labelShow
end mouseUp