ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Ghostscript Command Not Working via System Exec.vi

I’m trying to run a Ghostscript command through LabVIEW's System Exec.vi, but it's not working as expected. The following command works fine in the command prompt:

gswin64c -dNOPAUSE -dBATCH -sDEVICE=png16m -r300 -sOutputFile="C:\Users\USERPROFILE\Desktop\SavePicturesFolder\%d.png" "C:\Users\USERPROFILE\Desktop\example.pdf"

However, when I use System Exec.vi in LabVIEW and pass the same string, it doesn't execute properly. Does anyone have any suggestions on how to make this work through LabVIEW? Is there something I might be missing in the syntax or setup?

0 Kudos
Message 1 of 19
(1,375 Views)

Might want to show the snippet where you call it.  The System Exec.vi can be picky about its settings.

0 Kudos
Message 2 of 19
(1,373 Views)

Not very complicated... same string worked in the cmd

maxnoder1995_0-1735841647717.png



It takes a PDF file and convert it to PNGs.

0 Kudos
Message 3 of 19
(1,360 Views)

Going from memory, and could be wrong.. but don't you need to append something like "cmd /c" to the beginning of the command?  I think this runs it from the terminal.. kinda like [window]+r then cmd.. rather than just from [window] + r

 

There's some trick to make it from from the command terminal rather than just run it..

 

 

0 Kudos
Message 4 of 19
(1,349 Views)

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q000000YGivCAG&l=en-US

 

is a good read.  I dont have GS on this machine, and i'm in the middle of a compile, so I can't try it the cmd /c thing

0 Kudos
Message 5 of 19
(1,346 Views)

same issue... not working propretly.

0 Kudos
Message 6 of 19
(1,333 Views)

Put the working command into a batch file, then call the batch file from LabVIEW.

 

George Zou
0 Kudos
Message 7 of 19
(1,317 Views)

This is how I do it, but why is the System Exec.vi single role not working properly? Or at least not understandable enough to the user.


And this solution requires me to add another function that I don't know how to perform... I would love to write a function called "Is CMD Busy?" which will return a boolean variable.

0 Kudos
Message 8 of 19
(1,314 Views)

Could this be a user privilege issue?
Create a shortcut to the batch file, and set it to run as admin.
Then call the shortcut in LabVIEW.
Does the batch file work without LabVIEW?

 

George Zou
0 Kudos
Message 9 of 19
(1,309 Views)

I run the Batch File through LabVIEW.

The Batch File converts a PDF file into images but the software in LabVIEW does not wait for the process to finish, it just continues. Therefore, I want to check whether the process is in progress or finished

0 Kudos
Message 10 of 19
(1,307 Views)