Post reply

Name:
Email:
Subject:
Message icon:

Verification:

shortcuts: hit alt+s to submit/post or alt+p to preview


Topic Summary

Posted by: LukeV
« on: September 10, 2008, 07:34:27 AM »

Nice work  ;)
Works great now :)
Posted by: RTT
« on: September 10, 2008, 03:22:31 AM »

Hmmm, good point...
Can be easily fixed in the batch code.
Just double quote the entire stamprules parameter and double quote the input variable in the empty rule check IF line or the wrong IF syntax will stop the batch.

Code: [Select]
Echo@ off
     set s=%1
     SHIFT
     set v=%1
     SHIFT
:NEXT
     IF (%1)==() GOTO STAMPIT
     set v=%v%;%1
     SHIFT
GOTO NEXT
:STAMPIT
    SET /P q=Stamp rule [1-] =
    IF "%q%"=="" set q=1-
    call rundll32 "C:\Program Files\PDF-ShellTools\PDFShellTools.dll",Stamp %s% stamprules=%q% %v%
Posted by: LukeV
« on: September 10, 2008, 02:09:10 AM »

Ahhh that is even easier.
The only thing is, if you want to stamp several pages you need to put double quotation marks around the pages (I imagine this is due to the comma's interferring with the programming). Eg. to print pages 1,6 and 8 you need to enter into the CMD box "1,6,8". Is there any way to add the " " marks into the programing so you only have to add the page numbers into the command box?
I tried working out how to do this, but to no success.

LukeV
Posted by: RTT
« on: September 08, 2008, 11:52:19 PM »

Quote from: LukeV
P.S I also modified the script to allow me to specify which pages will be stamped, without having to modify the CMD file. I just add "" to the end of the target field to print all the pages, or "1" to print the first page, etc.

Nice ;). You can extend your idea and ask for the stamp rule everytime that batch runs. Just press enter to use the default (1-) one.
Code: [Select]
Echo@ off
     set s=%1
     SHIFT
     set v=%1
     SHIFT
:NEXT
     IF (%1)==() GOTO STAMPIT
     set v=%v%;%1
     SHIFT
GOTO NEXT
:STAMPIT
    SET /P q=Stamp rule [1-] =
    IF (%q%)==() set q=1-
    call rundll32 "C:\Program Files\PDF-ShellTools\PDFShellTools.dll",Stamp %s% stamprules=%q% %v%
Posted by: LukeV
« on: September 07, 2008, 11:50:17 PM »

Hehehe....I should have worked that out  ::)
I think when you copy and paste scripts from IE it adds a space after every line.

All working now :)

P.S I also modified the script to allow me to specify which pages will be stamped, without having to modify the CMD file. I just add "" to the end of the target field to print all the pages, or "1" to print the first page, etc.

Echo@ off
     set s=%1
     SHIFT
     set q=%1
     SHIFT
     set v=%1
     SHIFT
:NEXT
     IF (%1)==() GOTO STAMPIT
     set v=%v%;%1
     SHIFT
GOTO NEXT
:STAMPIT
call rundll32 "C:\Program Files\PDF-ShellTools\PDFShellTools.dll",Stamp %s% stamprules=%q% %v%
Posted by: RTT
« on: September 05, 2008, 10:23:00 AM »

I only see one possibility, you have a space after set v=%1_
Make sure the end of line is just after the 1.
Posted by: LukeV
« on: September 05, 2008, 06:16:00 AM »

OK. So I worked out the problem. There is a space between the first file extension and the semi-colon. If I put the file names in manually without the space it works.
Only problem is I don't know what is putting the space in there, so I may need your help.


Thanks,

Luke
Posted by: LukeV
« on: September 05, 2008, 05:58:00 AM »

OK. So I updated to the new code in the cmd file.
I also added the echo command (and deleted the echo off command at start). This is the output. It still won't show both files in StampIt. Maybe you can see something wrong with my output? Oh, 2.PDF is the file that shows up in the file list. EDIT - Actually the file that loads up is different every time.


C:\stamps>set s="Template=C:\stamps\ps.stp"

C:\stamps>SHIFT

C:\stamps>set v=C:\temp1\1.pdf

C:\stamps>SHIFT

C:\stamps>IF (C:\temp1\2.pdf) == () GOTO STAMPIT

C:\stamps>set v=C:\temp1\1.pdf ;C:\temp1\2.pdf

C:\stamps>SHIFT

C:\stamps>GOTO NEXT

C:\stamps>IF () == () GOTO STAMPIT

C:\stamps>call rundll32 "C:\Program Files\PDF-ShellTools\PDFShellTools.dll",Stamp
 "Template=C:\stamps\ps.stp" stamprules=1- C:\temp1\1.pdf ;C:\temp1\2.pdf
Posted by: RTT
« on: September 05, 2008, 01:59:00 AM »

Quote from: LukeV
I've managed to get the first code you posted working with a single file. So I right click, select "send to -stamp" and it pops up the GUI and I can stamp the file.
When I try selecting 2 PDFs, right click and select "send to- stamp" the GUI comes up but when I press stamp, I get the following RunDLL32 error:
"Access violation at address 00BBE3F4 in module "PDFShellTools.dll. Read of address 00000024."
Make sure the number of files in the files to stamp list (Files tab) matches the number you have submitted. If not, don't run it or you get that error.
The problem is related to some bad file list passed from the command line, and weak code (now fixed) unable to deal with that.
Why the file list is wrong, I don't know. Check if files submitted don't have comma or semicolon characters on it's names.
You can inspect the file list command line passed inserting next two lines

Code: [Select]
Echo %v%
pause

