intercepting printer events in windows
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
intercepting printer events in windows
I'm not sure if what I want to do is possible, but I am sure that if it is someone here will know how it is done. I want a small app to pop up every time someone begins the print process, (after ctrl+p/file-print etc. but before hitting the ok button) Is there any interceptable messages from windows that can be used to trigger an app?
Re: intercepting printer events in windows
Hi Magice,
I don't think this can be done without an external!
Best
Klaus
I don't think this can be done without an external!
Best
Klaus
Re: intercepting printer events in windows
Well, that is not good news. I guess i need to issue a challenge to all the creative thinkers on this forum to find a way. After all this is of the utmost importance. An office prank hangs in the balance. My boss is always complaining that the office printer hates him, as it gives him but no one else problems. So, it is only natural that when he prints something the printer should inundate him with short and bald jokes. 

Re: intercepting printer events in windows
For Win
You can watch for the memory usage of spoolsv.exe in the processes.
get shell("tasklist /fo csv")
Simon
You can watch for the memory usage of spoolsv.exe in the processes.
get shell("tasklist /fo csv")
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: intercepting printer events in windows
Good thought, but since it opens a console window every time it runs, it would be impractical to continually poll for that data. Still. it is more than I have come up with. I think, unfortunately, Klaus is right. (as usual)Simon wrote:For Win
You can watch for the memory usage of spoolsv.exe in the processes.
get shell("tasklist /fo csv")
Simon
Re: intercepting printer events in windows
no no...
set the hideConsoleWindows to true
Simon
set the hideConsoleWindows to true
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: intercepting printer events in windows
Nice! It is a little tricky because of inconsistency but I think I can make it work. It seems to occasionally spike on its own so straight ">" evaluation is too sensitive. I just need to work out an acceptable range of difference between the idle and print modes.Simon wrote:no no...
set the hideConsoleWindows to true
Simon
Thank you.
Re: intercepting printer events in windows
Definitely should add sound...
What would be creepier?
OH OH... open notepad and use VBscript to type him a note then taskkill it
What would be creepier?
OH OH... open notepad and use VBscript to type him a note then taskkill it

I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: intercepting printer events in windows
Dude! that is awesome! I was going to do it all with revSpeak but I like that even better. I have everyone in the office in on it. They are all going to deny hearing or seeing anything.Simon wrote:Definitely should add sound...
What would be creepier?
OH OH... open notepad and use VBscript to type him a note then taskkill it

Re: intercepting printer events in windows
After extensive testing (at least 1 hour)
I have determined that Simon's technique will work perfectly for my application. However, for anyone reading this in the future, looking to write a more practical app, it is not perfect. On my machine a difference of 70k bytes of memory usage is the lowest I seem to be able to look for without getting false triggers. (I suspect this will change from machine to machine) This results in about 1 in twenty missed triggers. I actually set it for 100, and it adds a random factor where it only triggers about one third of the time. Anyone wanting to use this technique for an app that requires reliability will be disappointed (so Klaus is correct!) but for my app, Simon is the man!

Re: intercepting printer events in windows
Just an update. (Mostly for Simon)
We spent the afternoon coming up with a list of 50 different "short" and "bald" jokes/comments all told from the perspective of a angry printer with a bad attitude. Each time the script is triggered by the spoolsv.exe memory spike, the last line of the text file is read into a variable and then deleted from the file. Then based on a random number there is a 80% chance that it will revSpeak, and a 20% chance that it will open notepad and get typed out. When the text file is finally empty, it will print 50 copies of a particularly unflattering picture of him hurling into a trash can from last years Christmas party. (The trash can just happens to be beside the evil printer) In big letters across the picture it says "You splashed me you midget q-ball bastard. I will never forgive you." So far today it has gone off 6 times that we know of. We act as if we see and hear nothing. The hardest part of this project is keeping a straight face.
We spent the afternoon coming up with a list of 50 different "short" and "bald" jokes/comments all told from the perspective of a angry printer with a bad attitude. Each time the script is triggered by the spoolsv.exe memory spike, the last line of the text file is read into a variable and then deleted from the file. Then based on a random number there is a 80% chance that it will revSpeak, and a 20% chance that it will open notepad and get typed out. When the text file is finally empty, it will print 50 copies of a particularly unflattering picture of him hurling into a trash can from last years Christmas party. (The trash can just happens to be beside the evil printer) In big letters across the picture it says "You splashed me you midget q-ball bastard. I will never forgive you." So far today it has gone off 6 times that we know of. We act as if we see and hear nothing. The hardest part of this project is keeping a straight face.
Re: intercepting printer events in windows
WICKED!
Really, 6 times is enough to get him really wound up.
Great work!
To keep this on a liveCode learning topic
You get a random list 
How long are you going to run this?
Simon
Really, 6 times is enough to get him really wound up.
Great work!
To keep this on a liveCode learning topic
Code: Select all
sort lines of field 1 by random(the number of lines of field 1)
repeat for each line tLine of field 1
etc.

How long are you going to run this?
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: intercepting printer events in windows
We decided not to randomize the list because some of the things need to be said in order, and this also gives us a finishing point. Once the list is empty and the print comes out the gag is over....especially since he knows that picture came from my phone.Simon wrote:WICKED!
Really, 6 times is enough to get him really wound up.
Great work!
To keep this on a liveCode learning topicYou get a random listCode: Select all
sort lines of field 1 by random(the number of lines of field 1) repeat for each line tLine of field 1 etc.
How long are you going to run this?
Simon
