#!/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 "$@" Main * -- ___ _______ _______________________ _ ______ -- / _ \/ _/ _ \/ __/ ___/_ __/ _/ __ \/ |/ / __/ -- / // // // , _/ _// /__ / / _/ // /_/ / /\ \ -- /____/___/_/|_/___/\___/ /_/ /___/\____/_/|_/___/ --This 'player' standalone was created as a way of auto-updating client --applications via the Internet to create true 'Web Apps.' -- --In this way, this standalone can be compiled for Windows, Macs, Unix --and Linux. The application source file is stored on a remote web server --and is stored only as a stack and not a standalone executable, --therefore downloads are small. Also, you only have to make a single --stack for all platforms. -- --In order to use this stack, there are three Global VARIABLES you'll --need to change in the OpenStack script. URLtoload is the URL of the --stack you want to download. URLStackName is the stack name of the --stack to be downloaded and checked. This stack needs to have a field --named "version" on the first card. The CurrentStack variable is the --filename of the stack to be saved locally -- so it is not necessary --to be connected or even online to use the application. -- --When the program is first launched, it looks for the CurrentStack --locally, if it doens't find it, it prompts the user to go online --and automatically download it. Once downloaded, the "Check for Updates" --button can be used to see if a different version exists. The check --goes like this: if the CurrentStack field "version" is different from --URLStackName field "version", then URLStackName replaces CurrentStack. -- --One other thing, you'll need to add the following to the closestack --handler of your stack. --on closeStack -- if fld "tester" of stack "Main" is empty then quit --end closeStack --This way it will shut down properly -- --Features implemented: -- Status Messages regarding progress of download -- Timeout message supported -- --Features to Add: -- Auto-notification of new updates -- Nicer Screen Design -- Auto-close property after window launches global versionNum global URLtoload, URLStackName, CurrentStack on OpenStack --SET GLOBALS --URLtoload is the URL of the stack you want to download --URLStackName is the Stack Name of the stack that is being downloaded --CurrentStack is the filename of the stack which will be saved locally put "http://www.altuit.com/hemtools/latest.rev" into URLtoload put "CaptureJPG" into URLStackName put "current.rev" into CurrentStack set the defaultstack to me set the visible of image "chasing arrows.gif" to false set the destroyStack of this stack to true put the Long Date && the Time into field "tester" if exists(stack CurrentStack) is false then addMsg "No latest Stack found" answer question "You need to download the application" with "Not Now" or "Okay" titled "Files Needed" if it is "Okay" then put .5 into versionNum checkforupdates end if else addMsg "current.rev Stack found" open stack CurrentStack show stack CurrentStack end if end OpenStack on AddMsg theText put theText into line (the number of lines of fld "tester" of stack "Main" + 1) of fld "tester" of stack "Main" select last word of fld "tester" of stack "Main" select empty end AddMsg on checkforupdates set the visible of image "chasing arrows.gif" to true --set the repeatCount of image "chasing arrows.gif" to -1 AddMsg "checking for updates" load URL URLtoload --with message "downloadComplete" downloadStatus end checkforupdates on downloadStatus Get the URLStatus of URLtoload AddMsg "Download Status: " && it switch it case "cached" set the visible of image "chasing arrows.gif" to false downloadComplete exit to top case "socket timeout" set the visible of image "chasing arrows.gif" to false unload URL URLtoload answer error "Timeout: File could not be downloaded." with "Okay" exit to top case "error" set the visible of image "chasing arrows.gif" to false unload URL URLtoload answer error "Error: File could not be downloaded." with "Okay" exit to top case it contains "Invalid URL" set the visible of image "chasing arrows.gif" to false unload URL URLtoload answer error "Error: Invalid URL." with "Okay" exit to top case "not found" set the visible of image "chasing arrows.gif" to false unload URL URLtoload answer error "File Not Found: File could not be downloaded." with "Okay" exit to top default send "downloadStatus" to this stack in 5 seconds end switch end downloadStatus on downloadComplete --set the repeatCount of image "chasing arrows.gif" to 0 set the visible of image "chasing arrows.gif" to false --AddMsg "URLStatus: " & theStatus --if theStatus <> "cached" then --answer error "File could not be downloaded" with "Okay" --exit to top --end if AddMsg "latest.rev file cached" --CHECK FOR VERSION NUMBER open invisible stack URL URLtoload if not exists(stack URLStackName) then answer error "File could not be downloaded" with "Okay" unload URL URLtoload exit to top end if AddMsg "version of latest.rev" && field "version" of stack URLStackName AddMsg "version of current.rev" && versionNum if fld "version" of stack URLStackName is not versionNum then --open stack URL URLtoload save stack URLStackName as CurrentStack unload URL URLtoload delete stack URLStackName open stack CurrentStack show stack CurrentStack else delete stack URLStackName unload URL URLtoload open stack CurrentStack show stack CurrentStack answer information "No updates available at this time" with "Okay" end if end downloadComplete on closeStack put empty into fld "tester" set the visible of image "chasing arrows.gif" to false if the number of lines in mainstacks() = 1 then beep quit end if end closeStack i revstack false W Verdana W Verdana W Arial W Arial cREVGeneral scriptChecksum ZʃBѓ bookmarks handlerList KOpenStack AddMsg checkforupdates downloadStatus downloadComplete closeStacktempScript prevHandler AddMsgscriptSelection char 1755 to 1754script +
-- ___ _______ _______________________ _ ______
-- / _ \/ _/ _ \/ __/ ___/_ __/ _/ __ \/ |/ / __/
-- / // // // , _/ _// /__ / / _/ // /_/ / /\ \
-- /____/___/_/|_/___/\___/ /_/ /___/\____/_/|_/___/
--This 'player' standalone was created as a way of auto-updating client
--applications via the Internet to create true 'Web Apps.'
--
--In this way, this standalone can be compiled for Windows, Macs, Unix
--and Linux. The application source file is stored on a remote web server
--and is stored only as a stack and not a standalone executable,
--therefore downloads are small. Also, you only have to make a single
--stack for all platforms.
--
--In order to use this stack, there are three Global VARIABLES you'll
--need to change in the OpenStack script. URLtoload is the URL of the
--stack you want to download. URLStackName is the stack name of the
--stack to be downloaded and checked. This stack needs to have a field
--named "version" on the first card. The CurrentStack variable is the
--filename of the stack to be saved locally -- so it is not necessary
--to be connected or even online to use the application.
--
--When the program is first launched, it looks for the CurrentStack
--locally, if it doens't find it, it prompts the user to go online
--and automatically download it. Once downloaded, the "Check for Updates"
--button can be used to see if a different version exists. The check
--goes like this: if the CurrentStack field "version" is different from
--URLStackName field "version", then URLStackName replaces CurrentStack.
--
--One other thing, you'll need to add the following to the closestack
--handler of your stack.
--on closeStack
-- if fld "tester" of stack "Main" is empty then quit
--end closeStack
--This way it will shut down properly
--
--Features implemented:
-- Status Messages regarding progress of download
-- Timeout message supported
--
--Features to Add:
-- Auto-notification of new updates
-- Nicer Screen Design
-- Auto-close property after window launches
global versionNum
global URLtoload, URLStackName, CurrentStack
on OpenStack
--SET GLOBALS
--URLtoload is the URL of the stack you want to download
--URLStackName is the Stack Name of the stack that is being downloaded
--CurrentStack is the filename of the stack which will be saved locally
put "http://www.altuit.com/hemtools/latest.rev" into URLtoload
put "CaptureJPG" into URLStackName
put "current.rev" into CurrentStack
set the defaultstack to me
set the visible of image "chasing arrows.gif" to false
set the destroyStack of this stack to true
put the Long Date && the Time into field "tester"
if exists(stack CurrentStack) is false then
addMsg "No latest Stack found"
answer question "You need to download the application" with "Not Now" or "Okay" titled "Files Needed"
if it is "Okay" then
put .5 into versionNum
checkforupdates
end if
else
addMsg "current.rev Stack found"
open stack CurrentStack
show stack CurrentStack
end if
end OpenStack
on AddMsg theText
put theText into line (the number of lines of fld "tester" of stack "Main" + 1) of fld "tester" of stack "Main"
select last word of fld "tester" of stack "Main"
select empty
end AddMsg
on checkforupdates
set the visible of image "chasing arrows.gif" to true
--set the repeatCount of image "chasing arrows.gif" to -1
AddMsg "checking for updates"
load URL URLtoload
--with message "downloadComplete"
downloadStatus
end checkforupdates
on downloadStatus
Get the URLStatus of URLtoload
AddMsg "Download Status: " && it
switch it
case "cached"
set the visible of image "chasing arrows.gif" to false
downloadComplete
exit to top
case "socket timeout"
set the visible of image "chasing arrows.gif" to false
unload URL URLtoload
answer error "Timeout: File could not be downloaded." with "Okay"
exit to top
case "error"
set the visible of image "chasing arrows.gif" to false
unload URL URLtoload
answer error "Error: File could not be downloaded." with "Okay"
exit to top
case it contains "Invalid URL"
set the visible of image "chasing arrows.gif" to false
unload URL URLtoload
answer error "Error: Invalid URL." with "Okay"
exit to top
case "not found"
set the visible of image "chasing arrows.gif" to false
unload URL URLtoload
answer error "File Not Found: File could not be downloaded." with "Okay"
exit to top
default
send "downloadStatus" to this stack in 5 seconds
end switch
end downloadStatus
on downloadComplete
--set the repeatCount of image "chasing arrows.gif" to 0
set the visible of image "chasing arrows.gif" to false
--AddMsg "URLStatus: " & theStatus
--if theStatus <> "cached" then
--answer error "File could not be downloaded" with "Okay"
--exit to top
--end if
AddMsg "latest.rev file cached"
--CHECK FOR VERSION NUMBER
open invisible stack URL URLtoload
if not exists(stack URLStackName) then
answer error "File could not be downloaded" with "Okay"
unload URL URLtoload
exit to top
end if
AddMsg "version of latest.rev" && field "version" of stack URLStackName
AddMsg "version of current.rev" && versionNum
if fld "version" of stack URLStackName is not versionNum then
--open stack URL URLtoload
save stack URLStackName as CurrentStack
unload URL URLtoload
delete stack URLStackName
open stack CurrentStack
show stack CurrentStack
else
delete stack URLStackName
unload URL URLtoload
open stack CurrentStack
show stack CurrentStack
answer information "No updates available at this time" with "Okay"
end if
end downloadComplete
on closeStack
put empty into fld "tester"
set the visible of image "chasing arrows.gif" to false
if the number of lines in mainstacks() = 1 then
beep
quit
end if
end closeStack
@ New Field 1 % Z cREVGeneral bookmarks revUniqueID 1006732068804handlerList scriptSelection char 1 to 0prevHandler tempScript script Message: tester )` : h cREVGeneral revUniqueID 1006755026122 %Wednesday, November 28, 2001 2:52 AM No latest Stack found ` @ ; f Check For Updates Ep global VersionNum global URLStackName on mouseUp if exists(stack URLStackName) then put field "version" of stack URLStackName into VersionNum delete stack URLStackName else put 0.5 into VersionNum end if checkforupdates end mouseUp z ~ 4U 4S 4R 4Q 4T cREVGeneral scriptChecksum Kowj.|nerevUniqueID 1006755971509 bookmarks handlerList mouseUptempScript prevHandler mouseUpscriptSelection char 38 to 37script Pglobal VersionNum
global URLStackName
on mouseUp
if exists(stack URLStackName) then
put field "version" of stack URLStackName into VersionNum
delete stack URLStackName
else
put 0.5 into VersionNum
end if
checkforupdates
end mouseUp
chasing arrows.gif @ h 210073 GIF89a !NETSCAPE2.0 ! , <