Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

a replacement for a basic NSIS launcher ? #1

Closed
stonebig opened this issue Mar 9, 2016 · 14 comments
Closed

a replacement for a basic NSIS launcher ? #1

stonebig opened this issue Mar 9, 2016 · 14 comments

Comments

@stonebig
Copy link

stonebig commented Mar 9, 2016

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

@stonebig stonebig changed the title areplacement for a basic NSIS launcher ? a replacement for a basic NSIS launcher ? Mar 9, 2016
@pfmoore
Copy link
Owner

pfmoore commented Mar 9, 2016

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.

@stonebig
Copy link
Author

stonebig commented Mar 9, 2016

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")

@stonebig
Copy link
Author

my experience "python.exe mkshim.py -f ttt.exe -c ".\scripts\cmd.bat" works nice, icon logo excepted

@stonebig
Copy link
Author

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 ?

@pfmoore
Copy link
Owner

pfmoore commented Mar 10, 2016

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.

@stonebig
Copy link
Author

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 ?

@pfmoore
Copy link
Owner

pfmoore commented Mar 11, 2016

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...

@carlkl
Copy link

carlkl commented Jun 22, 2017

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.

@stonebig
Copy link
Author

stonebig commented Nov 2, 2018

I switched to Inno for the installer, still depending on ageing NSIS for this little functionnality.

@bc-185 bc-185 mentioned this issue Dec 22, 2021
@stonebig
Copy link
Author

stonebig commented Aug 25, 2024

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'"

@stonebig
Copy link
Author

the reason of current imperfection:

@pfmoore
Copy link
Owner

pfmoore commented Aug 31, 2024

PowerShell/PowerShell#3028 seems like the relevant point here.

@stonebig
Copy link
Author

stonebig commented Aug 31, 2024

aaargh, when I drag&drop a python file from anywhere on my 'shimmy' icons:

  • the process "wt.exe" already auto-set itself to the directory of that dropped file
  • and launching my "./scripts/this.bat" with this dropped file do fail: the script, relative to the .exe icon, is not found

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

@pfmoore
Copy link
Owner

pfmoore commented Aug 31, 2024

I'm sorry but I really don't see what this has to do with this project. This is all basic Windows GUI functionality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants