Sign in to follow this  
Followers 0
simy8891

Create a new dynamic-temporary process

8 posts in this topic

Hi guys,

this one's gonna be difficult to explain :) .

First of all, the problem, perhaps you have a better solution:

I want to watch out, in a loop, for any .txt file in a folder, in case it's found, it needs to read some data out of it (I'm not interested in this, I know how to work that out) and send a single or a number of labels to a printer. Now, I don't want the process to stop looking for a new .txt file, but I want to send the print job with a different process. I guess Run will do. Problem here is: if somebody send a different job at about the same time to the same printer, it might get tricky and actually print, for instance: 20 labels for the first user, 3 for the second, 5 for the first and then 10 for the second user again.

What if I create instead a temporary process for the given printer? Is that possible? For instance:

User 1 sends 100 labels on printer 1

User 2 sends 20 labels on printer 2

User 3 sends 30 labels on printer 1

Script, as soon as it finds User 1's .txt file, will create a temporary process for it, for instance called printer 1, but won't wait for it. It'll start elaborating User 2's txt file and initiate a new process (printer 2), then go back to one, this time, if process 1 exists, it won't start it again but will leave the file as it is, go back to the loop, and check again later.

I'm really sorry for the bad explanation, english's not my first language but I wouldn't be able to explain it that well in my native's :D

Cheers!

Share this post


Link to post
Share on other sites



Isn't a spooler the better/easier option?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Not really since I'm sending zpl files via netcat. Couldn't find a better way yet. How would implement the spooler?

Ta

Share this post


Link to post
Share on other sites

I'm not very expirienced in this area. But I'm sure Google will help :)

If you need to serialize your script I would do the following:

Store the ProcessID returned by run in a variable (one for each printer).

When a new text file arrives check if the printers variable has been set. If true check if the process still exists. If True wait until the process doesn't exist any more and then process the print file.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Search for "print jobs".


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites

Print Jobs won't work. Neither a spool will.

Problem is: I'm not sending a single job, that's be easy since the printer itself will work that out. I'm sending each label as a separate file which mean 100 files for 100 labels.

Coming back to the first request: what's the best way to create a temporary process? I was thinking to create a separate .exe file which will only handle the printing part of the script. Can that be called with a specific process name or is there a way to rename it while running? Basically it can create a new process for each different printer and if the process already exists, skips it.

Share this post


Link to post
Share on other sites

Print Jobs won't work. Neither a spool will.

Problem is: I'm not sending a single job, that's be easy since the printer itself will work that out. I'm sending each label as a separate file which mean 100 files for 100 labels.

From what I can understand (i.e. not all) from MSDN about printing, a job can include printing of a number of documents. That could solve the grouping problem in the OP. Googling a little brought some hints like this one.


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites

It won't work: imagine user A sending a number of jobs whilst user B has already sent another few.. it'll create just a number of files which I can't group. Isn't really there a way to just start a process witb a specific name? If not I will probably go for the ugly solution (if it works..): have a print.exe which gets copied with a different name (printer ip address or name for instance) and then started with the necessary paramenters.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0