You are here

AutoClose V 1.2

33 posts / 0 new
Last post
OliverK
OliverK's picture
Offline
Last seen: 3 years 4 months ago
Developer
Joined: 2007-03-27 15:21
AutoClose V 1.2

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 Smile
  • 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.
dinosoep
Offline
Last seen: 13 years 10 months ago
Joined: 2009-12-14 15:12
nobody react? such a shame I

nobody react?
such a shame Blum
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 Smile

dinosoep
Offline
Last seen: 13 years 10 months ago
Joined: 2009-12-14 15:12
your program takes up 75

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

OliverK
OliverK's picture
Offline
Last seen: 3 years 4 months ago
Developer
Joined: 2007-03-27 15:21
looks like same issue I had

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

wraithdu
Offline
Last seen: 11 years 4 months ago
Developer
Joined: 2007-06-27 20:22
Oh yeah, that's a very tight

Oh yeah, that's a very tight loop. I suggest using ${ProcessWaitClose} from my ProcFunc header -

https://portableapps.com/node/12561

OliverK
OliverK's picture
Offline
Last seen: 3 years 4 months ago
Developer
Joined: 2007-03-27 15:21
yeah. I'm at my 'new'

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

wraithdu
Offline
Last seen: 11 years 4 months ago
Developer
Joined: 2007-06-27 20:22
Using my ProcFunc header it

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

Bruce Pascoe
Offline
Last seen: 12 years 10 months ago
Joined: 2006-01-15 16:14
Testing on dual-core?

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.

OliverK
OliverK's picture
Offline
Last seen: 3 years 4 months ago
Developer
Joined: 2007-03-27 15:21
I don't believe so. Like I

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 Smile

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

Bruce Pascoe
Offline
Last seen: 12 years 10 months ago
Joined: 2006-01-15 16:14
3.0Ghz?!

It probably has hyper-threading, though, if it's that fast. Which is kinda like a proto-dual-core.

Gord Caswell
Gord Caswell's picture
Offline
Last seen: 3 weeks 6 days ago
DeveloperModerator
Joined: 2008-07-24 18:46
Trying it out. I'll let you

Trying it out. I'll let you know what I find.

wraithdu
Offline
Last seen: 11 years 4 months ago
Developer
Joined: 2007-06-27 20:22
I fixed the download in my

I fixed the download in my ProcFunc thread for ya.

OliverK
OliverK's picture
Offline
Last seen: 3 years 4 months ago
Developer
Joined: 2007-03-27 15:21
Updated See top for details.

Updated Smile

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

dinosoep
Offline
Last seen: 13 years 10 months ago
Joined: 2009-12-14 15:12
thanks, its working great.

thanks, its working great.

Bruce Pascoe
Offline
Last seen: 12 years 10 months ago
Joined: 2006-01-15 16:14
...

Why isn't this working? I have the following INI:

[AutoClose]
ProgramToWatch=PortableAppsPlatform.exe

[ProgramList]
Application1=\PortableApps\PortableFileAssociator\PortableFileAssociator.exe exit

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

dinosoep
Offline
Last seen: 13 years 10 months ago
Joined: 2009-12-14 15:12
question

question one:
[AutoClose]
ProgramToWatch=PortableAppsPlatform.exe

[ProgramList]
Application1=\PortableFileAssociater\PortableFileAssociator.exe exit
question two:
no Blum

Bruce Pascoe
Offline
Last seen: 12 years 10 months ago
Joined: 2006-01-15 16:14
Wait

You mean it's relative to the PortableApps directory? Heh, never would have figured that one out. That should documented somewhere.

dinosoep
Offline
Last seen: 13 years 10 months ago
Joined: 2009-12-14 15:12
wel, It took me 15 minuts

wel, It took me 15 minuts Blum
first of all I didn't knew were to place the ini.
then I tried everything and that was the result Blum
its working now but please document it beter next time Smile

OliverK
OliverK's picture
Offline
Last seen: 3 years 4 months ago
Developer
Joined: 2007-03-27 15:21
sure Its hard to write a

sure Smile

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

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

OliverK
OliverK's picture
Offline
Last seen: 3 years 4 months ago
Developer
Joined: 2007-03-27 15:21
...but PFA isn't closing when

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

What dinosoep said Smile

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?

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

Bruce Pascoe
Offline
Last seen: 12 years 10 months ago
Joined: 2006-01-15 16:14
...

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.

OliverK
OliverK's picture
Offline
Last seen: 3 years 4 months ago
Developer
Joined: 2007-03-27 15:21
Hmm, you know, now that wyou

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 Biggrin

*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

prapper
Offline
Last seen: 3 years 9 months ago
Developer
Joined: 2008-01-24 17:01
Splash

I'd like to tell you why this works but I don't know. Although it does Smile

Put "AutoClose.jpg" in Other\Source. You won't see it because the splash time is set to "0" (so no hourglass).

Section "Main"
	;=== Fix the hourglass
		InitPluginsDir
		File /oname=$PLUGINSDIR\splash.jpg "${NAME}.jpg"
		newadvsplash::show /NOUNLOAD 0 0 0 -1 /L "$PLUGINSDIR\splash.jpg"

	etc...

	TheEnd:
		newadvsplash::stop /WAIT
		Quit
Bruce Pascoe
Offline
Last seen: 12 years 10 months ago
Joined: 2006-01-15 16:14
The reason it works

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.

wraithdu
Offline
Last seen: 11 years 4 months ago
Developer
Joined: 2007-06-27 20:22
It's funny, I never noticed

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

Bruce Pascoe
Offline
Last seen: 12 years 10 months ago
Joined: 2006-01-15 16:14
I'm fairly certain

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.

OliverK
OliverK's picture
Offline
Last seen: 3 years 4 months ago
Developer
Joined: 2007-03-27 15:21
I'll have to try that. Though

I'll have to try that. Though I might make a nice looking splash screen just so nobody can see it Biggrin

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

Bruce Pascoe
Offline
Last seen: 12 years 10 months ago
Joined: 2006-01-15 16:14
Hehe.

Smile

wraithdu
Offline
Last seen: 11 years 4 months ago
Developer
Joined: 2007-06-27 20:22
Damn, creating a window is

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.

Bruce Pascoe
Offline
Last seen: 12 years 10 months ago
Joined: 2006-01-15 16:14
...

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.

OliverK
OliverK's picture
Offline
Last seen: 3 years 4 months ago
Developer
Joined: 2007-03-27 15:21
Version 1.2. I updated the

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 Blum Wink

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

Bruce Pascoe
Offline
Last seen: 12 years 10 months ago
Joined: 2006-01-15 16:14
Much better

No more annoying hourglass! Biggrin

orschiro
Offline
Last seen: 9 years 1 week ago
Joined: 2012-01-07 14:42
404 Not Found

Unfortunately the download is no longer available.

Can someone please re-upload it?

Log in or register to post comments