Need help with this script...

charles61 cszasz at
Mon Oct 25 10:51:15 EDT 2010

I have the following script where the user is given the option of not saving
a new file, canceling, or saving it. The problem is that when the I select
New in the File dialog the dialog with the three options does not appear and
the fields in the open file are cleared out.

 switch pWhich
      global gOpenDataFile  --->Used to set the name of the file in a Save
   case "New Student Referral"
      go to card "referral"  
      if field "first" of card "referral" is not empty then ---> Name field
is not empty & a saved file is open.
         if gOpenDataFile is not empty then
            set the itemDel to "/"
            put item -1 of gOpenDataFile into tFileName
            answer warning "Save changes to " & tFileName &"?" with "Don't
Save" or "Cancel" or "Save" titled "Save File"
            if it = "Don't Save" then close file "file:" & gOpenDataFile
----specialFolderPath("documents") & "/Student" 
            put empty into gOpenDataFile
            unmark all cards
            set the mark of card "referral" to true
            if it = "Cancel" then exit to top --->Stop saving a new referral
            else if it ="Save" then
               IF the platform is "MacOS" 
                  put specialFolderPath("documents") & "/Student" into
               end if
               IF the platform is "win32" 
                  put specialFolderPath("documents") & "/Student" into
               end if
               if there is not a folder tNewFolder then
                  create folder tNewFolder
               end if
               ask file "Save Student file as: " with (tNewFolder &
               put it into tSaveFile
               put it into gOpenDataFile
               put empty into tAllData
               repeat with x= 1 to the number of cards
                  if the mark of card x is true then
                     put the short name of card x into tCardName
                     put "*********" & cr & tCardName & cr & "*********" &
cr after tAllData
                     put gatherData(tCardName) & cr after tAllData
                  end if
               end repeat
               put tAllData into URL ("file:" & gOpenDataFile)
               if the result is not empty then  ---> Stop here if the file
didn't save
                  answer error "There was a problem saving the current data
                  exit to top
               end if
            end if
         end if
      end if
View this message in context:
Sent from the Revolution - User mailing list archive at

More information about the Use-livecode mailing list