8 Replies Latest reply on Sep 2, 2009 3:03 AM by Sean_Wilson

    Fileio user permission problem in director 11.5

    gopal73thakkar

      hi,

      i am making application for windows in director with fileio xtra and i am trying to open xml file with fileio open file command and then read it eith fileio.readfile() command, it is work fine when my windows xp system login with administrator rights user but when i am login with user permission it is giving me a blank string what is the issue i dont understand, any body help me pls. (it is urgent)

       

      Note:- xml file path getting from windows registry by buddy api's baReadRegString() command

      my lingo code is like this

       

       

       

       

       

       

       

       

       

      global

      Gdb

      global

      glinenum,sname,chb,fname,st

      property

      presult

      global

      gParserObject,objFileio,epath,abc,theList,errCode

      on

      startmovieme

      go

      to frame 1

       

       

       

      abc = baReadRegString("SOFTWARE", "AXDM", "False", "HKEY_LOCAL_MACHINE")& "vlc\SETTINGS.XML"

       

       

      objFileio = new xtra("fileio")

       

       

      objFileio.openFile(abc,0)

       

       

       

       

       

       

       

       

      member("XMLtext").text = objFileio.readFile(abc)  -- here i get error String expected

       

       

       

       

      gParserObject = new(xtra "xmlparser")

       

      errCode = gParserObject.parseString(abc)

       

       

       

      theList = gParserObject.makeList()

      st = false

      end

       

       

      thanks

        • 1. Re: Fileio user permission problem in director 11.5
          Sean_Wilson Adobe Community Professional

          You don't appear to be doing even the most basic error checking. Start by adding:

          objFileio.openFile(abc,0)
          if objFileio.status() <> 0 then
            -- an error occurred
            alert "Error:" && objFileio.status()
            -- no point trying to continue
            exit
          end if
          
          • 2. Re: Fileio user permission problem in director 11.5
            gopal73thakkar Level 1

            thaks Sean_Wilson

             

             

            when i add your code with my code it will give me alert massage  "error: - 38", will u explain me what is the error.

             

             

            thanks

            • 3. Re: Fileio user permission problem in director 11.5
              Sean_Wilson Adobe Community Professional

              You have taken me too literally. I was suggesting that you need to do more error checking (defensive programming) so don't focus on the specific example I posted. Here's another attempt at steering you in a more defensive direction:

              global Gdb
              global glinenum,sname,chb,fname,st
              property presult
              global gParserObject,objFileio,epath,abc,theList,errCode
              
              on startmovie
                tFile = baReadRegString("SOFTWARE", "AXDM", "False", "HKEY_LOCAL_MACHINE")& "vlc\SETTINGS.XML"
                -- you are already using Buddy API, so let's check the file exists before opening it:
                if baFileExists(tFile) then 
                  fio = xtra("FileIO").new()
                  if objectP(fio) = 0 then
                    alert "Error creating FileIO instance"
                    exit
                  end if
                  
                  fio.openFile(tFile, 0)
                  tStatus = fio.status()
                  if tStatus <> 0 then
                    alert "Error opening file:" && tStatus
                    exit
                  end if
                  
                  tText = fio.readFile()
                  tStatus = fio.status()
                  if tStatus <> 0 then
                    alert "Error reading file:" && tStatus
                    exit
                  end if
                  
                  fio.closeFile()
                  
                  member("XMLtext").text = tText
                  gParserObject = xtra("XMLParser").new()
                  if objectP(gParserObject) = 0 then
                    alert "Error creating XMLParser instance"
                    exit
                  end if
                  
                  gParserObject.parseString(tText)
                  if gParserObject.getError() = 0 then
                    theList = gParserObject.makeList()
                  else
                    alert "Error parsing XML:" && gParserObject.getError()
                    exit
                  end if
                  
                  st = false
                else
                  alert "File not found:" && tFile
                end if
              end
              

              If you're still having trouble, try scattering some 'alert' statements amongst your code so that you can verify that variables have values you expect before using them - that should help you narrow it down.

              • 4. Re: Fileio user permission problem in director 11.5
                gopal73thakkar Level 1

                hi Sean,

                 

                Your code is help full in my project and some of my problem is solved.

                 

                this is my first project with fileio and xml so i dont know more about that.

                 

                Onether question for my project is the xml file is on the right path like "C:\Program File(x86)\design\axdm\vlc\settings.xml" and when i am open it from explorer it will open without admin rights on wimdows xp machine  but from director it will not open, any other comment for this problem.

                 

                thanks

                • 5. Re: Fileio user permission problem in director 11.5
                  gopal73thakkar Level 1

                  this is the mistak duto my net link down

                  • 6. Re: Fileio user permission problem in director 11.5
                    Chunick Level 3

                    Reading the registry key in HKLM might not be working with the limited user account. This can be easily tested by checking what your variable abc is when using the limited user account... I'm guessing it's = "" (empty string).

                    • 7. Re: Fileio user permission problem in director 11.5
                      gopal73thakkar Level 1

                      hi joshua,

                       

                      you are right but in my case i read registry and make a file path and when i trace variable abc it is return right path with any permission.

                       

                      the problem is after getting file path and name the fileio xtra not open the file and it is return error -38 which describe file not open.

                       

                       

                       

                       

                      thanks

                      • 8. Re: Fileio user permission problem in director 11.5
                        Sean_Wilson Adobe Community Professional
                        the problem is after getting file path and name the fileio xtra not open the file and it is return error -38 which describe file not open.

                        So after adding some error checking you can now see what the error is? I suspect it's a permissions problem - you could try embedding a manifest file into the stub before you create a projector as described here (under the section "Running your program as Administrator") and see if that helps.

                         

                        Please don't edit your previous posts like you did - you risk having them missed. Instead you should post with a new message in the same thread.