cancel error

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • jackdaniels
    No longer a forum member
    • Mar 2007
    • 533

    cancel error

    when i ccancel to load a page to web object it loads
    Code:
    http://cancel/
    this is the code i have on button click :
    Code:
    File = Dialog.FileBrowse(true, "Locate File", _DesktopFolder, "All Files (*.*)|*.*|", "", "dat", false, false);
    Web.LoadURL("Web1", File[1]);
  • screwed over
    Forum Member
    • Apr 2007
    • 176

    #2
    Code:
    File = Dialog.FileBrowse(true, "Locate File", _DesktopFolder, "All Files (*.*)|*.*|", "", "dat", false, false);
    if File ~= "CANCEL" then
        Web.LoadURL("Web1", File[1]);
    end
    that should fix it.

    Comment

    • jackdaniels
      No longer a forum member
      • Mar 2007
      • 533

      #3
      Originally posted by screwed over View Post
      Code:
      File = Dialog.FileBrowse(true, "Locate File", _DesktopFolder, "All Files (*.*)|*.*|", "", "dat", false, false);
      if File ~= "CANCEL" then
          Web.LoadURL("Web1", File[1]);
      end
      that should fix it.
      it didnt fix it !!!

      Comment

      • jackdaniels
        No longer a forum member
        • Mar 2007
        • 533

        #4
        this doesnt load cancel page but neither any hmtl page !!!

        Code:
        File = Dialog.FileBrowse(true, "Locate File", _DesktopFolder, "All Files (*.html)|*.html|(*.htm)|*.htm|", "", "dat", false, false);
        if (File ~= "CANCEL") then else
            Web.LoadURL("Web1", File[1]);
        end

        Comment

        • jassing
          Indigo Rose Customer
          • Jan 2001
          • 3124

          #5
          Originally posted by screwed over View Post
          Code:
          File = Dialog.FileBrowse(true, "Locate File", _DesktopFolder, "All Files (*.*)|*.*|", "", "dat", false, false);
          if File ~= "CANCEL" then
              Web.LoadURL("Web1", File[1]);
          end
          that should fix it.
          Shouldn't it be

          if File[1] ~= "CANCEL" then

          Comment

          • jackdaniels
            No longer a forum member
            • Mar 2007
            • 533

            #6
            thanks jassing thats it

            Comment

            • ShadowUK
              No longer a forum member
              • Oct 2007
              • 1322

              #7
              Actually, the above examples are wrong, As in doing Dialog.FileBrowse and making the result variable "File". You are overriding a table, So doing File.DoesExsist, or anything else it would fail as you overrided a table created by AutoPlay Media Studio.

              Comment

              • jassing
                Indigo Rose Customer
                • Jan 2001
                • 3124

                #8
                Originally posted by ShadowUK View Post
                Actually, the above examples are wrong, As in doing Dialog.FileBrowse and making the result variable "File". You are overriding a table, So doing File.DoesExsist, or anything else it would fail as you overrided a table created by AutoPlay Media Studio.
                GOOD CATCH! I'm embarassed that I didn't pick up on it...

                I always use bastardized hungarian notation for my vars.

                cVariable = String/Text
                tVariable = table
                nVariable = number/integer
                bVariable = Logical/boolean

                Ultimately; I find it easier to follow later down the line in a complex script -- and I don't run the risk of doing exactly what you pointed out.

                Comment

                • ShadowUK
                  No longer a forum member
                  • Oct 2007
                  • 1322

                  #9
                  I do:
                  • sString
                  • fFunction
                  • bBoolean
                  • tTable


                  Etc.

                  Comment

                  • jackdaniels
                    No longer a forum member
                    • Mar 2007
                    • 533

                    #10
                    can u give me a better code than i have ? well i just want to load html and htm files...

                    Comment

                    • jassing
                      Indigo Rose Customer
                      • Jan 2001
                      • 3124

                      #11
                      Originally posted by ShadowUK View Post
                      I do:
                      • sString
                      • fFunction
                      • bBoolean
                      • tTable


                      Etc.
                      Same Idea -- with one exception -- for my functions (I'd say better than 90% of them) I "integrate" them into existing objects or create new ones.

                      For instance, I have a function that returns just the filename ("file.ext") of a full path name (c:\program files\appdir\file.exe) -- that is called:

                      File.NameOnly()

                      that, I think, makes it very obvious; for new things; I just create the object itself.

                      -josh

                      Comment

                      • jackdaniels
                        No longer a forum member
                        • Mar 2007
                        • 533

                        #12
                        Originally posted by jassing View Post
                        Same Idea -- with one exception -- for my functions (I'd say better than 90% of them) I "integrate" them into existing objects or create new ones.

                        For instance, I have a function that returns just the filename ("file.ext") of a full path name (c:\program files\appdir\file.exe) -- that is called:

                        File.NameOnly()

                        that, I think, makes it very obvious; for new things; I just create the object itself.

                        -josh
                        can u give an example of
                        Code:
                        File.Nameonly()
                        ?

                        Comment

                        • jassing
                          Indigo Rose Customer
                          • Jan 2001
                          • 3124

                          #13
                          Originally posted by jackdaniels View Post
                          can u give an example of
                          Code:
                          File.Nameonly()
                          ?
                          Code:
                          function File.NameOnly( cFile )
                            local tFile = String.SplitPath( cFile );
                            return tFile.Filename .. tFile.Extension;
                          end

                          Comment

                          • ShadowUK
                            No longer a forum member
                            • Oct 2007
                            • 1322

                            #14
                            Or then again :P

                            Code:
                            01 [b][COLOR='#0000FF']function[/COLOR][/b] File[COLOR='#FF0000'].[/COLOR]GetName[COLOR='#FF0000']([/COLOR]sFile[COLOR='#FF0000'])[/COLOR] 
                            02 	[b][COLOR='#0000FF']return[/COLOR][/b] String[COLOR='#FF0000'].[/COLOR]SplitPath[COLOR='#FF0000']([/COLOR]sFile[COLOR='#FF0000'])[/COLOR][COLOR='#FF0000'].[/COLOR]Filename[COLOR='#FF0000'].[/COLOR][COLOR='#FF0000'].[/COLOR]String[COLOR='#FF0000'].[/COLOR]SplitPath[COLOR='#FF0000']([/COLOR]sFile[COLOR='#FF0000'])[/COLOR][COLOR='#FF0000'].[/COLOR]Extension 
                            03 [b][COLOR='#0000FF']end[/COLOR][/b]

                            Comment

                            • Intrigued
                              Indigo Rose Customer
                              • Dec 2003
                              • 6138

                              #15
                              And if you really want to take it out all the way... you may include one of these versions of the function into a .lua file say .. called constants.lua and then drag-n-drop it onto the default page, for example, in your AMS project. Then the constants you have in that file are accessible throughout the entire project.
                              Intrigued

                              Comment

                              Working...
                              X