Login

View Full Version : Run a Script file from a CUI Ribbon button command



MarcusLintault
2012-10-11, 11:31 PM
Hello Everyone!
In AutoCAD 2012 I am having trouble in launching a script file from a ribbon button command within the CUI editor. This is what I thought would work:
^C^C._script;"\\server\CAD Resources\AutoCAD-2012\Scripts\MyScript.scr";

But when ever it hits the " it stops waiting for the user to input the script file.

This works:
^C^C._script;MyScript.scr;
...as long as the path to the file is included within the Support File Search Path within AutoCAD's options.

But I would like to include an UNC path that does contains spaces and so I thought adding the "" would work.

I've also tried this:
(command "._script" "\\\\server\\CAD Resources\\AutoCAD-2012\\Scripts\\MyScript.scr")
...which works on the command line, but not when it is placed on a button


Any help from would be greatly appreciated!!

Regards,
Marcus

Tom Beauford
2012-10-12, 10:59 AM
In a macro \ means pause for user input. The easiest way is to simply put the file MyScript.scr in a support directory, then you don't need the path for AutoCAD to find it.

BlackBox
2012-10-12, 01:14 PM
Building on Tom's comments....

LISP accepts both double back-slashes "\\", and single forward-slashes "/" for file path strings, whereas macros require the latter (single forward-slashes "/").

Also, not sure what you've got executing via your script, once I learned how to code LISP, I've always found it beneficial to have my macro call a LISP instead of a straight Diesel expression for the *error* handling, and ability to more easily perform code maintenance, and enhancement, without needing to update the macro itself.

HTH