I have an app that executes a browser and hands it a URL. If the browser is already loaded into memory i get a “Already Open Alert” and no browsing takes place.
I must manually quit / exit the browser before my app can run it and hand off a URL that it will browse.
i am looking to see if the browser is running if so exit / quit that browser ( firefox ) app from within my app.
or is there a way around exiting the browser, is there a way i can just hand it a URL to browse.
I also get the same problem when my app attempts to execute an emal client such as “thunderbird”
this is the code that runs the browser and other apps and it does work as long as the external app has not been loaded into memory.
Dim sh As New Shell
sh.Execute "open -n " + AppPath.ShellPath + " --args " + appArg
if you’re on macos you can try an applescript to make the other app quit.
ShowURL will send a URL to a browser for browsing without the need to kill the user’s browser…
Will ShowURL allow me to use a browser of my choice or will i have to use the xojo built in ?
How about executing an email client app. such as “thunderbird” ?
ShowURL can also open the default mail client.
Tim great start.
so if i use ShowUrl i must use the system selected Browser / email client ect …
I use thunderbird because via command line i can fill in the … to email, subject … from email, and the complete message all with one click of a button. the default email client does not as of yet have that capability.
The mailto hyperlink syntax that you’d use with ShowURL has some support for parameters: https://en.wikipedia.org/wiki/Mailto
If you want to specifically use Thunderbird then you’ll have to launch it yourself using a Shell or the FolderItem.Launch method.
ok fair enough i’ll look in to it.
I got an additional question:
I use ShowURL to download a .csv-file, which is processed in my app. After the download, the browser is the frontmost window. To show the result of the processed download I have to click on the app-window to bring it to front. What is the command to return to my Xojo-app automatically, and where shoud this command be placed?
You should use a Xojo.Net.HTTPSocket to download the CSV yourself, and handle that all within your app.
Thanks for your fast reply, but the HTTPSocket solution doesn’t work for me, cause the URL I get the .csv from has several redirects.
You might be able to handle the 30x redirects in the HTTPSocket.HeaderReceived or maybe PageReceived events.
This thread seems to discuss ways to make your app frontmost:
I recommend Xojo.Net.HTTPSocket over the classic HTTPSocket for reasons such as this. The new socket will follow the redirects. Alternatively, you could use the HeaderRecieved as Paul suggests for using the old socket.