Announcement

Collapse
No announcement yet.

How to launch MS Edge using a Shell command?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to launch MS Edge using a Shell command?

    This should be an easy question for you folks.

    I have written a program that shells out to various banks and credit unions so I can capture (ctrl-a, copy or select all, copy) financial information so I can then manipulate the data in my program. I have been using IExplorer, but that's outdated and won't be supported by the banks for long. I'd like to try MS Edge but can't figure out how to launch it from a SHELL command. I found where the EDGE .EXE is located, but shelling to that file does nothing - does not launch EDGE.

    My default browser is Chrome. I haven't had consistent luck using it because the bank & CU's webpage consists of their standard ads, messages, etc and then my specific bank data. Chrome doesn't pick up my specific data when doing a ctrl-a, ctrl-c - just the ads, announcements, etc. That's why I'd like to launch Edge and give that a try. I'm thinking since IE picked up my specific info that Edge will do the same.

    Alternately, is there a way to force Chrome to copy ALL the information displayed on a webpage?

    I am using PBCC 6.

    Thanks

    Tim


  • #2
    Rather than scraping pages in a browser, you may like to think about grabbing the pages directly. It's been discussed quite a few times. Here's some relevant links


    https://forum.powerbasic.com/forum/u...sing-a-browser

    https://forum.powerbasic.com/forum/u...-api-functions


    https://forum.powerbasic.com/forum/u...inet-functions

    Comment


    • #3
      Alternatively, rather than copying the displayed page, have you tried Ctrl+U in Chrome and then copying the source page?

      Comment


      • #4
        Stuart,
        I looked at the examples. It appears to me that they pertain to a time when HTTPS wasn't a problem in accessing web sites. Disclaimer: I understand very little of what I am looking at on those pages. I'll look at them more.

        I tried the ctrl+u method with Chrome. My data doesn't show up there - only the info needed to paint the page with announcements, logos, ads, etc. That would have been great had my bank data been there.
        Thanks.

        There should be an easy way to launch Microsoft Edge. Here's how I launch IE:
        SHELL "C:\Program Files\Internet Explorer\IEXPLORE.EXE HTTPS://secure1.onlineaccess1.com/mybanksname/Uux.aspx#/login"

        Tim

        Comment


        • #5
          shellexecute 0,"OPEN","microsoft-edge:"+$NUL,BYVAL 0,CURDIR$,%SW_SHOWNORMAL
          Code:
          #INCLUDE "win32api.inc"
          FUNCTION PBMAIN () AS LONG     'ShellEdge.bas
           LOCAL sBrowser,sSearch AS STRING
           sBrowser = "microsoft-edge:"
           ssearch = ""
           DO
            ssearch = INPUTBOX$("prompt","title",ssearch)
            IF LEN(sSearch) = 0 THEN EXIT DO
            shellexecute 0,"OPEN",sBrowser + sSearch + $NUL,BYVAL 0,CURDIR$,%SW_SHOWNORMAL
           LOOP
          END FUNCTION
          https://duckduckgo.com instead of google

          Comment


          • #6
            Or ShellExecuteW

            Code:
            LOCAL sei AS SHELLEXECUTEINFOW
            sei.cbSize = SIZEOF(sei)
            LOCAL wszVerb AS WSTRINGZ * %MAX_PATH
            wszVerb = "open"
            sei.lpVerb = VARPTR(wszVerb)
            LOCAL wszFile AS WSTRINGZ * %MAX_PATH
            wszFile = "microsoft-edge:http://www.stackoverflow.com"   ' --> change me
            sei.lpFile = VARPTR(wszFile)
            ShellExecuteExW(sei)
            Forum: http://www.jose.it-berater.org/smfforum/index.php

            Comment


            • #7
              Mike & Jose,
              I haven't tried your suggestions, yet, (I will) but I did find that this works. Seems a bit cumbersome to have to launch Powershell to launch EDGE to get to the desired bank, but it worked. And, EDGE does let me capture all the data, unlike Chrome.

              SHELL "powershell start microsoft-edge:HTTPS://www.mybank.net"

              Thanks
              Tim


              Comment


              • #8
                This too.
                Code:
                #Compile Exe        ' PBCC604 , PBWin104
                #Dim All
                #If %Def(%PB_CC32)
                 #Break On
                 ' #Console Off
                #EndIf
                #Include "win32api.inc"
                '------------------/
                
                Function PBMain () As Long
                
                  Shell Environ$("Comspec") + " /C " + "start microsoft-edge:http://www.cnn.com", 0
                
                  #If %Def(%PB_CC32)
                    If Con.Handle Then            ' legacy = CONSHNDL
                      ? "Any key to exit"
                      WaitKey$
                    End If
                  #EndIf
                End Function
                '------------------/PBMain
                Last edited by Dave Biggs; 16 Oct 2019, 08:14 PM. Reason: Note CON.HNDL = CONSHNDL (legacy)
                Rgds, Dave

                Comment


                • #9
                  Jose,
                  I tried your code and it works fine for me. Thank you for sharing the code!

                  Mike
                  I have't been able to get your code to work, but I'm not done trying yet. Thanks

                  Tim

                  Comment


                  • #10
                    Mike
                    I have't been able to get your code to work, but I'm not done trying yet. Thanks
                    Can anyone get this to work? It loads 10 tabs.
                    Code:
                    #INCLUDE "win32api.inc"
                    FUNCTION PBMAIN () AS LONG  'ShellEdge.bas
                     LOCAL x    AS LONG
                     LOCAL site AS STRING
                     site = "https://forum.powerbasic.com/forum/user-to-user-discussions/programming-the-internet/785872-how-to-launch-ms-edge-using-a-shell-command"
                     FOR x = 1 TO 10
                      shellexecute 0,"OPEN","microsoft-edge:"+site + $NUL,BYVAL 0,CURDIR$,%SW_SHOWNORMAL
                     NEXT
                    END FUNCTION
                    https://duckduckgo.com instead of google

                    Comment


                    • #11
                      Works for me Mike. Opens 10 tabs in Edge.

                      Comment


                      • #12

                        Thanks, Frank!

                        Mike
                        I have't been able to get your code to work, but I'm not done trying yet. Thanks

                        Tim

                        I'm thinking in post #5 if nothing was typed into the INPUTBOX the shellexecute was not called?
                        IF LEN(sSearch) = 0 THEN EXIT DO

                        Code:
                        #INCLUDE "win32api.inc"
                        FUNCTION PBMAIN () AS LONG     'ShellEdge.bas
                         LOCAL sBrowser,sSearch AS STRING
                         sBrowser = "microsoft-edge:"
                         ssearch = ""
                         DO
                          ssearch = INPUTBOX$("prompt","title",ssearch)
                          IF LEN(sSearch) = 0 THEN EXIT DO
                          shellexecute 0,"OPEN",sBrowser + sSearch + $NUL,BYVAL 0,CURDIR$,%SW_SHOWNORMAL
                         LOOP
                        END FUNCTION
                        Last edited by Mike Doty; 16 Oct 2019, 06:40 PM.
                        https://duckduckgo.com instead of google

                        Comment


                        • #13
                          Mike,
                          Tim mentioned in post #1 that he is using PBCC.
                          I'm guessing that he can't get your code to compile ( with Inputbox ).
                          Rgds, Dave

                          Comment


                          • #14
                            Mike,
                            I commented out the PB Windows code and got your example to work. Thank you! I haven't worked with win32api.inc so this gives me an opportunity to learn a little bit about how things work.
                            Tim

                            Comment

                            Working...
                            X