14 Replies Latest reply on Jul 26, 2012 1:03 PM by JCPython

    ERROR: File is not authorized to reference the protected file

    JCPython

      Title

      ERROR: File is not authorized to reference the protected file

      Post

      is there any way to get arround the error code "825 : File is not authorized to reference the protected file"

      it appears when trying to import records from a copy of curent file backup of my database. the backups are made a from a runtime of my database, admin access is always removed when creating a runtime, not sure if that is a problem...

        • 1. Re: ERROR: File is not authorized to reference the protected file
          MarcMcCall

          Ive never tried this with the admin access removed, but you may be able to open the runtime, then export records as a filemaker .USR file.  Then go to the USR file created and change the .USR to .fp7 and it will turn into a filemaker file and you may be able to import from that.

          • 2. Re: ERROR: File is not authorized to reference the protected file
            MarcMcCall

            I just tried it, and it works.  I made a runtime with amin access removed, exported records as a filemaker Runtime .USR, changed the USR file to .fp7 and was able to do what ever I wanted with the records. 

            • 3. Re: ERROR: File is not authorized to reference the protected file
              philmodjunk

              Hmmm, and you can use fileMaker to rename the file. Import it into a container field and then use export field contents to export it with the .fp7 (or maybe .fmp12) extension.

              Export field contents can even be used to delete such files when done if you export to the same filepath/filename but don't specify a container field in the script step.

              • 4. Re: ERROR: File is not authorized to reference the protected file
                JCPython

                Thank you guys! I forgot to mention however that my users do not have filemaker, just the runtime, when you say export the field contents do you mean use the export script step within the runtime or as i currently have it as a "save copy of current file" script step within the runtime.

                currently my import script works like this:

                 

                • Perform Script [ “_ErrorControl” ]
                • Go to Layout [ “_SYS” (_SYS) ]
                • Set Field [ _SYS::gImportFile; "" ]
                • If [ Get (ScriptParameter ) = "Locate" ]
                • Go to Layout [ “_SYS” (_SYS) ]
                • Insert File [ _SYS::gImportFile ] [ Filters ] [ "Import Files": ( *.HPR; *.fmp12 ) ] [ Storage method: Reference ] [ Display content ] [ Compression: Never compress ]
                • Set Field [ _SYS::gLastError; Get (LastError) ]
                • Set Variable [ $SourceFilePath; Value:GetAsText( _SYS::gImportFile ) ]
                • Set Variable [ $SourceFileName; Value:Let ( [ posBackSlash = Position ( $SourceFilePath ;"/"; Length ( $SourceFilePath); -1) ]; Right ( $SourceFilePath ; Length ( $SourceFilePath) - posBackSlash ) ) ]
                • If [ _SYS::gLastError =1 // User Cancelled Import Dialog ]
                • Halt Script
                • Go to Layout [ “Registration” (Master Software File) ]
                • Perform Script [ “Startup” ]
                • Else
                • Perform Script [ “Import Table Data”; Parameter: $SourceFilePath ]
                • End If
                • End If

                 

                After the file is selected the "import table data" script is as follows:

                 

                 

                • Set Variable [ $SourceFilePath; Value:Get (ScriptParameter) ]
                • Freeze Window
                • #===START IMPORTS
                • #Master Software File
                • Go to Layout [ “Master Software File” (Master Software File) ]
                • Show All Records
                • Delete All Records [ No dialog ]
                • Import Records [ Source: “$SourceFilePath”; Target: “Master Software File”; Method: Add; Character Set: “Windows ANSI”; Field Mapping:MATCHING FIELDS [ No dialog ]
                • Sort Records [ Keep records in sorted order; Specified Sort Order: Reptiles::date_created; descending Reptiles::ReptileID; descending ] [ Restore; No dialog ]
                • Go to Record/Request/Page [ First ]
                • Set Next Serial Value [ Line Items::Record ID; Line Items::Record ID + 1 ]
                • #Reptiles
                • Go to Layout [ “Reptiles” (Reptiles) ]
                • Show All Records
                • Delete All Records [ No dialog ]
                • Import Records [ Source: “$SourceFilePath”; Target: “Reptiles”; Method: Add; Character Set: “Windows ANSI”; Field Mapping:MATCHING FIELDS [ No dialog ]
                • Sort Records [ Keep records in sorted order; Specified Sort Order: Reptiles::date_created; descending Reptiles::ReptileID; descending ] [ Restore; No dialog ]
                • Go to Record/Request/Page [ First ]
                • Set Next Serial Value [ Reptiles::ReptileID; Reptiles::ReptileID + 1 ]
                • #Contacts
                • Go to Layout [ “Record Details-Contacts” (Contacts) ]
                • Show All Records
                • Delete All Records [ No dialog ]
                • Import Records [ Source: “$SourceFilePath”; Target: “Contacts”; Method: Add; Character Set: “Windows ANSI”; Field Mapping: MATCHING FIELDS [ No dialog ]
                • Sort Records [ Keep records in sorted order; Specified Sort Order: Reptiles::date_created; descending Reptiles::ReptileID; descending ] [ Restore; No dialog ]
                • Go to Record/Request/Page [ First ]
                • Set Next Serial Value [ Contacts::ContactID; Contacts::ContactID + 1 ]

                The import table data script continues on the same for each table, roughly 50 tables.

                I dont wanna have to restores the users data myself, would like it to be able to for them to do themselves a complete backup and restore without getting to technical as many of the users are not very computer savvy.

                • 5. Re: ERROR: File is not authorized to reference the protected file
                  philmodjunk

                  Save a copy can rename  the file too as you can specify the file name when your script uses that option to save the file.

                  • 6. Re: ERROR: File is not authorized to reference the protected file
                    JCPython

                    Ok i just specified the file name as Scripted_Backup.fmp12 and when i ran my import script then it did all the script steps such as going to the layouts, showing all records, deleting them but it never imported the records from the backup.

                    • 7. Re: ERROR: File is not authorized to reference the protected file
                      philmodjunk

                      Looking at your first script, I'd do the following:

                      (Note: I'm assuming that you have created a converted copy of the file with .HPR as the file extension before this script is run.)

                      Insert File [ _SYS::gImportFile ] [ Filters ] [ "Import Files": ( *.HPR ) ] [ Storage method: Reference ] [ Display content ] [ Compression: Never compress ]
                      Set Field [ _SYS::gLastError; Get (LastError) ]
                      If [Not _SYS::gLastError // user did not click cancel ]
                         Set Variable [ $SourceFilePath; Value:GetValue( _SYS::gImportFile ; 2 ) ]
                         Set Variable [ $SourceFileName; Value:Let ( [ posBackSlash = Position ( $SourceFilePath ;"/"; Length ( $SourceFilePath); -1) ]; Right ( $SourceFilePath ; Length ( $SourceFilePath) - posBackSlash ) ) ]
                         Set Variable [$NewFileName ; value: Left ( $SourceFileName ; Length ( $SourceFileName ) - 4 ) & ".fmp12" ]
                         Set Variable [$TempPath ; value: Get ( TemporaryPath ) & $NewFileName ]
                         Export Field Contents ( _SYS::gImportFile ; $TempPath ]
                         Perform Script [ “Import Table Data”; Parameter: $TempPath ]
                      Else
                         # do the stuff for when user clicked cancel button.
                        

                      • 8. Re: ERROR: File is not authorized to reference the protected file
                        JCPython

                        Im gonna give this a shot after i get my daughter to sleep, but before i do i just want to clarify one thing.

                        (Note: I'm assuming that you have created a converted copy of the file with .HPR as the file extension before this script is run.)

                        What do you mean by converted, not sure if you meant from fm11 to fm12 or if this file was renamed but just to say that fm11 has nothing to do with this its all done with fm12 and the backup script i have will only save the file as .HPR when the script is executed from the runtime. Hope that made sence.

                        • 9. Re: ERROR: File is not authorized to reference the protected file
                          philmodjunk

                          Ok, I've assumed this was part of your project to enable users to update a runtime created in FileMaker 11 to FileMaker 12 file format then import the data into an updated copy of the file.

                          What I have described still works, but I'm suprised that the name change is needed. So this is the "other project"--restore from backup? I've already described an option in another thread that does not need any importing as you would just duplicate and rename an entire backup solution folder.

                          Going with the Save a copy as step that creates the file in the first place. The save a copy as script step can change the name of the file it creates to use the .fmp12 file extension in place of the .hpr format at the time it saves the copy.

                          • 10. Re: ERROR: File is not authorized to reference the protected file
                            JCPython

                            Ok, I've assumed this was part of your project to enable users to update a runtime created in FileMaker 11 to FileMaker 12 file format then import the data into an updated copy of the file.

                            Yes still may still be a issue and when i have the opportunity to upgrade someones runtime from fm11 to fm12 ill certainly try that, this particular problem though is stricktly for fm12.

                            What I have described still works, but I'm suprised that the name change is needed. So this is the "other project"--restore from backup? I've already described an option in another thread that does not need any importing as you would just duplicate and rename an entire backup solution folder.

                             remeber that thread, where i create a extra folder called "Backup" and the users have a duplicate of all the runtime files for the solution, but i just cant get my head around the proces of how the user would backup up and restore himself, i hate to be a pain but could you give me a step by step on how the user will do this

                            Going with the Save a copy as step that creates the file in the first place. The save a copy as script step can change the name of the file it creates to use the .fmp12 file extension in place of the .hpr format at the time it saves the copy.

                             

                            So that means  the users will have a .fmp12 extension on their backup instead of the .HPR? sorry confused again.

                            • 11. Re: ERROR: File is not authorized to reference the protected file
                              philmodjunk

                              could you give me a step by step on how the user will do this

                              This method assumes that all externally stored files have also been backed up to an identically named, structured set of folder in the backup solution folder.

                              Manually:

                              Change the name or move the current solution folder.

                              Then in windows: Right Click the backup solution folder and select copy. Then right click the window that contains the backup solution folder and choose Paste. Then rename the new folder to give it the same name as the original solution folder.

                              ON mac: (Hope I get this right), select the backup solution folder and use the duplicate command to duplicate the entire folder. Rename the new copy to match that of the original solution folder.

                              The end result should be a new cop of the backup solution folder in the same location and with the same name as the original solution folder that needed to be replaced with the backup system

                              Automated:

                              On windows, include a batch file with your solution that uses command line instructions to duplicate and rename the backup solution folder. Other system scripting tools such as VBScript can do this also.

                              On Mac, use a different system script method such as AppleScript compatible with the mac OS to do the same.

                              With the automated approach, you can have your installer install a file that the user double clicks to do this.

                              So that means  the users will have a .fmp12 extension on their backup instead of the .HPR?

                              Exactly. But keep in mind how this will keep the "restore by duplicating entire solution folder" method from working. It's one or the other, but not both unless you save two copies of the file to your backup solution folder--1 with .HPR and one with .FMP12. (Or I suppose that those system scripts could also change the file extension of the backup database file when copying and renaming the backupsolution folder.)

                              • 12. Re: ERROR: File is not authorized to reference the protected file
                                JCPython

                                Looks like maybe the easiest way to do this is by using the manual method as i have no idea what vb script is or how to implement it.

                                just a thought but instead of having a save copy of current record or even having a backup folder to duplicate the solution files, couldn't the user just right click the install folder and copy and paste it to his own prefer ed location and that would take care of the backup right? then to restore a backup he could then just take the .HPR or .fmpur file from the backup folder and replace it in the original install folder? would this work? its late and it was just a hopeful thought lol

                                also if the above idea could work then would i be able to continue to use the .HPR extension, and if that were to work im assuming it would not be doable when updating the runtime solution, or could it be?

                                • 13. Re: ERROR: File is not authorized to reference the protected file
                                  philmodjunk

                                  i have no idea what vb script is or how to implement it.

                                  It's a system scripting tool that can control windows computers. You can web search it and find sites that will teach you how to create them. There are a number of other system scripting tools--including Ye olde batch file that can do the same thing.

                                  just a thought...

                                  Yes that can work quite well, but it has a crucial weak point: It relies on the user actually doing this on a regular basis and doing it correctly. How often do you forget to manually back something up? (I'd hate to answer that question myself Wink.)

                                  There's also the risk that the user will try this while the solution is open and this can produce a damaged backup file.

                                  I've assumed from the start that you wanted to script a backup method so that this happened automatically with no risk of producing a damaged copy of the database file.

                                  • 14. Re: ERROR: File is not authorized to reference the protected file
                                    JCPython

                                    It's a system scripting tool that can control windows computers. You can web search it and find sites that will teach you how to create them. There are a number of other system scripting tools--including Ye olde batch file that can do the same thing.

                                    I will check this out right now :)

                                     

                                    Yes that can work quite well, but it has a crucial weak point: It relies on the user actually doing this on a regular basis and doing it correctly. How often do you forget to manually back something up? (I'd hate to answer that question myself Wink.)

                                    There's also the risk that the user will try this while the solution is open and this can produce a damaged backup file.

                                    I've assumed from the start that you wanted to script a backup method so that this happened automatically with no risk of producing a damaged copy of the database file.

                                    Yes automated is for sure the main goal, but until i get that working properly ill have to find a fast easy way to set it up, i was thinking i could assign a nag screen after so many times the program is opened/closed that a custom dialog appears reminding them to backup along with instructions on how to.