create a command

create a command

Anonymous
Not applicable
2,540 Views
26 Replies
Message 1 of 27

create a command

Anonymous
Not applicable

Hello,

 

I have been working on making a command, that does the following,

 

erase all but the selected,

purge all.

saveas - choose file location and name.

updatefields - all.

save.

My current script looks like this:

 

^C^C_erase;all;r \\;z;e;-purge;a;;n;_saveas;updatefield;all;;_save;

 

If I end the script at "save as;"

I am able to see the save as window and can choose the location of where I want to save it,

 

however I don't see it when I add "updatefield;all;;_save;" to the end.

just need help getting the last bit sorted

 

Thanks in advance

 

0 Likes
Accepted solutions (1)
2,541 Views
26 Replies
Replies (26)
Message 2 of 27

rkmcswain
Mentor
Mentor
The Save command saves a copy of the current drawing but leaves you in the current drawing.

SaveAs does the same as Save, but switches you to this new copy.

Qsave simply saves the current drawing in place.

Which one are you trying to do?

More Info: http://cadpanacea.com/wp/?p=697



R.K. McSwain     | CADpanacea | on twitter
0 Likes
Message 3 of 27

Anonymous
Not applicable

I would firstly like the command to SaveAs, (saves the drawing under a new name and opens this new drawing.)

Then I would like to updatefield and save (save my drawing and I stay in the drawing)
0 Likes
Message 4 of 27

rkmcswain
Mentor
Mentor
The use QSAVE as your last command.
R.K. McSwain     | CADpanacea | on twitter
0 Likes
Message 5 of 27

Anonymous
Not applicable
My problem is really in that when I add anything after the SaveAs command it does not open the window with the files so I can choose where to put it and what to save it under. why is that?
0 Likes
Message 6 of 27

gdefilo
Advocate
Advocate

Hi rkmcswain,

and hi to TimonUdaiyar too.

 

As you suggested, I would substitute the last "save" command with "qsave".

But firstly I would suggest to put a backslash after the "_saveas" command, so that the application will wait for the user to change the name of the file and of the directory, if necessary.

So, the macro should be:

^C^C_erase;all;r \\;z;e;-purge;a;;n;_saveas;\;updatefield;all;;_qsave;

 

After the first "save" it will continue updating the fields and so on.

 

Hope this helps,

Giancarlo

 

0 Likes
Message 7 of 27

Anonymous
Not applicable

Hello Giancarlo

 

I made the changes as you suggested, but I am still not getting window that I normaly get when I choose SaveAs.

 

please see attached screen shot pic 1 is what I get with the updafield and qsave added

 

without it I get pic 2

 

I would like to get pic 2 with the updatefield and qsave added.

0 Likes
Message 8 of 27

gdefilo
Advocate
Advocate

Hi TimonUdaiyar,

you're right.

My fault.

My macro is not correct for your purposes.

 

Sorry,

Giancarlo

0 Likes
Message 9 of 27

gdefilo
Advocate
Advocate

There is a little workaround but I don't think you will like it.

The macro should be changed like this:

 

^C^C_erase;all;r \\;z;e;-purge;a;;n;_saveas;\\updatefield;all;;_qsave;

 

It will work, but it will not open a dialog for the saveas command: you will be asked to write the name of the file at the command line, with the entire directory tree (for instance: "C:\My works\drawing01.dwg". Note: the quotes are for directories which contain spaces between words - like "my work").

So, it's not good for you I think.

 

Giancarlo

 

0 Likes
Message 10 of 27

Sofia.Xanthopoulou
Mentor
Mentor

Hi @Anonymous,

 

I have followed this discussion from the beginning, because I did some testing, too. I couldn't find any way to bring up the saveas dialogbox after the macro continues. 

Maybe you should consider to split the macro. Two working commands should be better than one, that isn't even what you need Smiley Wink

 

Regards

 

-----------------------------
Please accept as solution if my post fully resolves your issue, or reply with additional details if the problem persists.

 

0 Likes
Message 11 of 27

hmsilva
Mentor
Mentor

@Anonymous wrote:
My problem is really in that when I add anything after the SaveAs command it does not open the window with the files so I can choose where to put it and what to save it under. why is that?

Hi Timon,

if you are not on LT, try to add a 'initdia' to call the dialog...

 

...-purge;a;;n;(initdia);_saveas...

 

Untested...

Hope this helps,
Henrique

EESignature

Message 12 of 27

Sofia.Xanthopoulou
Mentor
Mentor

 

Oh my god Smiley Surprised

 

the bracket was missing! I tried initdia so often - without a bracket! Best hint ever....

 

 ^C^C_erase;all;r \\;z;e;-purge;a;;n;(initdia);_saveas;\updatefield;all;;_save;

 

Henrique is our heroe Smiley Very Happy

 

Thanks

 

0 Likes
Message 13 of 27

hmsilva
Mentor
Mentor

@Sofia.Xanthopoulou wrote:

 

Oh my god Smiley Surprised

 

the bracket was missing! I tried initdia so often - without a bracket! Best hint ever....

 

 ^C^C_erase;all;r \\;z;e;-purge;a;;n;(initdia);_saveas;\updatefield;all;;_save;

 

Henrique is our heroe Smiley Very Happy

 

Thanks

 


Hello Sofia, Smiley Happy

 

let's wait and see if OP is not on LT...

 

Cheers

Henrique

 

EESignature

0 Likes
Message 14 of 27

Anonymous
Not applicable
Hello Henrique,

I am on LT
0 Likes
Message 15 of 27

hmsilva
Mentor
Mentor

@Anonymous wrote:
Hello Henrique,

I am on LT

Hello Timon,

I'm not an LT guy, will the (initdia) fails on LT?

 

EDIT: if fails, try

 

...-purge;a;;n;_saveas;;~;...

 

again, untested...

 

Hope this helps,
Henrique

EESignature

0 Likes
Message 16 of 27

Anonymous
Not applicable
Hi Henrique,

doesn't work either,
stops after erase objects.
0 Likes
Message 17 of 27

Sofia.Xanthopoulou
Mentor
Mentor

Hi Timon,

 

have you copy/pasted the line from my post? I tried it, it worked.

 

Regards

 

0 Likes
Message 18 of 27

hmsilva
Mentor
Mentor

@Anonymous wrote:
Hi Henrique,

doesn't work either,
stops after erase objects.

Timon,

I don't have AutoCAD in this laptop, so I can't test it...

 

Giancarlo have suggested:

^C^C_erase;all;r \\;z;e;-purge;a;;n;_saveas;\;updatefield;all;;_qsave;

 

and you answered:

 

'Hello Giancarlo

I made the changes as you suggested, but I am still not getting window that I normaly get when I choose SaveAs.

please see attached screen shot pic 1 is what I get with the updafield and qsave added

without it I get pic 2

I would like to get pic 2 with the updatefield and qsave added.'

 

Was the macro run until the end or not?

 

Henrique

EESignature

0 Likes
Message 19 of 27

Anonymous
Not applicable

I never saved it by manually entering the directory, when it asked me.

0 Likes
Message 20 of 27

hmsilva
Mentor
Mentor

@Anonymous wrote:

I never saved it by manually entering the directory, when it asked me.


Then the macro runs until the saveas command, correct?

 

If runs, try to change just an enter after the saveas and a tild and an enter after the tilde, in the working macro...

 

^C^C_erase;all;r \\;z;e;-purge;a;;n;_saveas;;~;\;updatefield;all;;_qsave;

 

Hope this helps,
Henrique

EESignature

0 Likes