QCAD command line execution JS script problem

Discussion forum for C++ and script developers who are using the QCAD development platform or who are looking to contribute to QCAD (translations, documentation, etc).

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files, scripts and screenshots.

Post one question per topic.

Post Reply
WildWolfCJ
Full Member
Posts: 84
Joined: Fri Oct 20, 2023 7:21 am

QCAD command line execution JS script problem

Post by WildWolfCJ » Fri Jan 12, 2024 8:44 am

QCAD 3.28.2 pro win10
Hi all
I opened the QCAD interface program and then executed the JS script in the cmd command line interface, but the command line would not be executed and the QCAD program was just pinned to the top.
How to sequentially execute cmd scripts with the QCAD interface open?
Thank you so much

CVH
Premier Member
Posts: 3480
Joined: Wed Sep 27, 2017 4:17 pm

Re: QCAD command line execution JS script problem

Post by CVH » Fri Jan 12, 2024 12:10 pm

Too little information.

Command Line of the QCAD GUI?
OS command line script? ... scripts?
What is meant by 'I opened the QCAD interface program'

The general solution would be that the parent script calls the child scripts to be executed sequentially ...

Regards,
CVH

WildWolfCJ
Full Member
Posts: 84
Joined: Fri Oct 20, 2023 7:21 am

Re: QCAD command line execution JS script problem

Post by WildWolfCJ » Mon Jan 15, 2024 7:01 am

HI CVH
Thank you very much for your reply. I'm sorry I didn't describe it clearly.
What is meant by 'I opened the QCAD interface program'
This means the QCAD GUI program is running
Is there any way to have the command line run mode run in parallel with the QCAD GUI, instead of running the command line just bringing the QCAD GUI to the front?

CVH
Premier Member
Posts: 3480
Joined: Wed Sep 27, 2017 4:17 pm

Re: QCAD command line execution JS script problem

Post by CVH » Tue Jan 16, 2024 11:27 am

WildWolfCJ wrote:
Mon Jan 15, 2024 7:01 am
Is there any way to have the command line run mode run in parallel with the QCAD GUI, instead of running the command line just bringing the QCAD GUI to the front?
Normally QCAD will not start an extra instance of itself when called.
One can however instruct it to do so:
Add the -allow-multiple-instances switch when calling QCAD.

Straightforward when initiating an OS command line instance.
To start the normal QCAD GUI with this flag you probably need to edit the shortcut under the desktop icon.

They are separate instances of the same application and these don't share the same memory.
Usually an OS command line instance will run in a blink of an eye and close ... That might alter the output DXF file if conceived as such.
The other instances are not aware of this change.

I once posted what the -help or -h switch would print out:
https://www.qcad.org/rsforum/viewtopic. ... 840#p30840

Regards,
CVH

WildWolfCJ
Full Member
Posts: 84
Joined: Fri Oct 20, 2023 7:21 am

Re: QCAD command line execution JS script problem

Post by WildWolfCJ » Mon Jan 22, 2024 2:03 am

HI CVH
I have been very busy these days. I am very sorry for the late reply. You really helped me a lot.
I will use this parameter to test and report any problems in time.
Add the -allow-multiple-instances switch when calling QCAD.

WildWolfCJ
Full Member
Posts: 84
Joined: Fri Oct 20, 2023 7:21 am

Re: QCAD command line execution JS script problem

Post by WildWolfCJ » Tue Jan 23, 2024 7:11 am

HI CVH
Add the -allow-multiple-instances switch when calling QCAD.

Good news, after testing this flag can solve the problem of executing JS in the background

CVH
Premier Member
Posts: 3480
Joined: Wed Sep 27, 2017 4:17 pm

Re: QCAD command line execution JS script problem

Post by CVH » Tue Jan 23, 2024 9:45 am

WildWolfCJ,

The switch is intended for this purpose and I did not expect anything different.

Note that it is not really "in the background" ...
... Executing a command line script with this switch runs in another instance of QCAD.
With this switch one can run more than one instances of QCAD with or without a GUI.
It is the -no-gui switch that instructs QCAD to run without displaying a GUI.

There are also methods of running scripts in the background when the GUI is active, running off-screen using an off-screen document.

Regards,
CVH

Post Reply

Return to “QCAD Programming, Script Programming and Contributing”