[Solved] How do i add a script to qcad

Use this forum to ask questions about how to do things in QCAD.

Moderator: andrew

Forum rules
Always indicate Operating system, QCAD version
Attach Drawing files, Screenshots
Post one question per topic.
Post Reply
John Hyslop
Premier Member
Posts: 173
Joined: Mon Sep 30, 2019 6:21 am
Location: Melbourne - Australia

[Solved] How do i add a script to qcad

Post by John Hyslop » Thu Oct 24, 2019 2:55 am

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
Last edited by John Hyslop on Fri Oct 25, 2019 4:11 am, edited 1 time in total.
IF IT IS TO BE IT IS UP TO ME [ Ten most powerful 2 letter words ]

CVH
Premier Member
Posts: 686
Joined: Wed Sep 27, 2017 4:17 pm
Location: Belgium; Antwerp

Re: How do i add a script to qcad

Post by CVH » Thu Oct 24, 2019 5:33 am

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
QCADpro 3.24.3.0 / win7pro 32 bit / 4GB / 1e generation i7 2.6Ghz / HDD GeForce GT 520

John Hyslop
Premier Member
Posts: 173
Joined: Mon Sep 30, 2019 6:21 am
Location: Melbourne - Australia

Re: How do i add a script to qcad

Post by John Hyslop » Thu Oct 24, 2019 6:26 am

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?
Attachments
Qcad Menu.jpg
Qcad Menu.jpg (91.69 KiB) Viewed 911 times
Path to Mytool.jpg
Path to Mytool.jpg (13.23 KiB) Viewed 911 times
CMD.jpg
CMD.jpg (46.56 KiB) Viewed 911 times
IF IT IS TO BE IT IS UP TO ME [ Ten most powerful 2 letter words ]

CVH
Premier Member
Posts: 686
Joined: Wed Sep 27, 2017 4:17 pm
Location: Belgium; Antwerp

Re: How do i add a script to qcad

Post by CVH » Thu Oct 24, 2019 7:11 am

Folder "MyTools"
with 'M' and 'T'

Does that solve something?


Untitled1.png
Untitled1.png (26.98 KiB) Viewed 901 times
Untitled10.png
Untitled10.png (126.31 KiB) Viewed 901 times
Untitled11.png
Untitled11.png (146.75 KiB) Viewed 901 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
QCADpro 3.24.3.0 / win7pro 32 bit / 4GB / 1e generation i7 2.6Ghz / HDD GeForce GT 520

John Hyslop
Premier Member
Posts: 173
Joined: Mon Sep 30, 2019 6:21 am
Location: Melbourne - Australia

Re: How do i add a script to qcad

Post by John Hyslop » Thu Oct 24, 2019 7:16 am

Hi CVH

YEAH you're a legend
thank you sooooo much

Cheers
John
IF IT IS TO BE IT IS UP TO ME [ Ten most powerful 2 letter words ]

CVH
Premier Member
Posts: 686
Joined: Wed Sep 27, 2017 4:17 pm
Location: Belgium; Antwerp

Re: How do i add a script to qcad

Post by CVH » Thu Oct 24, 2019 7:32 am

Glad I could help.
Would you care to add [Solved] to the first post.

Regards,
CVH
QCADpro 3.24.3.0 / win7pro 32 bit / 4GB / 1e generation i7 2.6Ghz / HDD GeForce GT 520

Post Reply

Return to “QCAD 'How Do I' Questions”