Reloading script from command line

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
ianbottomley
Newbie Member
Posts: 4
Joined: Tue Mar 15, 2016 8:01 pm

Reloading script from command line

Post by ianbottomley » Tue Mar 15, 2016 8:14 pm

I know it is possible to reload scripts from the QCAD command line, without shutting down and restarting QCAD as I googled it and found it about a year ago ...
sadly no amount of googling has brought it to light this time
Ive tried every possible variation i can think of (reload, load, refresh etc etc) bit no joy

any offers please??

Ian B

User avatar
andrew
Site Admin
Posts: 5644
Joined: Fri Mar 30, 2007 6:07 am

Re: Reloading script from command line

Post by andrew » Wed Mar 16, 2016 9:00 am

The command line argument you are looking for is -always-load-scripts:
./qcad -h

Usage: ./qcad [Options] [Files to open]

-allow-multiple-instances        Don't try to avoid multiple instances from running
                                 simultaneously.
-always-load-scripts             Forces reloading of scripts when they are used.
                                 This is mainly useful during script development,
                                 to apply changes without restarting QCAD.
-app-id [ID]                     Set application ID. Multiple instances of the
                                 same application (same ID) cannot run
                                 simultaneously unless -allow-multiple-instances
                                 is used.
-autostart [script file]         Starts the given script file instead of the default
                                 scripts/autostart.js. Note that with this option,
                                 QCAD is not started but rather the application
                                 implemented in the given script.
-config [path]                   Reads and stores settings to QCAD3.ini at the given
                                 location instead of the default location.
-enable-script-debugger          Enables the script debugger.
                                 NOT recommended as this may cause unexpected
                                 behavior when using QCAD.
-debug-action-order              Print action oder information in menus
-exec [script file] [options]    Executes the given script file directly
                                 after staring QCAD. Options after the script
                                 file are passed on to the script.
-gui-css-file [CSS file]         Loads the specified CSS file.
-help                            Displays this help.
-locale [locale]                 Sets the locale to be used (overrides
                                 the language set in the preferences).
                                 E.g. '-locale de' starts QCAD in German.
-no-gui                          Don't use GUI. X11: don't connect to X11 server.
-no-show                         Use but don't display GUI.
-filter [filter]                 Opens the subsequent file(s) with the explicitly
                                 given import filter.
-rescan                          Rescan scripts folder for new add-ons
-version                         Displays the application version.
-enable-xdata                    Enables XData (custom properties) support.
-quit                            Quits QCAD, for example after executing the
                                 given script(s).


Mac OS X specific options:

-no-dock-icon                    Don't show icon in dock. This should only be used
                                 in combination with -no-gui.

ianbottomley
Newbie Member
Posts: 4
Joined: Tue Mar 15, 2016 8:01 pm

Re: Reloading script from command line

Post by ianbottomley » Wed Mar 16, 2016 9:59 am

Hi there thanks for that andrew - tried the -always-load-scripts switch previously but it doesnt do seem to do what it implies (scripts in libaray dont actually reload)
I found a command that could be run from the "Command:" prompt inside QCAD previously, something of the format "reload /path/script.js" but cant now find any reference to it, this allowed a script to be explicitly reloaded from the command prompt - and that seemed to work reliably.

Sadly can find no reference to it now.

Seem theres quite a large gap in the documentation when it comes to scripting and keyboard based interaction :(

any other offeres

Ian B.

J. F. van der Werf
Registered Member
Posts: 1
Joined: Sun Jun 17, 2018 4:16 am

Re: Reloading script from command line

Post by J. F. van der Werf » Sun Jun 17, 2018 5:00 am

It's two years later now and the problem of Ian Bottomley (Wed Mar 16, 2016 10:59 am) apparently has not been solved. Now i'm in the same kind of predicament: after opening a command screen, either as administrator or as 'guest', in the QCAD working directory, then typing <Qcad -h> yields no reaction; same for <qcad -help>, <qcad -version> and so on.
Trying: <qcad -always-load-scripts> starts qcad loading the scripts as found. However after minor changes in a script and invoking that script as per the menu system, the changed script is NOT reloaded. This renders the script development rather tiresome.

Also the somewhat loose usage of 'command line' which may refer to the command line in the qcad gui as well as to the cmd processor of the os, could confuse some users.


Jan.

Windows7, Windows 10, QCAD Ver.3.15.3

Post Reply

Return to “QCAD 'How Do I' Questions”