On 10/8/21 8:24 AM, Bob Sneidar via use-livecode wrote:
Where did you find this script? I am pondering adding this to my "scripts to replace 
when I download a new version" list.

It's in revbackscriptlibrary.livecodescript.
Here's an improved version that avoids that double cancel.

on reloadStack pStackName, pFileName
   if the filename of stack pStackName is pFileName then
      toplevel pStackName
   else
      set the defaultStack to pStackName

      local tFilePath, tFileLongPath
      put the effective fileName of stack pStackName into tFilePath
      put tFilePath into tFileLongPath
        if tFileLongPath is empty then
            put pStackName into tFileLongPath
            put comma && pStackName & "?" after tFilePath
        else
            put pStackName & "?" into tFilepath
        end if
answer warning "A stack with the name"&&pStackName&&"is already open." & cr & "Before loading" && pFileName & ", what do you want to do with stack:" & cr & tFilePath with "Rename" or "Save" or "Purge" or "Cancel"
    local tAction
    put it into tAction
      if gREVSuppressMessages then
         lock messages
         send "revInsertMessageBlock" to me in 100 milliseconds
         revInternal__UnloadLibrary "revNoMessagesLibrary"
      end if

     local tLockMessages
      put the lockMessages into tLockMessages

     switch tAction
        case "Cancel"
            exit to top
        case "Rename"
            ask "Enter a name for the stack in memory"
            if it is not empty and it is not pStackName then
                set the name of stack tFileLongPath to it
                go stack pFileName
            else
                exit to top
            end if
            break
        case "Save"
            if the filename of stack pStackName is empty then
                revSaveAs pStackName
            else
                revSave pStackName
            end if
        case "Purge"
            revAOUpdateForDeleteStack pStackName
            lock messages
            delete stack pStackName
            set the lockMessages to tLockMessages
            go stack pFileName
            break
     end switch
   end if

   if there is a stack "revApplicationOverview" then
send "revNewStack the short name of stack pFileName" to stack "revApplicationOverview"
   end if
end reloadStack

--
 Mark Wieder
 ahsoftw...@gmail.com

_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to