SendStringToExecute not executing

SendStringToExecute not executing

Prostang
Advocate Advocate
1,763 Views
4 Replies
Message 1 of 5

SendStringToExecute not executing

Prostang
Advocate
Advocate

I have a class that I am writing that will change the ToolPalettePath.  I am using the SendStringToExecute and am finding it difficult to send an <ENTER> at the end of the command.

    <Autodesk.AutoCAD.Runtime.CommandMethodAttribute("rcus")>
    Public Sub rcus()
        Dim acDoc As Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument

        acDoc.SendStringToExecute("._*_ToolPalettePath S:\Autodesk\Support\Palettes\NMDOTcustomSubs", True, False, True)
    End Sub

I have tried the \n at the end of the line, and also tried a blank space, and even TWO blank spaces, but none of those worked.  I believe it is b/c it is a path that has quotes.

 

Right now, the command is invoked, and the path is entered and AutoCAD waits.  I have to hit <ENTER> or <SPACEBAR> manually to execute it.  I need another method to send the final <ENTER>.

 

TIA,

Mike

Mike Madrid
Owner, MJM Consulting
0 Likes
Accepted solutions (1)
1,764 Views
4 Replies
Replies (4)
Message 2 of 5

FRFR1426
Collaborator
Collaborator
Accepted solution

It's because *_ToolPalettePath is a command which allow spaces in the input (it waits for a path). Have you tried Environment.NewLine? Or a second call to SendStringToExecute with only a space or a newline character (\n).

 

On AutoCAD 2015 and more, you can also use Editor.Command() instead of SendStringToExecute.

Maxence DELANNOY
Manager
Add-ins development for Autodesk software products
http://wiip.fr
Message 3 of 5

Alexander.Rivilis
Mentor
Mentor

This code has not such problem as yours:

 

Application.SetSystemVariable("*_ToolPalettePath", "S:\Autodesk\Support\Palettes\NMDOTcustomSubs")

 

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"


Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
Expert Elite Member

0 Likes
Message 4 of 5

Prostang
Advocate
Advocate

FRFR,

I did attempt the second line of \n and a white space, but it would just be appended to the waiting line.

 

I rewrote it to include the Editor.Command and it worked beautifully!  Thanks for pointing me in the right direction!

 

Mike

Mike Madrid
Owner, MJM Consulting
0 Likes
Message 5 of 5

Alexander.Rivilis
Mentor
Mentor

@Prostang

And what about using Application.SetSystemVariable ?  As far as *_ToolPalettePath is a system variable - so it is easy to set it value with Application.SetSystemVariable whithout any command method.

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"


Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
Expert Elite Member

0 Likes