Jump to content

Button macro problem


Recommended Posts

Hello.

I have a problem.

Well, basically I've created two buttons with custom scripts - one, that creates and exports layer state of current file, and another one, that imports the layer state saved with the previous button.

Here's the problem. When I open a file and try to export the layer state using my button, it doesn't work. It only works after I open and close the CUI customization window (and only by clicking somewhere on the toolbar and selecting "Customize..."). The weird part is, that I don't have to change anything in CUI settings, I can just click cancel and after the CUI window has closed, my macro buttons work. Why is this? What exactly changed after I opened and closed the CUI customization window? Is there a way to solve this, so it wouldn't be necessary to open the CUI window?

Here's how the comandline window looks in both cases:

Before opening and closing the CUI

http://i126.photobucket.com/albums/p116/xikes/ls_er.jpg

After opening and closing the CUI

http://i126.photobucket.com/albums/p116/xikes/ls_ner.jpg

 

Here's the script, I used for the buttons:

Export:

^C^C-layer A S layer_state^M EX layer_state;"$M=$(getvar,DWGPREFIX)"layer_state.las""";;;^C^C

 

Import:

^C^C-layer A I;"$M=$(getvar,DWGPREFIX)"layer_state.las""";R;layer_state;^C^Cchange ALL^M P C BYLAYER;;^C^C

 

I'm using AutoCad 2007LT.

 

Note. the last part of the import button simply changes the color of everything to bylayer.

Link to comment
Share on other sites

When you use "$M=$(getvar,dwgprefix)"layer_state"" it will return a string with the path of your drawing in it. When this string is evaluated in the command string the \ (backslashes) are used to pause for user input.

 

When I tried out your macro for layer state export it paused for user input directly after the double inverted commas.

Link to comment
Share on other sites

Well, it works on 2007 LT version (under certain conditions, as described above).

But yeah, when I tried later at home on 2011, it, kinda, doesn't work either way.

 

I'm starting to think, I misunderstand the function of quotation marks in macro scripts and diesel expressions. Can someone briefly explain this to me?

Link to comment
Share on other sites

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...