01-02-2025 11:59 AM
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?
01-02-2025 12:02 PM
Might want to show the snippet where you call it. The System Exec.vi can be picky about its settings.
01-02-2025 12:15 PM
Not very complicated... same string worked in the cmd
It takes a PDF file and convert it to PNGs.
01-02-2025 12:43 PM - edited 01-02-2025 12:56 PM
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..
01-02-2025 12:50 PM
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
01-02-2025 01:18 PM
same issue... not working propretly.
01-02-2025 03:23 PM
Put the working command into a batch file, then call the batch file from LabVIEW.
01-02-2025 03:25 PM - edited 01-02-2025 03:27 PM
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.
01-02-2025 03:36 PM
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?
01-02-2025 03:40 PM
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