before the :STAMPIP label line.

Quote from: LukeV
I haven't been able to get the second code working. I've created the cmd file with the code as above, and created a shortcut with the C:\stamps\Test.cmd "C:\stamps\ps.stp" in the target box. When I use it though, it doesn't start the GUI, similar to when I tried pointing the first script to a stp file with a space in it's name.

Sorry, my mistake. The double quotes in the path to the stamp template are the cause.
To fix it, and also add support for templates with spaces in name/path, set target box as C:\stamps\Test.cmd "Template=C:\stamps\ps.stp" (double quotes are now needed)
and use next improved batch code.
Code: [Select]
@ECHO OFF
     set s=%1
     SHIFT
     set v=%1
     SHIFT
:NEXT
     IF (%1)==() GOTO STAMPIT
     set v=%v%;%1
     SHIFT
GOTO NEXT
:STAMPIT
call rundll32 "C:\Program Files\PDF-ShellTools\PDFShellTools.dll",Stamp %s% stamprules=1- %v%
Posted by: LukeV
« on: September 04, 2008, 11:55:00 PM »

I've managed to get the first code you posted working with a single file. So I right click, select "send to -stamp" and it pops up the GUI and I can stamp the file.
When I try selecting 2 PDFs, right click and select "send to- stamp" the GUI comes up but when I press stamp, I get the following RunDLL32 error:
"Access violation at address 00BBE3F4 in module "PDFShellTools.dll. Read of address 00000024."

I haven't been able to get the second code working. I've created the cmd file with the code as above, and created a shortcut with the C:\stamps\Test.cmd "C:\stamps\ps.stp" in the target box. When I use it though, it doesn't start the GUI, similiar to when I tried pointing the first script to a stp file with a space in it's name.


Luke
Posted by: RTT
« on: September 03, 2008, 10:27:00 PM »

Quote from: LukeV
Do you think it would be possible to use the "send to" command to stamp more than 1 PDF at a time? Or is this not possible?
Have you tried?! Almost all the code in the above two batch file examples is to deal with that possibility, and works fine. The maximum number of files we can pass is limited by the maximum length available for command line parameters, so, it is directly related to files names and path lengths.
http://support.microsoft.com/kb/830473
When this limit is reached, because of too many files selected, you will get a warning message from the Shell.
I have also noted an extra length limit in Windows Vista when what we put in the "Send to" folder is a shortcut and not the batch file itself.
In XP the limit is equal for shortcuts or real batch files, but, in Vista, decrease when shortcuts used!! I haven't read nothing about why this occur!!!

Quote from: LukeV
If not, it would be great to get the drop down list of recently used stamps so you don't need to navigate and find it each time, or have the previously used stamp come up as default :)
The list of last used ones is already working and will go out with next version. ;)
Quote from: LukeV
One other thing, is it possible to select the default treatment of files once the have been stamped? At the moment, I have to go in and change the file save mode from "save in another folder" to "overwrite original files" each time you stamp a document
When started from the command line interface (the used from the "Send to" menu), yes. If no OutputPath parameter specified, it will overwrite source file, if OutputPath equal to the source file path, will create a backup file, and when specified OutputPath is different from the source path will, obviously, create the stamped files on that directory.
For the GUI interface, maybe I can add a "Set as default" button that show up when user change that option... ::)
Posted by: LukeV
« on: September 03, 2008, 02:19:00 AM »

Good work!! All the mentioned bugs seem to have been sorted!!

Do you think it would be possible to use the "send to" command to stamp more than 1 PDF at a time? Or is this not possible?
If not, it would be great to get the drop down list of recently used stamps so you don't need to navigate and find it each time, or have the previously used stamp come up as default  :)

Thanks for all your help. I will continue testing to see if any other bugs.

Cheers,

Luke

Edit - One other thing, is it possible to select the default treatment of files once the have been stamped? At the moment, I have to go in and change the file save mode from "save in another folder" to "overwrite original files" each time you stamp a document.
Posted by: RTT
« on: September 03, 2008, 12:28:00 AM »

Quote from: LukeV
It happens with all stamps (image and text). I have worked out now that if I deselect the stamp object and then re-click on it, all the values seem to come up again anyway.
Strange..., is working fine here. Or the problem is already fixed in the version I'm testing, or is related to some specificity of your system.

Quote from: LukeV
The only issue I have is that when it loads up a text stamp, the second text line/object isn't rotated like how it was saved.
I also found that bug while testing the "Send to" menu idea, and it is now fixed.

Quote from: LukeV
Ohh one other thing with the Send To stamp. When you try and select the destination of the new PDF as the same location as the original, it doesn't create the PDF.
Fixed that too.

Check if with the patched version I have emailed to you any of these bugs persist, or if a new one shows up  ;)
Posted by: LukeV
« on: September 02, 2008, 03:02:00 AM »

Ohh one other thing with the Send To stamp. When you try and select the destination of the new PDF as the same location as the original, it doesn't create the PDF.
Posted by: LukeV
« on: September 02, 2008, 02:58:00 AM »

Quote from: RTT
Is this problem stamp file related or show up every time you open a stamp, even different one, file?
What objects you have on these stamps?
It happens with all stamps (image and text). I have worked out now that if I deselect the stamp object and then re-click on it, all the values seem to come up again anyway.

I've got the "Send to" stamp command working. This is really helpfull!!
The only issue I have is that when it loads up a text stamp, the second text line/object isn't rotated like how it was saved. It works when I stamp manually, but using the send to link it puts it at 0 degrees rotation. I'll e-mail you my stp file and the PDF to see if you can work out why.

Cheers,

LukeV