.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

SendStringToExecute from vb.net

3 REPLIES 3
Reply
Message 1 of 4
Anonymous
1486 Views, 3 Replies

SendStringToExecute from vb.net

I'm haveing trouble sending a command to acad from my vb.net app. I'm
trying to execute a script but the code hangs when passing in the filename
of the script to load.

This is my code:

'set filedia to 0
ApplicationServices.Application.DocumentManager.MdiActiveDocument.SendStringToExecute("filedia
", True, False, True)
ApplicationServices.Application.DocumentManager.MdiActiveDocument.SendStringToExecute("0
", True, False, True)

'load the script
ApplicationServices.Application.DocumentManager.MdiActiveDocument.SendStringToExecute("script
", True, False, True)
ApplicationServices.Application.DocumentManager.MdiActiveDocument.SendStringToExecute(""""
& Me.txtScript.Text & """" & "\n", True, False, True)
'ApplicationServices.Application.DocumentManager.MdiActiveDocument.SendStringToExecute("
\n", True, False, True)

'set filedia to 1
ApplicationServices.Application.DocumentManager.MdiActiveDocument.SendStringToExecute("filedia",True, False,True)ApplicationServices.Application.DocumentManager.MdiActiveDocument.SendStringToExecute("1 ", True, False, True)Please help...
3 REPLIES 3
Message 2 of 4
dmarcotte4
in reply to: Anonymous

Try using the SetSystemVariable method for changing system variables like filedia.
here's an example in c#

Autodesk.AutoCAD.ApplicationServices.Application.SetSystemVariable(name , value);
Message 3 of 4
Anonymous
in reply to: Anonymous

Excellent, thanks.

I fixed the script issue by sending a vbCr in the string.
Message 4 of 4
Anonymous
in reply to: Anonymous

Can you help me too as to what you did to run the script? Coz I can't run the script from VB.net
Thanks

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost