Re: Difference in running a Bat file from within UP1.9 and from Command Prompt


Jim Stephenson
 

Ok, this is still weird. 

I have tried both Luuk's and Heidi's suggestions and it does the same thing.

I have the program creating a 'cmd' file that is then passed as a parameter into my .bat file. I watch the execution of the bat file on the screen and it has everything exactly as it should be. But, from UP it replaces the pdf file. 

If I run it from a command prompt like this, "scanfile.bat scansettings.cmd" it runs just fine and appends to the pdf file.



On Sat, Jan 13, 2018 at 11:42 AM, Heidi Schuppenhauer <heidis13@...> wrote:
What has worked well for me is to use blobs. That way I don't have to call another task
and it's a lot easier to put the bat file together. The form editor in Magic isn't the
easiest thing to use either.

1. Create an Ansi blob variable. Set the style to "edit" so you can display it if you want.
2. Update the variable with your bat text. You can just copy and paste the
text into the expression editor, and put quotes around it.
3. Do a Blb2File to store the blob somewhere.
4. Do a Delay if needed.
5. Then execute it.

I think it might be even more fun to do it in a .Net snippet. The editor in .Net
lends itself to typing out command text.



Heidi.Schuppenhauer

 

 

On Sat, Jan 13, 2018 at 3:59 AM, Luuk <luuk34@...> wrote:
On 12-01-18 22:17, Keith Canniff wrote:

Jim,

 

Generally speaking, we have bat files that are not created inside of UP/XPA, but are built outside of Magic and are passed a series of parameters %1, %2, etc.

 

This way we don’t get commands broken down into separate lines that don’t function correctly.

 

Plus we can test the bat files outside of Magic to make sure they’re syntactically correct.

 

Had too many issues generating the full bat files inside of Magic and then not being able to test them properly.

 

Just my .02

 

Keith Canniff


+1

Never create a bat-file 'dynamically'. because of the (as some say) dala needed to wait for it being created.

If it's a static file it wil always exist. and functionality can be added/change easily

try:
@ECHO OFF
SET LOG=m:\up\logfile.log
IF NOT EXIST "%1" ECHO "%1" does nog EXIST >> "%LOG"
SET APPEND=
IF "%2"=="APPEND" SET APPEND=-fpdfappend
m:\up\Department\TwainCom.EXE "%1" -r 300 -monochrome -n -o -p -paperformatusletter %2   >> %LOG%  2>&1


- output of the statements is added to the logfile
- the '2>&1' makes sure the erros are also added to this logfile
- this batchfile can run run with 1, or 2 parameters,
  the first parameter should contain the pdf-file
  then second one should contrain APPEND is appending is needed.

Thing like "Qt: Untested Windows version 6.2 detected!" are of concern..
https://bugreports.qt.io/browse/QTBUG-57275




Join main@magicu-l.groups.io to automatically receive all group messages.