AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

To watch a desktop folder and send to printer automatically.

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
91v83y



Joined: 18 Nov 2009
Posts: 11

PostPosted: Wed Feb 24, 2010 12:54 pm    Post subject: To watch a desktop folder and send to printer automatically. Reply with quote

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
View user's profile Send private message
Murx
Guest





PostPosted: Wed Feb 24, 2010 1:09 pm    Post subject: Reply with quote

What about the privacy of the desktops owner? Sounds like sniffing Confused
Back to top
fred



Joined: 01 Feb 2010
Posts: 230
Location: Netherlands

PostPosted: Wed Feb 24, 2010 1:26 pm    Post subject: Reply with quote

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
View user's profile Send private message
91v83y



Joined: 18 Nov 2009
Posts: 11

PostPosted: Wed Feb 24, 2010 2:08 pm    Post subject: Reply with quote

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
View user's profile Send private message
None



Joined: 28 Nov 2009
Posts: 3086

PostPosted: Wed Feb 24, 2010 4:20 pm    Post subject: Reply with quote

You might want to put that sleep back in or it will eat resources Smile
Code:
WatchDir = C:\C:\Documents and Settings\KIP\Desktop\test
Slight Problem here

Code:
}
PrevFileList = %NewFileList%
} ;Put me back
Back to top
View user's profile Send private message
91v83y



Joined: 18 Nov 2009
Posts: 11

PostPosted: Wed Feb 24, 2010 5:25 pm    Post subject: Reply with quote

good eye, you stinker!!!
UR THE MAN
THANKS TO ALL WHO REPLIED TO HELP ME.
Back to top
View user's profile Send private message
fred



Joined: 01 Feb 2010
Posts: 230
Location: Netherlands

PostPosted: Wed Feb 24, 2010 8:12 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group