Error: ; error: malformed string on input

Error: ; error: malformed string on input

Anonymous
Not applicable
1,665 Views
8 Replies
Message 1 of 9

Error: ; error: malformed string on input

Anonymous
Not applicable

C3D 2018.2 Win7

 

I am getting error in subject line when trying to load acad.lsp which consists of (only) the following two lines:

 

(Command"SECURELOAD" "0")
(load "M:\\DESIGN\\C3D\\MWU C3D Files\\AutoLisp\\MWU.lsp")

 

acad.lsp does nothing but load MWU.lsp which is supposed to set our company standard support, plot, template, etc. paths (bootstrap). I get the same error when loading MWU.lsp

 

what am I doing wrong? I thought it ran before, so I assume my networked paths are formatted correctly.

0 Likes
1,666 Views
8 Replies
Replies (8)
Message 2 of 9

ВeekeeCZ
Consultant
Consultant

Add a space behind the command. And zero can be a number (not character)

 

(Command "SECURELOAD" 0)

0 Likes
Message 3 of 9

Anonymous
Not applicable

thanks for the reply. from:

 

(Command "SECURELOAD" 0)
(load "M:\\DESIGN\\C3D\\MWU C3D Files\\AutoLisp\\MWU.lsp")

 

I get:

 

Command: (LOAD "M:/DESIGN/C3D/MWU C3D Files/Autolisp/Acad.lsp") SECURELOAD
Enter new value for SECURELOAD <0>: 0
Command: ; error: malformed string on input

 

 

0 Likes
Message 4 of 9

ВeekeeCZ
Consultant
Consultant

mwu.lsp is failing. We gotta see it.

0 Likes
Message 5 of 9

Anonymous
Not applicable

MWU.lsp code follows. This is a bootstrap lisp that is supposed to set support paths and that's it - so that I can have my users be standardized but allowing them to customized the user interface to their own preferences. Everyone runs acad.lsp-->MWU.lsp

 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Edit lines below for company wide settings ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(setq companyActions "M:\\DESIGN\\C3D\\MWU C3D Files\\Additional Actions Reading File Locations")
;;(setq companyEnterpriseCUI "M:\\DESIGN\\C3D\\MWU C3D Files\\Customization\\MWU.cuix")
;;(setq companyCustomDictionary "M:\\DESIGN\\C3D\\MWU C3D Files\\_Dictionaries")
(setq companyPC3 "M:\\DESIGN\\C3D\\MWU C3D Files\\Plotters")
(setq companyPMP "M:\\DESIGN\\C3D\\MWU C3D Files\\PLotters\\PMP")
(setq companyPlotStyles "M:\\DESIGN\\C3D\\MWU C3D Files\\Plot Styles")
(setq companySupportFileSearchPath "M:\\DESIGN\\C3D\\MWU C3D Files;M:\\DESIGN\\C3D\\MWU C3D Files\\Support;M:\\DESIGN\\C3D\\MWU C3D Files\\AutoLisp;M:\\DESIGN\\C3D\\MWU C3D Files\\Linetypes_Fonts;C:\\Program Files\\Autodesk\\AutoCAD 2018\\Map\\Support")
(setq companyTemplatePath "M:\\DESIGN\\C3D\\MWU C3D Files\\Template")
(setq companySSMTemplatePath "M:\\DESIGN\\C3D\\MWU C3D Files\\Template\\Sheet Set Template")
(setq companyQNewTemplate "M:\\DESIGN\\C3D\\MWU C3D Files\\Template\\MWU2018.dwt")
;;(setq companySetupsAndOverrides "M:\\DESIGN\\C3D\\MWU C3D Files\\_Template Settings\\Sheet Creation and Page Setup Overrides")
(setq companyToolPalettes "%RoamableRootFolder%\\support\\toolpalette;M:\\DESIGN\\C3D\\MWU C3D Files\\Tool Palettes") ;This keeps the default location but adds company shared tool palettes
(setq companyTrustedPaths "M:\\DESIGN\\C3D\\MWU C3D Files\\Autolisp;C:\\Users\\%USERNAME%\\AppData\\Roaming\\Autodesk\\C3D 2018\\enu\\Support")

