| View previous topic :: View next topic |
| Author |
Message |
91v83y
Joined: 18 Nov 2009 Posts: 11
|
Posted: Wed Feb 24, 2010 12:54 pm Post subject: To watch a desktop folder and send to printer automatically. |
|
|
How do I approach this problem?
I want to watch a desktop folder and send any addition straight to the printer. Thanks for any ideas. |
|
| Back to top |
|
 |
Murx Guest
|
Posted: Wed Feb 24, 2010 1:09 pm Post subject: |
|
|
What about the privacy of the desktops owner? Sounds like sniffing  |
|
| Back to top |
|
 |
fred
Joined: 01 Feb 2010 Posts: 230 Location: Netherlands
|
Posted: Wed Feb 24, 2010 1:26 pm Post subject: |
|
|
Something simple like this?
| Code: | ; Directory to watch
WatchDir = C:\Temp
; build initial file list
PrevFileList = `n ; Initialize
Loop, %WatchDir%\*.*
PrevFileList = %PrevFileList%%A_LoopFileName%`n
; msgbox,%PrevFileList% ; uncomment to see existing files
Loop
{
; Check new files
NewFileList = `n ; Initialize
Loop, %WatchDir%\*.*
{
NewFileList = %NewFileList%%A_LoopFileName%`n
IfNotInString, PrevFileList, %A_LoopFileName%
msgbox,%WatchDir%\%A_LoopFileName% ; or something like: Run, print %WatchDir%\%A_LoopFileName%
}
PrevFileList = %NewFileList%
Sleep, 5000 ; time (ms)between check for new file
}
|
|
|
| Back to top |
|
 |
91v83y
Joined: 18 Nov 2009 Posts: 11
|
Posted: Wed Feb 24, 2010 2:08 pm Post subject: |
|
|
In regards to sniffing...this is simply an automation, no sniffing involved.
I added the following changes, seems to be no-worky.
WatchDir = C:\C:\Documents and Settings\KIP\Desktop\test
PrevFileList = `n
Loop, %WatchDir%\*.*
PrevFileList = %PrevFileList%%A_LoopFileName%`n
Loop
{
NewFileList = `n
Loop, %WatchDir%\*.*
{
NewFileList = %NewFileList%%A_LoopFileName%`n
IfNotInString, PrevFileList, %A_LoopFileName%
Run, print %WatchDir%\%A_LoopFileName%
}
PrevFileList = %NewFileList% |
|
| Back to top |
|
 |
None
Joined: 28 Nov 2009 Posts: 3086
|
Posted: Wed Feb 24, 2010 4:20 pm Post subject: |
|
|
You might want to put that sleep back in or it will eat resources
| Code: | | WatchDir = C:\C:\Documents and Settings\KIP\Desktop\test | Slight Problem here
| Code: | }
PrevFileList = %NewFileList%
} ;Put me back |
|
|
| Back to top |
|
 |
91v83y
Joined: 18 Nov 2009 Posts: 11
|
Posted: Wed Feb 24, 2010 5:25 pm Post subject: |
|
|
good eye, you stinker!!!
UR THE MAN
THANKS TO ALL WHO REPLIED TO HELP ME. |
|
| Back to top |
|
 |
fred
Joined: 01 Feb 2010 Posts: 230 Location: Netherlands
|
Posted: Wed Feb 24, 2010 8:12 pm Post subject: |
|
|
Forgot to add `n rond the filename so a name partial matching would not be missed (there was a reason i started with a `n).
| Code: | | IfNotInString, PrevFileList, `n%A_LoopFileName%`n |
|
|
| Back to top |
|
 |
|