Hello all,
I would like to write a script that works like this:
1.- Ask me in command line to introduce a string.
2.- Use this string to find certain layer names.
3.- Set specific properties to this layers, like freezing, locking, etc.
I know how to do steps 2. and 3., but I never succeed on step 1. I've found the way to ask a coordinate via command line, but not a string to fill a variable content of the script. Any help with that would be appreciated.
Regards! David
introduce script variable content in command line
Moderators: andrew, Husky, J-J
- dfriasb
- Senior Member
- Posts: 119
- Joined: Thu Mar 10, 2016 1:08 pm
- Location: Calafell, Tarragona, Spain
Re: introduce script variable content in command line
Here I attach the script. It is working, but just for one specific string: ".v1"
that contains this string, from QCAD.
Thanks,
David
I would like to be able to define the variable
Code: Select all
subs
Thanks,
David
Re: introduce script variable content in command line
Actions in QCAD are event based. Whenever something occurs (mouse moved, mouse clicked, key pressed, command entered in command line, action begins, action ends, etc.) an event is triggered.
If you want to stop everything and wait for the user to enter something, you need to show a dialog.
The command line can be used at any time while the action is running. If the user enters a value, that value is passed to commandEvent of the action:
If you want to stop everything and wait for the user to enter something, you need to show a dialog.
The command line can be used at any time while the action is running. If the user enters a value, that value is passed to commandEvent of the action:
Code: Select all
MyAction.prototype.commandEvent = function(event) {
var cmd = event.getCommand();
// user entered the contents of cmd in command line
};