Page 1 of 1

[Solved] How do i add a script to qcad

Posted: Thu Oct 24, 2019 2:55 am
by John Hyslop
Hi
Newbie question, how do i add scripts to Qcad
Version:
3.23.0.0 (3.23.0)

I tried adding the script to this folder "C:\Program Files\QCAD\scripts\Misc\Examples" and added a folder called
Mytool with JS file and it doesn't showup when i start qcad? its and example file from "https://github.com/qcad/qcad/tree/maste ... mpleplugin"

Do I nead to do anything else? I followed the instructions but I must be doing something wrong??

Cheers
John

Re: How do i add a script to qcad

Posted: Thu Oct 24, 2019 5:33 am
by CVH
Hi John,

The scripting rely for a bit on the actual folder structure.
Line 23 of the example points to "MiscMenu".
With line 21-22 it will take position 0 in group 0 there.

What you may have missed in the tutorials is:
MyTools.js has to sit in a folder called MyTools.
In this case the folder MyTools should reside under the folder Misc.

So you only have to move the MyTools folder to under the Misc folder and all will be ok.

Reboot Qcad after the move.
Reboot Qcad after altering any code.

Start Qcad with rescanning the scripts: "C:\Program Files\QCAD\qcad.exe" -rescan
(I think this is the same option as in App.Prefs / Scripting)
Start Qcad in debugger mode: "C:\Program Files\QCAD\qcad.exe" -enable-script-debugger
(To catch load or execution errors: !Not that stable!)
Start Qcad with reloading your scripts before execution: "C:\Program Files\QCAD\qcad.exe" -always-load-scripts
Or any combination.

Regards,
CVH

Re: How do i add a script to qcad

Posted: Thu Oct 24, 2019 6:26 am
by John Hyslop
Hi CVH

It didn't work... the file points to Mytool folder not Mytools
so I tried both, I'm definately missing something here???
also ran CMD as administrator these commands as you said
and it didn't work? I can load libraries up ok and I've added a few
but having trouble with scripts :-(

Could you send me a scipt that you know works so I can test it's not just a bodgy script?

Re: How do i add a script to qcad

Posted: Thu Oct 24, 2019 7:11 am
by CVH
Folder "MyTools"
with 'M' and 'T'

Does that solve something?


Untitled1.png
Untitled1.png (26.98 KiB) Viewed 921 times
Untitled10.png
Untitled10.png (126.31 KiB) Viewed 921 times
Untitled11.png
Untitled11.png (146.75 KiB) Viewed 921 times
The start option of QCAD icon is:
"C:\Program Files\QCAD\qcad.exe"
The start option of QCAD DEBUG icon is:
"C:\Program Files\QCAD\qcad.exe" -rescan -enable-script-debugger -always-load-scripts

Hope this helped.
CVH

Re: How do i add a script to qcad

Posted: Thu Oct 24, 2019 7:16 am
by John Hyslop
Hi CVH

YEAH you're a legend
thank you sooooo much

Cheers
John

Re: How do i add a script to qcad

Posted: Thu Oct 24, 2019 7:32 am
by CVH
Glad I could help.
Would you care to add [Solved] to the first post.

Regards,
CVH