Application:AutoClose
Category: Utilites
Description: AutoClose is my way of making the PortableAppsMenu have a "Run on exit" option. There is no GUI, but the program is fairly extensible. Please make sure to read the help.html file for instructions. I should also mention that you need to set the menu to run this program at start. It loads and waits for the menu to close. Thne it acts.
Download AutoClose [384KB download / 212KB installed]
(MD5: b8ed2182ce89bbe9eeaf18780795e23c)
Release Notes:
- Version 1 (2009-10-01):
- Initial release
- Version 1.1(2010-1-13):
- Release version 1.1. I've updated the script to use ${ProcessWaitClose} from wraithdu's procfun.nsh. Should use less processor power
- Version 1.1.1(2010-1-13):
- Switched out my icon
- Version 1.2(2010-1-13):
- Inserted prapper's fix to my code.
- Since no one said my adjustments to the help.html file were bad, I've included those.
nobody react?
such a shame
I am going to try it out because I wrote a clumsy vbs script to accomplish the same.
thanks for it, I am going to report the bugs I'll find
your program takes up 75 procent of my cpu.
consider to make it sleep for a couple of seconds in the loop where you check if pa is already stopped
looks like same issue I had with geany. Well, I'll take a look at wraithdu's solution. Maybe post a fix tommorrow afternoon
Too many lonely hearts in the real world
Too many bridges you can burn
Too many tables you can't turn
Don't wanna live my life in the real world
Oh yeah, that's a very tight loop. I suggest using ${ProcessWaitClose} from my ProcFunc header -
https://portableapps.com/node/12561
yeah. I'm at my 'new' college, so I t\don't really trust the computers yet. Looks like I'll have to haul my laptop in too :(.
Anyway, I will take a look at this tommorrow. I had the same tight loop in geany portable and chazz (or dabomb? I can't keep them straight.) complained. I fixed it, and geany improved noticably. I didn't fix it in this one because I didn't notice that much of a difference when it was on.
I do hope to have a fix in place by tommorrow afternoon.
Too many lonely hearts in the real world
Too many bridges you can burn
Too many tables you can't turn
Don't wanna live my life in the real world
Using my ProcFunc header it should be a piece of cake, literally
${ProcessWaitClose} "some.exe" "-1" $0
if I remember right.
EDIT: fixed download in my thread
You won't notice it at all on a multi-core system because it'll only saturate one of the cores. But on a single-core machine, one app sucking all the CPU cycles will really put a dent in the performance of everything else.
I don't believe so. Like I said, I've never noticed it, but I"m usually using like a 3.0 ghz processor when I'm running it. I'll fix it later today. I just woke up
Too many lonely hearts in the real world
Too many bridges you can burn
Too many tables you can't turn
Don't wanna live my life in the real world
It probably has hyper-threading, though, if it's that fast. Which is kinda like a proto-dual-core.
Trying it out. I'll let you know what I find.
I fixed the download in my ProcFunc thread for ya.
Updated
See top for details.
Too many lonely hearts in the real world
Too many bridges you can burn
Too many tables you can't turn
Don't wanna live my life in the real world
thanks, its working great.
Why isn't this working? I have the following INI:
...but PFA isn't closing when I close the menu. If I run the same exact command from the command line or Run dialog, PFA closes properly. What's going on?
Also, small annoyance: AutoClose causes Windows to show a persistent "busy" mouse cursor for a few seconds after launching it. Any chance this could be fixed?
question one:
[AutoClose]
ProgramToWatch=PortableAppsPlatform.exe
[ProgramList]
Application1=\PortableFileAssociater\PortableFileAssociator.exe exit
question two:
no
You mean it's relative to the PortableApps directory? Heh, never would have figured that one out. That should documented somewhere.
wel, It took me 15 minuts
first of all I didn't knew were to place the ini.
then I tried everything and that was the result
its working now but please document it beter next time
sure
Its hard to write a good progam, and sometimes even harder to write good documentation.
*EDIT* I'm going to put up a copy on 'my' server, so you guys can read and comment on it.
*EDIT2* Its up .
Too many lonely hearts in the real world
Too many bridges you can burn
Too many tables you can't turn
Don't wanna live my life in the real world
What dinosoep said
Also what dinosoep said. I'm not sure why its doing this, I save most of the processing until you close the menu. It's probably window's way of being a pain. Or NSIS.
Too many lonely hearts in the real world
Too many bridges you can burn
Too many tables you can't turn
Don't wanna live my life in the real world
I think the busy cursor is because it's not creating a window so Windows thinks it's still loading (after about 5 seconds I guess it gives up waiting). There must be some API function you can call to signal to the OS that you're done loading... of course, I haven't used the Windows API in ages (I prefer .NET now), so I'm stumped here.
Hmm, you know, now that you mention the window, I think that there may be something I can do.
Here's what I'm planning. If I can do, then I will release the 1.1 as 1.2 (or Stable :). Then, I will release 1.3 (or testing). Probably overkill though
*EDIT* Actually, after looking through my source, I can't see anything. My guess (and I eally am just guessing) that the api call would have to go before the program tries to initiate a window. Since NSIS is a installer which should have windows, there's not much I can really try to do.
I do have the standard things:
SilentInstall Silent
AutoCloseWindow True
set in the launch, so I'm not real sure how I implement this.
Too many lonely hearts in the real world
Too many bridges you can burn
Too many tables you can't turn
Don't wanna live my life in the real world
I'd like to tell you why this works but I don't know. Although it does
Put "AutoClose.jpg" in Other\Source. You won't see it because the splash time is set to "0" (so no hourglass).
It works because newadvsplash is creating a window, even though it's never shown. Once a process calls CreateWindow for the first time, Windows figures it's ready to go and nixes the hourglass.
It's funny, I never noticed that behavior of NSIS before, probably because I've never used an NSIS script that either A) didn't have a window, or B) didn't run something really quick then exit.
I guess console apps don't have this problem though.
Too bad there isn't a trivial way to manually create a hidden window in NSIS. I suppose something could be written to do the process manually to quickly create a window then destroy it, just to get around this annoyance. Yeah, callbacks with the System plugin are soooo much fun.....
I'm fairly certain there's an API function you can call in place of CreateWindow to signal to the OS you're done loading, but for the life of me I can't remember what it was now.
I'll have to try that. Though I might make a nice looking splash screen just so nobody can see it
Too many lonely hearts in the real world
Too many bridges you can burn
Too many tables you can't turn
Don't wanna live my life in the real world
Damn, creating a window is impossible in NSIS because it's impossible to make the window procedure callback function correctly. NSIS is majorly single threaded, which means you have to access the callback FROM the main thread in some kind of massochistic loop.
Unfortunately CreateWindow sends messages to the window procedure before returning. There is no way to respond to these messages so I believe CreateWindow fails and returns NSIS's soooo helpful 'error', even though GetLastError returns 0.
If anyone has any ideas to get around this, outside of writing a plugin, I'm all ears.
I would say the invisible splash method mentioned above is probably the best bet for now. It could even just be 1x1 image since it's never going to be displayed anyway, then the only overhead would be the newadvsplash plugin itself.
Version 1.2. I updated the help.html, by putting in some thanks for people I should have put in.
I also went ahead and made a nice looking spash screen. Maybe I'l make it appear for a few seconds in a later version. Without that hourglass icon, how will we know its running
Too many lonely hearts in the real world
Too many bridges you can burn
Too many tables you can't turn
Don't wanna live my life in the real world
No more annoying hourglass!
Unfortunately the download is no longer available.
Can someone please re-upload it?