Read Command-Line Arguments from a File on Startup
-
A Former User last edited by A Former User
@burnout426 said in Read Command-Line Arguments from a File on Startup:
I made an example launcher.exe replacement that supports reading command-line arguments from a file next to it. See here. There's a readme in the zip file.
Actually, there could be a better way of using your solution:
- Download RegisterFirefoxPortable:
http://www.winhelponline.com/blog/register-firefox-portable-with-default-programs-in-vista/
(the program name is a little bit bullshit, as it can register ANY custom browser setup as the default Windows browser, the only issue is the registered browser name, which is always "Firefox") - Apply this program to your launcher replacement.
- I made a simple name-fix solution, download it from here:
https://nofile.io/f/Mnhw0gCYCKV/ChangeDefaultBrowser+Fix.zip
Apply the one that corresponds your browser name (I tested it on Opera and Vivaldi). - Go to Control Panel -> Default Programs and choose the registered EXE as the default browser.
Voilà!
So potentially this solution can completely eliminate the need to rename something in the browser program folder and to mess up with file replacements on each update.
The only thing is that your EXE should use the stock "launcher.exe" instead of the renamed "reallauncher.exe".PS: Could you compile another version of your launcher for Vivaldi ("vivaldi.exe")?
- Download RegisterFirefoxPortable:
-
burnout426 Volunteer last edited by burnout426
@agych said in Read Command-Line Arguments from a File on Startup:
Actually, there could be a better way of using your solution:
Yes indeed. I actually do that sort of thing for Opera Mail here (instead of modifying Opera's keys).
I could make a utility sometime that outputs a reg file for the exe (the custom launcher) you pick that makes it available as the default browser. It'd be basically the same thing. The Firefox one should be good for now though.
@agych said in Read Command-Line Arguments from a File on Startup:
PS: Could you compile another version of your launcher for Vivaldi ("vivaldi.exe")?
Yes, I can do that. Or, if you want, you can just download this mingw build, install it, launch the command prompt shortcut that comes with it, cd to the directory where my zip file has been extracted and type the commands listed at the bottom of the cc file.
I should probably just make the filename of the exe it launches configurable in a file or in the launcher_args file.
I'll keep you updated.
-
burnout426 Volunteer last edited by
@agych Try this vivaldi launcher with RegisterFirefoxPortable to see if you like that. See the readme as before.
-
A Former User last edited by A Former User
Thanks, works great!
This is a useful piece of software, have you thought about pushing it to github?I don't have experience with C++, but have looked at the code a bit and got a couple of ideas for improvement:
- The configurable browser exe name is indeed a Very good idea. This way one single launcher can be used with all chromium-based browsers. No need to have one for Opera, another for Vivaldi, and third for Chrome.
- Would be great to have the launcher_args file name taken from your launcher exe name, instead of being hardcoded as "launcher_args.txt". I mean, for example, if one downloads your launcher and renames it to "super-cool-launcher-from-hell.exe", it would read the args from "super-cool-launcher-from-hell.txt". One advantage of this approach is that it will be always clear that both files belong to the same software - your launcher. Another advantage is that both files will be one after another in the file manager (sorted by file name).
-
burnout426 Volunteer last edited by
@agych said in Read Command-Line Arguments from a File on Startup:
have you thought about pushing it to github?
Not at the moment, but noted. I can release it under a license though so people can modify it etc. without worry.
@agych said in Read Command-Line Arguments from a File on Startup:
The configurable browser exe name is indeed a Very good idea.
Indeed.
I was thinking about doing just browser_launcher.exe and browser_launcher.cfg
When I get a chance here soon.
-
burnout426 Volunteer last edited by
@agych
Okay, try browser_launcher to see how it works. You specify the exe to launch in the browser_launcher.cfg file. That way, it should work with whatever browser you want. It's not thoroughly tested yet, but I did test it with Opera a little bit.
-
A Former User last edited by A Former User
I've tried it properly this time, with RegisterFirefoxPortable and all the stuff, and got 2 issues:
-
When the browser_launcher is pinned to taskbar (by drag'n'dropping the browser_launcher or its shortcut) and is launched from there, Opera/Vivaldi are opened in a new taskbar "toast", instead of the place of the pinned launcher. In other words I get pinned icon in one place, and the opened browser in the end of the taskbar.
I had to fix it by pinning the opened browsers (via taskbar), which resulted in the original browser executables being pinned, and then manually modifying each pinned shortcut so that they point to browser_launcher. So far it works, hope they will not disappear from the taskbar after reboot (sometimes it happens when the pinned shortcut was modified). -
When browser_launcher is registered as a default program with RegisterFirefoxPortable and the .reg fix, it doesn't appear in "Default Programs" in control panel. Have no idea why...
I have checked the registry and saw that RegisterFirefoxPortable did its job like it supposed to, so it is not this part that fails.
I would assume that the original launcher has some sort of signature or something, "Default Programs" checks each registered default program if it is signed or not (while fetching the list of programs), and hides those that are not signed.
I got it work by renaming browser_launcher.exe to whatever, renaming the original launcher to browser_launcher.exe, doing the RegisterFirefoxPortable procedure, and then renaming the launchers back. After that the browser entry is still in "Default Programs", opening web-files launches browser_launcher.exe, and the browser runs with all the arguments.
After getting these two fixed, the launcher works great so far, I'm now using it with Opera and Vivaldi (both are standalone/portable).
Did you have these issues?
-
-
burnout426 Volunteer last edited by
@agych said in Read Command-Line Arguments from a File on Startup:
When browser_launcher is registered as a default program with RegisterFirefoxPortable and the .reg fix, it doesn't appear in "Default Programs" in control panel. Have no idea why...
I'll check this out. I only tested on Windows 10 -> Settings -> Apps -> Default Apps -> Web Browser. It's probably something to do with the Registered Applications key.
-
burnout426 Volunteer last edited by
@agych said in Read Command-Line Arguments from a File on Startup:
When the browser_launcher is pinned to taskbar (by drag'n'dropping the browser_launcher or its shortcut) and is launched from there, Opera/Vivaldi are opened in a new taskbar "toast", instead of the place of the pinned launcher. In other words I get pinned icon in one place, and the opened browser in the end of the taskbar.
Yeah, after pinning browser_launcher.exe, whenever you click the icon, a separate icon is going to show up on the taskbar button for the browser as the browser is indeed another program. I'll see if there's a way around that besides your workaround.
-
burnout426 Volunteer last edited by
@rudrick said in Read Command-Line Arguments from a File on Startup:
Browser Chooser 2
I see it at https://bitbucket.org/gmyx/browserchooser2/wiki/Home, https://browserchooser2.com/ and https://archive.codeplex.com/?p=browserchooser2. I tried it. It has the option to add a custom exe and has an option to add Browser Chooser to Default Programs. But, I didn't find a way to auto-launch a particular browser when it's invoked from a file association etc. It always asks.
-
burnout426 Volunteer last edited by
@burnout426 said in Read Command-Line Arguments from a File on Startup:
I'll check this out. I only tested on Windows 10 -> Settings -> Apps -> Default Apps -> Web Browser. It's probably something to do with the Registered Applications key.
Hmm, it's there under "Set default by apps" in Windows 10. It's under "Mozilla Firefox Portable Edition" or whatever. And, if I change ApplicationName in "HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet\FirefoxPortable\Capabilities" to "Browser Launcher", it shows up as so in that list.
-
burnout426 Volunteer last edited by
I put info (and the link) for my browser launcher on https://www.reddit.com/r/operabrowser/wiki/opera/browser_launcher. I'll just link to the latest version there from now on. The new upload linked there has a few, non-important improvements like a makefile, license, version info for the exe file, updated readme, and more examples in the cfg file.
Would still like Opera to implement something like this in its launcher.exe. Would be much simpler that way. My browser launcher is example for the devs to go by.