Closed stonebig closed 2 months ago
It's not a bad idea, but I'm not sure how easy it would be to do (I'd need to edit the resources in the built executable, which I don't do at the moment). I'll look into it.
As a short term workaround, I believe there are utilities that allow you to edit the icon for an exe, you could post-process the launcher with one of those to set a custom icon.
I can wait. Dream is to remove need of NSIS for all launchers, and maybe even for the installer.
(as my installer is very close to a simple "unzip there")
my experience "python.exe mkshim.py -f ttt.exe -c ".\scripts\cmd.bat" works nice, icon logo excepted
this works too but shows a launching dos window that I thought would not:
python.exe mkshim.py -f tt_idlex.exe -c "wscript.exe .\scripts\Noshell.vbs .\scripts\idlex.bat"
not having a showing up Dos window is another issue/feature request ?
That's because the wrapper program is compiled as a console executable. What you need to do is
python subsystem.py tt_idlex.exe tt_idlexw.exe gui
to make a GUI executable (much like python.exe is the console program and pythonw.exe is the GUI version).
Making that functionality available via a command line switch when creating the shim is certainly an option.
how fun: it works, but the opening IDLEX window opens behind the "explorer of files" window in which I clicked on the executable. Is there a way to fix that ?
That may be fixable, but it'd require GUI-specific hacks in the C code. At the moment, the project is mainly (almost exclusively, tbh) intended for use with console programs, so it's not likely to be something I'd get to in the short term.
I suspect what you need is something to force the "final" process (the one the user actually wants to run as opposed to the wrapper) to be the foreground process. There's probably code in the py.exe
wrapper that does a better job of getting this right than my current code. Or you could have your Python script find its main window and do something like SetForeground
on it. But that's about as much as I can say I'm afraid...
a answer to the original question:
you can use a windows batch script converter like Bat2EXE to create an exe file from a batch file. As an option the console can be hidden.
A german blog post examined the functionality of Bat2EXE. This may be of interest as this is not open source. Other alternatives are listed here: http://www.robvanderwoude.com/scriptcompilers.php
The advantage of Bat2EXE is its flexibility. However: sometimes Bat2EXE files may be reported from virus scanners as false positive.
I switched to Inno for the installer, still depending on ageing NSIS for this little functionnality.
I did combine mkshim.py + pywin32 to create an executable, then include the icon after.
ersatz found to avoid a permanent black window (but still a temporary one):
python mkshim.py -f my_winIDLE.exe -c "Powershell.exe start-process -WindowStyle Hidden './scripts/winidle.bat'"
the reason of current imperfection:
https://github.com/PowerShell/PowerShell/issues/3028 seems like the relevant point here.
aaargh, when I drag&drop a python file from anywhere on my 'shimmy' icons:
trying to replace the "." with something better that could stick to the .exe icon ... fails too: (Get-Location).Path is from the draged&dropped file
python mkshim240.py -f "IDLEtest.exe" -c "Powershell.exe start-process -FilePath (Join-Path (Get-Location).Path -ChildPath 'scripts\winidle.bat')"
can't find an AI to give me a solution
I'm sorry but I really don't see what this has to do with this project. This is all basic Windows GUI functionality.
Could shimmy include an icon image ? I would like to replace some simple NSIS launcher per this, but the executable must have a distinctive image.
Example: https://github.com/winpython/winpython/blob/master/make.py#L520