;; Optional
; (setq companyAlternateFont "Arial")
; (setq companySetupBat "\\\\Bootstrap Deployment\\Bootstrap (Initial Setup)\\2017Bootsrap.bat")

;;Set System Variables
(setvar "Menubar" 1)
(setvar "TEXTALLCAPS" 1)
;;(setvar "EXPERT" 5)
(setvar "fieldval"" 31)



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Do not edit the following code ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; Trusted Paths
(setq tpACAD (getvar 'trustedpaths))
(setvar 'trustedpaths (strcat companyTrustedPaths tpACAD))

;; set Additional Actions Reading File Locations
(command "actpath" companyActions)

;; Set company Enterprise CUI
(setenv "EnterpriseMenuFile" companyEnterpriseCUI)

;; set up custom dictionary
;;(setenv "CustomDictionary" companyCustomDictionary)

;; Printer support file paths
(setenv "PrinterConfigDir" companyPC3)
(setenv "PrinterDescDir" companyPMP)
(setenv "PrinterStyleSheetDir" companyPlotStyles)

;; Setup Support File Search Path
(setq epACAD (getenv "ACAD"))
(setenv "ACAD" (strcat companySupportFileSearchPath epACAD))

;;set up the template settings paths
(setenv "TemplatePath" companyTemplatePath)
(setenv "SheetSetTemplatePath" companySSMTemplatePath)
(setenv "QnewTemplate" companyQNewTemplate)

;;overrides and page setups
;;(setenv "AlternativePageSetUpsTemplate" companySetupsAndOverrides)

;; Set tool palette path
(command "*_toolpalettepath" companyToolPalettes)


;;  Optional
;; (command "fontalt" companyAlternateFont)
;; (startapp companySetupBat)

0 Likes
Message 6 of 9

ВeekeeCZ
Consultant
Consultant

Try fix this line

(setvar "fieldval"" 31)

 

like this

(setvar "fieldval" 31)

0 Likes
Message 7 of 9

Anonymous
Not applicable

doh! I ended up remarking that line out - it was meant to update some field sin the title block, but we have gone a different direction.

 

then I was getting "nil" errors on the tool palette path. we don't have a custom tool palette, so I remarked that out, too. I had to do this up above and down below in the Do Not Edit section.

 

I ended up with the following which will run if I load it. thanks for the help!

 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Edit lines below for company wide settings ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;(setq companyActions "M:\\DESIGN\\C3D\\MWU C3D Files\\Additional Actions Reading File Locations")
(setq companyEnterpriseCUI "M:\\DESIGN\\C3D\\MWU C3D Files\\Customization\\MWU.cuix")
(setq companyCustomDictionary "M:\\DESIGN\\C3D\\MWU C3D Files\\_Dictionaries")
(setq companyPC3 "M:\\DESIGN\\C3D\\MWU C3D Files\\Plotters")
(setq companyPMP "M:\\DESIGN\\C3D\\MWU C3D Files\\PLotters\\PMP")
(setq companyPlotStyles "M:\\DESIGN\\C3D\\MWU C3D Files\\Plot Styles")
(setq companySupportFileSearchPath "M:\\DESIGN\\C3D\\MWU C3D Files;M:\\DESIGN\\C3D\\MWU C3D Files\\Support;M:\\DESIGN\

\C3D\\MWU C3D Files\\AutoLisp;M:\\DESIGN\\C3D\\MWU C3D Files\\Linetypes_Fonts;C:\\Program Files\\Autodesk\\AutoCAD 2018\

\Map\\Support")
(setq companyTemplatePath "M:\\DESIGN\\C3D\\MWU C3D Files\\Template")
(setq companySSMTemplatePath "M:\\DESIGN\\C3D\\MWU C3D Files\\Template\\Sheet Set Template")
(setq companyQNewTemplate "M:\\DESIGN\\C3D\\MWU C3D Files\\Template\\MWU2018.dwt")
;;(setq companySetupsAndOverrides "M:\\DESIGN\\C3D\\MWU C3D Files\\_Template Settings\\Sheet Creation and Page Setup

Overrides")
;;(setq companyToolPalettes "%RoamableRootFolder%\\support\\toolpalette;M:\\DESIGN\\C3D\\MWU C3D Files\\Tool Palettes")

;This keeps the default location but adds company shared tool palettes
(setq companyTrustedPaths "M:\\DESIGN\\C3D\\MWU C3D Files\\Autolisp;C:\\Users\\%USERNAME%\\AppData\\Roaming\\Autodesk\

\C3D 2018\\enu\\Support")

;; Optional
; (setq companyAlternateFont "Arial")
; (setq companySetupBat "\\\\Bootstrap Deployment\\Bootstrap (Initial Setup)\\2017Bootsrap.bat")

;;Set System Variables
(setvar "Menubar" 1)
(setvar "TEXTALLCAPS" 1)
;;(setvar "EXPERT" 5)
;;(setvar "fieldval" 31)



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Do not edit the following code ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; Trusted Paths
(setq tpACAD (getvar 'trustedpaths))
(setvar 'trustedpaths (strcat companyTrustedPaths tpACAD))

;; set Additional Actions Reading File Locations
;;(command "actpath" companyActions)

;; Set company Enterprise CUI
(setenv "EnterpriseMenuFile" companyEnterpriseCUI)

;; set up custom dictionary
;;(setenv "CustomDictionary" companyCustomDictionary)

;; Printer support file paths
(setenv "PrinterConfigDir" companyPC3)
(setenv "PrinterDescDir" companyPMP)
(setenv "PrinterStyleSheetDir" companyPlotStyles)

;; Setup Support File Search Path
(setq epACAD (getenv "ACAD"))
(setenv "ACAD" (strcat companySupportFileSearchPath epACAD))

;;set up the template settings paths
(setenv "TemplatePath" companyTemplatePath)
(setenv "SheetSetTemplatePath" companySSMTemplatePath)
(setenv "QnewTemplate" companyQNewTemplate)

;;overrides and page setups
;;(setenv "AlternativePageSetUpsTemplate" companySetupsAndOverrides)

;; Set tool palette path
;;(command "*_toolpalettepath" companyToolPalettes)


;;  Optional
;; (command "fontalt" companyAlternateFont)
;; (startapp companySetupBat)

0 Likes
Message 8 of 9

doaiena
Collaborator
Collaborator

You should use "setvar" rather than "command" to set variables.

(setvar "secureload" 0)

 


You might also want to leave "secureload" on because its a layer of protection. I think a better approach would be to add your *.lsp path to the trusted paths instead. Also it is a good habit to check if a file is present before trying to use it. The same goes for variables. Don't just blindly add another instance of the trusted path. Check if it is already added before that.

;Check if ACAD version is 2014 or newer
(if (>= (getvar "ACADVER") "19.1")

;Check if the path "M:\\DESIGN\\C3D\\MWU C3D Files\\AutoLisp\\" is part of the trusted paths
;If it is not, then add it to the trusted paths
(if (not (wcmatch (getvar "trustedpaths") "*M:\\DESIGN\\C3D\\MWU C3D Files\\AutoLisp\\*"))
(setvar "trustedpaths" (strcat (getvar "trustedpaths") ";M:\\DESIGN\\C3D\\MWU C3D Files\\AutoLisp\\;"))
);if path
);if acadver

;Check if the file "MWU.lsp" exists
;If it does, then load it
(if (findfile "M:\\DESIGN\\C3D\\MWU C3D Files\\AutoLisp\\MWU.lsp")
(load "M:\\DESIGN\\C3D\\MWU C3D Files\\AutoLisp\\MWU.lsp")
);if findfile

 

 

 

Make sure you dont leave global variables too. Either define a function, localize the variables there and execute it, or set them to "nil".

 

;Set a list with all the variables
(setq *varlist* '(companyEnterpriseCUI companyCustomDictionary companyPC3 companyPMP))
;Clear all the variables
(foreach x *varlist* (set x nil))
;Clear the list
(setq *varlist* nil)
Message 9 of 9

Anonymous
Not applicable

thanks @doaiena I can tell you know the code and how to use it. I will look at your suggestions. I started with a lsp written by someone else as a generic bootstrap startup routine. I can now make it more specific to our organization. thank you!

0 Likes