Jump to content

Recommended Posts

Posted

I am new to script so this is basically my first script file: Don't know why but my script only run about 4 line in and then no more output in the text window is observed. Curiously if I reorder some of the line in the scr I get only 1 line being run. The (command) is not as intended as enter/space but rather as Cancel. And this script is trying to find out which are read-only; I want the print out for each variable of whether it accept value or is read-only as though it's done manually with the Setvar Command. So I'm not trying to change any variable. I thought of using (setvar) and see which output error but I am assuming that I don't know what value are appropriate to pass for each variable so I could have just passed an invalid value to a non-read-only variable and that would throw the same error as a read-only one.

 

So I want the script to behave like the below (manually typed) history, going thru each variable.

Command: SETVAR
Enter variable name or [?]: _server

_SERVER = 0 (read only)
Command: *Cancel*

Command: SETVAR
Enter variable name or [?] <_SERVER>: *_AUTHORPALETTEPATH

Enter new value for *_AUTHORPALETTEPATH <"C:\Users\L\AppData\Roaming\Autodesk\AutoCAD 2020\R23.1\enu\S...">: *Cancel*

Command: SETVAR
Enter variable name or [?] <*_AUTHORPALETTEPATH>: HQGEOM

Unknown variable name.  Type SETVAR ? for a list of variables.
Command: *Cancel*

Command: SETVAR
Enter variable name or [?] <*_AUTHORPALETTEPATH>: 2DRETAINMODE

Enter new value for 2DRETAINMODE <1>: *Cancel*

Command: SETVAR Enter variable name or [?] <2DRETAINMODE>: 2DRETAINMODELEVEL

Enter new value for 2DRETAINMODELEVEL <0>: *Cancel*

But this is what running my script produces, stopping after parsing the 4th line in the script file. So I'm wondering why doesn't it continue in the same pattern? If you move 2dretainmode to the first line in the script it actually only finish only the first line while ordering the scr another way get a few more like the one below, but all seems to just stop abruptly. Note that I don't want to change any variable with this script, nor have I even tried to confirm the variables as I am intending to cancel the setvar command each time.

Command: setvar Enter variable name or [?]: "_SERVER"
_SERVER = 0 (read only)
Command: (command)

Command: nil

Command: setvar Enter variable name or [?] <_SERVER>: "*_AUTHORPALETTEPATH"
Enter new value for *_AUTHORPALETTEPATH <"C:\Users\L\AppData\Roaming\Autodesk\AutoCAD 2020\R23.1\enu\S...">: (command)

Command: nil

Command: setvar Enter variable name or [?] <*_AUTHORPALETTEPATH>: "HQGEOM"
Unknown variable name.  Type SETVAR ? for a list of variables.
Command: (command)

Command: nil

Command: setvar Enter variable name or [?] <*_AUTHORPALETTEPATH>: "2DRETAINMODE"
Enter new value for 2DRETAINMODE <1>: (command)

Command: nil

 

setvar.scr

Posted (edited)

Figured it out with a bit of reordering and using the resume command.

setvar.txt

Edited by drixoman
Posted
13 hours ago, BIGAL said:

Does not make sense your not changing anything ?

It's not intended to. I am only checking for read-only variables. There's some not listed by setvar command so I didn't want to check them each individually.

The problem was the script was being paused (I thought it was being terminated) with the (command) and I didn't know it would do that (thought it was supposed to just "cancel" the command, not pausing the script also). So yeah...newbie problem. Did some searching and realized using resume continued the script.

Posted

Whats wrong with

 

setvar ? *

 

DWGCOMPAREINPROGRESS OFF                                  (read only)
DWGCOMPPALETTESTATE OFF                                  (read only)

Posted (edited)

As I said the ones in my script is not listed by the setvar command, though I wish they are so there won't be any of these "hidden variable". I found about 100 of them that acad recognize from the cadforums database. As for what these variables do and whether their values warrant any attention is a complete different matter. I only wanted to do what the setvar command won't do with the variables that I know exist but are unlisted, for reason beyond my understandings---you think they should all be listed since even with the setvar command there are quite a few undocumented (not in acad help files) AND a few that's in the help and yet setvar doesn't list, like that toolpalettepath one.

 

Anyway I got the script modified to do what I wanted; probably can be refined more but I don't know anything else on Lisp/Script "coding" so this will do. Basically it was just newbie screwup fixed easily with some reordering of the lines/elements and a missing command that I didn't know about.

Edited by drixoman
Posted

Seems like playing with System Variables you know nothing about many of which are permanently saved in the Windows Registry could cause serious issues. While I'd be afraid to try it I'd love to see you post your results.

Posted (edited)

Maybe turn the turbo waste gate shut to see what will happen.  Answer all hell broke loose for about 1 second.

 

I have screwed Autocad just playing with menu's hate to think if start playing with unknown setvars.

Edited by BIGAL
  • Like 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...