Loading ...
Sorry, an error occurred while loading the content.
 

URL

Expand Messages
  • henriknilson
    Hey How can we open a link of URL by push button of LB, like the following incomplete code which does not work! Thank you The Code ... nomainwin WindowWidth=
    Message 1 of 9 , Oct 30, 2009
      Hey
      How can we open a link of URL by push button of LB, like the following incomplete code which does not work!
      Thank you

      'The Code
      --------------
      nomainwin
      WindowWidth= 400
      WindowHeight= 300
      UpperLeftX=INT( (DisplayWidth- WindowWidth) /2)
      UpperLeftY=INT( (DisplayHeight- WindowHeight) /2)
      BackgroundColor$ = "Green"
      BUTTON #A.0 "LB", [LB],UL, 5, 5, 70, 25
      [LB]
      'http://www.libertybasic.com/basic.html
      BUTTON #A.3 "LBGROUP", [LBGROUP], UL, 153, 5, 70, 25
      [LBGROUP]
      'http://groups.yahoo.com/group/libertybasic/
      BUTTON #A.2 "LBFORUM", [LBFORUM], UL, 300, 5, 70, 25
      [LBFORUM]
      'http://libertybasic.conforums.com/index.cgi
      BUTTON #A.1 "Quit", [quit],UL, 300, 230, 70, 25
      OPEN "URL" FOR DIALOG AS #A
      wait'
      [quit]
      CLOSE #A
      END
    • Richard
      ... The code below does something approximating to what you want. Richard. The Code nomainwin WindowWidth= 400 WindowHeight= 300 UpperLeftX=INT(
      Message 2 of 9 , Oct 30, 2009
        --- In libertybasic@yahoogroups.com, "henriknilson" wrote:
        > How can we open a link of URL by push button of LB, like the
        > following incomplete code which does not work!

        The code below does something approximating to what you want.

        Richard.

        'The Code
        nomainwin
        WindowWidth= 400
        WindowHeight= 300
        UpperLeftX=INT( (DisplayWidth- WindowWidth) /2)
        UpperLeftY=INT( (DisplayHeight- WindowHeight) /2)
        BackgroundColor$ = "Green"
        BUTTON #A.0 "LB", [LB],UL, 5, 5, 70, 25
        BUTTON #A.3 "LBGROUP", [LBGROUP], UL, 153, 5, 70, 25
        BUTTON #A.2 "LBFORUM", [LBFORUM], UL, 300, 5, 70, 25
        BUTTON #A.1 "Quit", [quit],UL, 300, 230, 70, 25
        OPEN "URL" FOR DIALOG AS #A
        hwnd = HWND(#A)
        [cont]
        wait
        [quit]
        CLOSE #A
        END

        [LB]
        calldll #shell32, "ShellExecuteA", hwnd as ulong, _
        0 as ulong, "http://www.libertybasic.com/basic.html" as ptr, _
        "" as ptr, "" as ptr, _SW_SHOWNORMAL as ulong, ret as ulong
        goto [cont]

        [LBGROUP]
        calldll #shell32, "ShellExecuteA", hwnd as ulong, _
        0 as ulong, "http://groups.yahoo.com/group/libertybasic/" as ptr, _
        "" as ptr, "" as ptr, _SW_SHOWNORMAL as ulong, ret as ulong
        goto [cont]

        [LBFORUM]
        calldll #shell32, "ShellExecuteA", hwnd as ulong, _
        0 as ulong, "http://libertybasic.conforums.com/index.cgi" as ptr, _
        "" as ptr, "" as ptr, _SW_SHOWNORMAL as ulong, ret as ulong
        goto [cont]
      • Henrik
        Thank you Richard, but we have to modify the sites as the following so they would be open, I don’t know why. (I have copied the URL from the website itself
        Message 3 of 9 , Oct 30, 2009
          Thank you Richard, but we have to modify the sites as the following so they would be open, I don’t know why. (I have copied the URL from the website itself in my first message  as I did in this message.
           
          'http://www.libertybasic.com/
          'The Code
          nomainwin
          WindowWidth= 400
          WindowHeight= 300
          UpperLeftX=INT( (DisplayWidth- WindowWidth) /2)
          UpperLeftY=INT( (DisplayHeight- WindowHeight) /2)
          BackgroundColor$ = "Green"
          BUTTON #A.0 "LB", [LB],UL, 5, 5, 70, 25
          BUTTON #A.3 "LBGROUP", [LBGROUP], UL, 153, 5, 70, 25
          BUTTON #A.2 "LBFORUM", [LBFORUM], UL, 300, 5, 70, 25
          BUTTON #A.1 "Quit", [quit],UL, 300, 230, 70, 25
          OPEN "URL" FOR DIALOG AS #A
          hwnd = HWND(#A)
          [cont]
          wait
          [quit]
          CLOSE #A
          END
          [LB]
          calldll #shell32, "ShellExecuteA" , hwnd as ulong, _
          0 as ulong, "http://www.libertybasic.com/" as ptr, _
          "" as ptr, "" as ptr, _SW_SHOWNORMAL as ulong, ret as ulong
          goto [cont]
          [LBGROUP]
          calldll #shell32, "ShellExecuteA" , hwnd as ulong, _
          0 as ulong, "http://groups.yahoo.com/group/libertybasic/" as ptr, _
          "" as ptr, "" as ptr, _SW_SHOWNORMAL as ulong, ret as ulong
          goto [cont]
          [LBFORUM]
          calldll #shell32, "ShellExecuteA" , hwnd as ulong, _
          0 as ulong, "http://libertybasic.conforums.com/index.cgi" as ptr, _
          "" as ptr, "" as ptr, _SW_SHOWNORMAL as ulong, ret as ulong
          goto [cont]
           

          --- On Fri, 10/30/09, Richard <yahoo@...> wrote:


          From: Richard <yahoo@...>
          Subject: [libertybasic] Re: URL
          To: libertybasic@yahoogroups.com
          Date: Friday, October 30, 2009, 5:02 PM


           



          --- In libertybasic@ yahoogroups. com, "henriknilson" wrote:
          > How can we open a link of URL by push button of LB, like the
          > following incomplete code which does not work!

          The code below does something approximating to what you want.

          Richard.

          'The Code
          nomainwin
          WindowWidth= 400
          WindowHeight= 300
          UpperLeftX=INT( (DisplayWidth- WindowWidth) /2)
          UpperLeftY=INT( (DisplayHeight- WindowHeight) /2)
          BackgroundColor$ = "Green"
          BUTTON #A.0 "LB", [LB],UL, 5, 5, 70, 25
          BUTTON #A.3 "LBGROUP", [LBGROUP], UL, 153, 5, 70, 25
          BUTTON #A.2 "LBFORUM", [LBFORUM], UL, 300, 5, 70, 25
          BUTTON #A.1 "Quit", [quit],UL, 300, 230, 70, 25
          OPEN "URL" FOR DIALOG AS #A
          hwnd = HWND(#A)
          [cont]
          wait
          [quit]
          CLOSE #A
          END

          [LB]
          calldll #shell32, "ShellExecuteA" , hwnd as ulong, _
          0 as ulong, "http://www.libertyb asic.com/ basic.html" as ptr, _
          "" as ptr, "" as ptr, _SW_SHOWNORMAL as ulong, ret as ulong
          goto [cont]

          [LBGROUP]
          calldll #shell32, "ShellExecuteA" , hwnd as ulong, _
          0 as ulong, "http://groups. yahoo.com/ group/libertybas ic/" as ptr, _
          "" as ptr, "" as ptr, _SW_SHOWNORMAL as ulong, ret as ulong
          goto [cont]

          [LBFORUM]
          calldll #shell32, "ShellExecuteA" , hwnd as ulong, _
          0 as ulong, "http://libertybasic .conforums. com/index. cgi" as ptr, _
          "" as ptr, "" as ptr, _SW_SHOWNORMAL as ulong, ret as ulong
          goto [cont]



















          [Non-text portions of this message have been removed]
        • Gordon
          Here is a concept in native Liberty BASIC. code starts here nomainwin WindowWidth= 400 WindowHeight= 300 UpperLeftX=INT( (DisplayWidth- WindowWidth) /2)
          Message 4 of 9 , Oct 30, 2009
            Here is a concept in native Liberty BASIC.


            'code starts here
            nomainwin
            WindowWidth= 400
            WindowHeight= 300
            UpperLeftX=INT( (DisplayWidth- WindowWidth) /2)
            UpperLeftY=INT( (DisplayHeight- WindowHeight) /2)
            BackgroundColor$ = "Green"

            BUTTON #A.0 "LB", [LB],UL, 5, 5, 70, 25
            BUTTON #A.3 "LBGROUP", [LBGROUP], UL, 153, 5, 70, 25
            BUTTON #A.2 "LBFORUM", [LBFORUM], UL, 300, 5, 70, 25
            BUTTON #A.1 "Quit", [quit],UL, 300, 230, 70, 25

            OPEN "URL" FOR DIALOG AS #A
            internet$="C:\Program files\Internet Explorer\IEXPLORE.EXE"
            wait

            [quit]
            CLOSE #A
            END

            [LB]
            run internet$ + " http://www.libertybasic.com/"
            wait

            [LBGROUP]
            run internet$ + " http://groups.yahoo.com/group/libertybasic/"
            wait

            [LBFORUM]
            run internet$ + " http://libertybasic.conforums.com/index.cgi"
            wait

            'code ends here

            When you installed Windows, it installs a program
            IEXPLORE.EXE in the directory \Program files\Internet Explorer\
            automatically. This program (IEXPLORE) can run all your
            internet programmas.

            Gordon



            --- In libertybasic@yahoogroups.com, "henriknilson" <henriknilson@...> wrote:
            >
            > Hey
            > How can we open a link of URL by push button of LB, like the following incomplete code which does not work!
            > Thank you
            >
            > 'The Code
            > --------------
            > nomainwin
            > WindowWidth= 400
            > WindowHeight= 300
            > UpperLeftX=INT( (DisplayWidth- WindowWidth) /2)
            > UpperLeftY=INT( (DisplayHeight- WindowHeight) /2)
            > BackgroundColor$ = "Green"
            > BUTTON #A.0 "LB", [LB],UL, 5, 5, 70, 25
            > [LB]
            > 'http://www.libertybasic.com/basic.html
            > BUTTON #A.3 "LBGROUP", [LBGROUP], UL, 153, 5, 70, 25
            > [LBGROUP]
            > 'http://groups.yahoo.com/group/libertybasic/
            > BUTTON #A.2 "LBFORUM", [LBFORUM], UL, 300, 5, 70, 25
            > [LBFORUM]
            > 'http://libertybasic.conforums.com/index.cgi
            > BUTTON #A.1 "Quit", [quit],UL, 300, 230, 70, 25
            > OPEN "URL" FOR DIALOG AS #A
            > wait'
            > [quit]
            > CLOSE #A
            > END
            >
          • Richard
            ... Many people prefer not to use Internet Explorer, and contrary to your assertion it is *not* guaranteed to be installed: http://tinyurl.com/kvov5j The code
            Message 5 of 9 , Oct 30, 2009
              --- In libertybasic@yahoogroups.com, "Gordon" wrote:
              > internet$="C:\Program files\Internet Explorer\IEXPLORE.EXE"
              > [snip]
              > When you installed Windows, it installs a program
              > IEXPLORE.EXE in the directory \Program files\Internet Explorer\

              Many people prefer not to use Internet Explorer, and contrary to your assertion it is *not* guaranteed to be installed:

              http://tinyurl.com/kvov5j

              The code I listed using ShellExecute will automatically activate the user's default browser, whether or not it is Internet Explorer.

              Richard.
            • garpmore
              ... Submitted the following line: internet$= C: Program files Internet Explorer IEXPLORE. EXE ... There is a space between C: and which causes an out of
              Message 6 of 9 , Oct 30, 2009
                --- In libertybasic@yahoogroups.com, "Gordon" <dutch_gordon@...>

                Submitted the following line:

                internet$="C: \Program files\Internet Explorer\IEXPLORE. EXE"

                ------------------------------

                There is a space between C: and \ which causes an out of memory error on my machine. Eliminating the space solved that problem.

                In addition, simply:

                run "EXPLORER" + " http://..."

                also works, but in this case the leading space in the URL is essential.
              • Alex
                ... What if explorer and/or windows is installed in f partition? What if mozilla is default browser? Think about that. You have to find the unique solution.
                Message 7 of 9 , Oct 31, 2009
                  --- In libertybasic@yahoogroups.com, "garpmore" <garpmore@...> wrote:
                  >
                  >
                  >
                  >
                  >
                  > --- In libertybasic@yahoogroups.com, "Gordon" <dutch_gordon@>
                  >
                  > Submitted the following line:
                  >
                  > internet$="C: \Program files\Internet Explorer\IEXPLORE. EXE"
                  >
                  > ------------------------------
                  >
                  > There is a space between C: and \ which causes an out of memory error on my machine. Eliminating the space solved that problem.
                  >
                  > In addition, simply:
                  >
                  > run "EXPLORER" + " http://..."
                  >
                  > also works, but in this case the leading space in the URL is essential.
                  >

                  What if explorer and/or windows is installed in f partition?

                  What if mozilla is default browser?

                  Think about that.

                  You have to find the unique solution.

                  Isn't there any same way to run DEFAULT browser doesn't matter where is it installed?
                • Stefan Pendl
                  ... The ShellExecute API function, as posted by Richard, will launch the URL with the browser associated with the URL file type, which usually is the default
                  Message 8 of 9 , Oct 31, 2009
                    > >
                    > > Submitted the following line:
                    > >
                    > > internet$="C: \Program files\Internet Explorer\IEXPLORE. EXE"
                    > >
                    > > ------------------------------
                    > >
                    > > There is a space between C: and \ which causes an out of
                    > memory error on my machine. Eliminating the space solved that problem.
                    > >
                    > > In addition, simply:
                    > >
                    > > run "EXPLORER" + " http://..."
                    > >
                    > > also works, but in this case the leading space in the URL
                    > is essential.
                    > >
                    >
                    > What if explorer and/or windows is installed in f partition?
                    >
                    > What if mozilla is default browser?
                    >
                    > Think about that.
                    >
                    > You have to find the unique solution.
                    >
                    > Isn't there any same way to run DEFAULT browser doesn't
                    > matter where is it installed?
                    >

                    The ShellExecute API function, as posted by Richard, will launch the URL with the browser associated with the URL file type, which
                    usually is the default browser.

                    Explorer is included in the Windows search path, so there is no need to specify a full path, but it will launch IE despite from what
                    the default browser is on some systems.
                    IExplorer is not included in the Windows search path, so this is not a solution.

                    If you need to find the full path to the application associated with the file, you would use the following:

                    '---code start (watch for line wraps)
                    ' find executable associated to a file
                    ' based on http://msdn.microsoft.com/en-us/library/bb776419%28VS.85%29.aspx

                    filedialog "Select File to check ...", "*.*", checkFile$

                    if checkFile$ <> "" then print FindExecutable$(checkFile$)
                    end

                    function FindExecutable$(string$)
                    lpFile$ = BaseName$(string$, "", "") + chr$(0)
                    lpDirectory$ = DirName$(string$) + chr$(0)
                    lpResult$ = space$(_MAX_PATH) + chr$(0)

                    calldll #shell32, "FindExecutableA", _
                    lpFile$ as ptr, _
                    lpDirectory$ as ptr, _
                    lpResult$ as ptr, _
                    result as ulong

                    if result > 32 then FindExecutable$ = trim$(lpResult$)
                    end function

                    function BaseName$(input$, ext$, sep$)
                    ' returns the name of the given file
                    ' if ext$ matches the last part of
                    ' input$ it will be cut off
                    if sep$ = "" then sep$ = "\"

                    if len(ext$) > 0 and right$(input$, len(ext$)) = ext$ then _
                    input$ = left$(input$,len(input$) - len(ext$))

                    BaseName$ = input$
                    bsPos = len(input$)
                    while mid$(input$, bsPos, 1) <> sep$ and bsPos > 0
                    bsPos = bsPos - 1
                    wend

                    if bsPos <> 0 then BaseName$ = right$(input$,len(input$) - bsPos)
                    end function

                    function DirName$(input$)
                    ' returns the path of the given file

                    DirName$ = input$
                    bsPos = len(input$)
                    while mid$(input$, bsPos, 1) <> "\" and bsPos > 0
                    bsPos = bsPos - 1
                    wend

                    if bsPos <> 0 then DirName$ = left$(input$,bsPos - 1)
                    end function
                    '---code end

                    ---
                    Stefan Pendl

                    Liberty BASIC Assist 4.03 ........ http://www.libertybasic.com/assist.html
                    Liberty BASIC 4.04 public beta ... http://www.libertybasic.com/lb404b3setup.exe

                    Windows Vista Home Premium 32-bit SP2
                    AMD Turion X2 RM-70 2GHz, 4GB RAM
                  • Henrik
                    Many thanks for  Stefan Pendl, Gordon, garpmore, Alex,and Richard ... From: Stefan Pendl Subject: RE: [libertybasic] URL To:
                    Message 9 of 9 , Oct 31, 2009
                      Many thanks for
                       Stefan Pendl, Gordon, garpmore, Alex,and Richard

                      --- On Sat, 10/31/09, Stefan Pendl <pendl2megabit@...> wrote:


                      From: Stefan Pendl <pendl2megabit@...>
                      Subject: RE: [libertybasic] URL
                      To: libertybasic@yahoogroups.com
                      Date: Saturday, October 31, 2009, 9:56 AM


                       



                      > >
                      > > Submitted the following line:
                      > >
                      > > internet$="C: \Program files\Internet Explorer\IEXPLORE. EXE"
                      > >
                      > > ------------ --------- ---------
                      > >
                      > > There is a space between C: and \ which causes an out of
                      > memory error on my machine. Eliminating the space solved that problem.
                      > >
                      > > In addition, simply:
                      > >
                      > > run "EXPLORER" + " http://..."
                      > >
                      > > also works, but in this case the leading space in the URL
                      > is essential.
                      > >
                      >
                      > What if explorer and/or windows is installed in f partition?
                      >
                      > What if mozilla is default browser?
                      >
                      > Think about that.
                      >
                      > You have to find the unique solution.
                      >
                      > Isn't there any same way to run DEFAULT browser doesn't
                      > matter where is it installed?
                      >

                      The ShellExecute API function, as posted by Richard, will launch the URL with the browser associated with the URL file type, which
                      usually is the default browser.

                      Explorer is included in the Windows search path, so there is no need to specify a full path, but it will launch IE despite from what
                      the default browser is on some systems.
                      IExplorer is not included in the Windows search path, so this is not a solution.

                      If you need to find the full path to the application associated with the file, you would use the following:

                      '---code start (watch for line wraps)
                      ' find executable associated to a file
                      ' based on http://msdn. microsoft. com/en-us/ library/bb776419 %28VS.85% 29..aspx

                      filedialog "Select File to check ...", "*.*", checkFile$

                      if checkFile$ <> "" then print FindExecutable$ (checkFile$ )
                      end

                      function FindExecutable$ (string$)
                      lpFile$ = BaseName$(string$ , "", "") + chr$(0)
                      lpDirectory$ = DirName$(string$ ) + chr$(0)
                      lpResult$ = space$(_MAX_ PATH) + chr$(0)

                      calldll #shell32, "FindExecutableA" , _
                      lpFile$ as ptr, _
                      lpDirectory$ as ptr, _
                      lpResult$ as ptr, _
                      result as ulong

                      if result > 32 then FindExecutable$ = trim$(lpResult$ )
                      end function

                      function BaseName$(input$ , ext$, sep$)
                      ' returns the name of the given file
                      ' if ext$ matches the last part of
                      ' input$ it will be cut off
                      if sep$ = "" then sep$ = "\"

                      if len(ext$) > 0 and right$(input$ , len(ext$)) = ext$ then _
                      input$ = left$(input$ ,len(input$ ) - len(ext$))

                      BaseName$ = input$
                      bsPos = len(input$)
                      while mid$(input$, bsPos, 1) <> sep$ and bsPos > 0
                      bsPos = bsPos - 1
                      wend

                      if bsPos <> 0 then BaseName$ = right$(input$ ,len(input$ ) - bsPos)
                      end function

                      function DirName$(input$ )
                      ' returns the path of the given file

                      DirName$ = input$
                      bsPos = len(input$)
                      while mid$(input$, bsPos, 1) <> "\" and bsPos > 0
                      bsPos = bsPos - 1
                      wend

                      if bsPos <> 0 then DirName$ = left$(input$ ,bsPos - 1)
                      end function
                      '---code end

                      ---
                      Stefan Pendl

                      Liberty BASIC Assist 4.03 ........ http://www.libertyb asic.com/ assist.html
                      Liberty BASIC 4.04 public beta ... http://www.libertyb asic.com/ lb404b3setup. exe

                      Windows Vista Home Premium 32-bit SP2
                      AMD Turion X2 RM-70 2GHz, 4GB RAM



















                      [Non-text portions of this message have been removed]
                    Your message has been successfully submitted and would be delivered to recipients shortly.