mwade93 Posted October 21, 2013 Share Posted October 21, 2013 (edited) I am trying to make code that when it changes vars it resets them. However, I have run into an issue. If i use this code, it works perfect, stores menuecho and then resets it: ^C^C^Csetvar;useri3;$M=$(getvar,menuecho);menuecho;2;menuecho;"$M=$(getvar,useri3)"; The action part of the code would go in the middle of this such as this (it is just inserting an attributed block, the # symbols are used so I can mass remove them with an attreq at end because insertion wont allow blanks): ^C^C^Csetvar;useri3;$M=$(getvar,menuecho);setvar;useri2;$M=$(getvar,attreq);menuecho;2;attreq;1;-insert;baringsch;\1;1;0;48;1;REFRIGERATED DISPLAY CASE;FEDERAL IND.;ELPRSS3;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;120;1;16;#;#;DGR;4";#;#;-attedit;n;n;baringsch;*;*;#;;menuecho;"$M=$(getvar,useri3)";attreq;"$M=$(getvar,useri2)"; However, when I use the second example it hiccups and I get this: Command: setvar Enter variable name or [?] : useri3 Enter new value for USERI3 : $M=DISPLAY Requires an integer between -32768 and 32767. I am just completely confused as to why this is happening. Edited October 21, 2013 by mwade93 Quote Link to comment Share on other sites More sharing options...
steven-g Posted October 21, 2013 Share Posted October 21, 2013 First guess is you are missing the closing quote at the end, but I will need to decipher what is going on first. Quote Link to comment Share on other sites More sharing options...
mwade93 Posted October 21, 2013 Author Share Posted October 21, 2013 First guess is you are missing the closing quote at the end, but I will need to decipher what is going on first. I actually fixed that on my end already, but I don't even get that far into the line of code. It never sets the useri2 or useri3 variables. The middle part works fine, I just can't get to it without it hiccuping. Quote Link to comment Share on other sites More sharing options...
steven-g Posted October 21, 2013 Share Posted October 21, 2013 I don't have your block, so I ran a test with a block with just 2 attributes, and it all runs fine, can you post a blank drawing with the block in it Quote Link to comment Share on other sites More sharing options...
mwade93 Posted October 21, 2013 Author Share Posted October 21, 2013 It is not actually our block, its a clients we work with frequently, so unfortunely no..... Did you use the code exactly as it sits in my first post or did you change it? Quote Link to comment Share on other sites More sharing options...
steven-g Posted October 21, 2013 Share Posted October 21, 2013 changed it in as much as I took out a load of the attribute values, the only other thing I could think of is that at the start of the insert command you have \1;1;0;48 etc. is 48 your first attribute value, if so take out one of the 1's so you get \1;0;48 and try that. Quote Link to comment Share on other sites More sharing options...
mwade93 Posted October 21, 2013 Author Share Posted October 21, 2013 I never get to that point though. It hiccups when it is trying to set the first variable. Command: setvar Enter variable name or [?] : useri3 Enter new value for USERI3 : $M=DISPLAY Requires an integer between -32768 and 32767. Quote Link to comment Share on other sites More sharing options...
steven-g Posted October 21, 2013 Share Posted October 21, 2013 Then we'll try it the other way round, attached is the test block I used. And here is the altered code ^C^C^Csetvar;useri3;$M=$(getvar,menuecho);setvar;useri2;$M=$(getvar,attreq);menuecho;2;attreq;1;-insert;test;\1;0;a;#;-attedit;n;n;test;*;*;#;;menuecho;"$M=$(getvar,useri3)";attreq;"$M=$(getvar,useri2)"; testblock.dwg Quote Link to comment Share on other sites More sharing options...
steven-g Posted October 21, 2013 Share Posted October 21, 2013 found it ---4"---, scripts and macro's don't like em, can you leave out the " symbol or use something else, a double tick for example '' Quote Link to comment Share on other sites More sharing options...
mwade93 Posted October 21, 2013 Author Share Posted October 21, 2013 found it ---4"---, scripts and macro's don't like em, can you leave out the " symbol or use something else, a double tick for example '' I took out the " symbol and added 2 '. It now stores useri3 correctly, but i am still getting an error with useri2. I copied the setvar part from the first part of the code and just changed it useri2 and changed the variable, so it can't be an error of mistyping characters. Command: setvar Enter variable name or [?] : useri3 Enter new value for USERI3 : 4 Command: setvar Enter variable name or [?] : useri2 Enter new value for USERI2 : $M=1 Requires an integer between -32768 and 32767. Enter new value for USERI2 : *Cancel* Command: *Cancel* PM me your email and I can send you the block. Wish I could just PM you the drawing. Quote Link to comment Share on other sites More sharing options...
Tuns Posted October 21, 2013 Share Posted October 21, 2013 I just used Steven's macro and I had no problems with USERI2. Quote Link to comment Share on other sites More sharing options...
steven-g Posted October 21, 2013 Share Posted October 21, 2013 Try taking out the 2 ' ticks just to see what happens, it could be that that is causing the problem now Quote Link to comment Share on other sites More sharing options...
mwade93 Posted October 21, 2013 Author Share Posted October 21, 2013 (edited) Its not exiting the menuecho variable at the end now... Edited October 21, 2013 by mwade93 Quote Link to comment Share on other sites More sharing options...
mwade93 Posted October 23, 2013 Author Share Posted October 23, 2013 steven-g has been helping me and this is what he has come up with. This works without any hiccups but we have still not discovered about menuecho. ^C^C^Csetvar;useri2;$M=$(getvar,attreq);attreq;1;-insert;baringsch;\1;1;0;48;1;REFRIGERATED DISPLAY CASE;FEDERAL IND.;ELPRSS3;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;120;1;16;#;#;DGR;4'';#;#;-attedit;n;n;baringsch;*;*;#;;attreq;$(getvar,useri2); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.