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 

What would be the best way to do this?

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
madhatr



Joined: 10 Jan 2007
Posts: 33

PostPosted: Thu Jul 05, 2007 12:18 am    Post subject: What would be the best way to do this? Reply with quote

I have a machine on the network that is hooked up to a special printer. Special software is needed to print to it. I would like to have any machine to print off of it.

So I had this idea. A program that I wrote to print other labels could take the information needed and create a text file with all the var that I want to print. That file could then be saved to a shared drive. I would then need to write a program that would look in that directory for any new files. It would then take that file and use it for the var to print and then delete that file. It would check that directory every minute or so.

Would this be the best way to do this. If so what would be the best way to go about writing this program? Since many people would be doing this, sometimes at the same time the file would need to have a random name. How would I go about getting the name of that file and deleting just that file when it is done before moving on to the next file?

Thanks in advance for any help.
Back to top
View user's profile Send private message
poo_noo



Joined: 08 Dec 2006
Posts: 93
Location: Sydney Australia

PostPosted: Thu Jul 05, 2007 1:41 am    Post subject: Reply with quote

maybe use the run option
Code:
      Run, print.exe /D:\\path of printer "path & name of file",,Hide
Back to top
View user's profile Send private message Visit poster's website
ManaUser



Joined: 24 May 2007
Posts: 901

PostPosted: Thu Jul 05, 2007 2:36 am    Post subject: Reply with quote

The Loop FilePatern can take care of most of that. So, for example you might hive the files names like PrintMe23769285.txt. Then then you would use the command Loop PrintMe*.txt, and it will automatically pick up each file named in that way, one at a time, and allow you to read adn then delete it.
Back to top
View user's profile Send private message
madhatr



Joined: 10 Jan 2007
Posts: 33

PostPosted: Thu Jul 05, 2007 5:43 am    Post subject: Reply with quote

Ok, I tried this

Code:
#NoEnv
#Persistent
SetBatchLines, -1
Loop, E:\*.prt
 {
   FileRead, PRINT, %A_LoopFileName%
    {
      If (RegExMatch(PRINT, "`aim)^SN=(.+)$", RX))
       {
         SN := RX1
       }
      If (RegExMatch(PRINT, "`aim)^CONFIG=(.+)$", RX))
       {
         CONFIG := RX1
       }
      If (RegExMatch(PRINT, "`aim)^LABEL1=(.+)$", RX))
       {
         LABEL1 := RX1
       }
      If (RegExMatch(PRINT, "`aim)^LABEL2=(.+)$", RX))
       {
         LABEL2 := RX1
       }
      If (RegExMatch(PRINT, "`aim)^LCODE=(.+)$", RX))
       {
         LCODE := RX1
       }
      MsgBox, %A_LoopFileName%
      MsgBox, SN = %SN%`r`nCONFIG = %CONFIG%`r`nLABEL1 = %LABEL1%`r`nLABEL2 = %LABEL2%`r`nLCODE = %LCODE%
      FileDelete,E:\%SN%.prt
      Sleep, 60000
    }
 }
Return


but it is not loading the var's in. I have the filename as SN.prt. The A_LoopFileName shows the correct file, but the fileread does not seem to be working.
Back to top
View user's profile Send private message
nick



Joined: 24 Aug 2005
Posts: 345
Location: Berlin / Germany

PostPosted: Thu Jul 05, 2007 6:39 am    Post subject: Reply with quote

Code:
FileRead, PRINT, %A_LoopFileLongPath%

_________________
nick

denick @ http://de.autohotkey.com/forum/
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   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