Jump to content

AutoCAD built-in command list with AutoLISP


lido

Recommended Posts

Sorry mr. ronjonp for wasting your time.

Aggression cannot, under any circumstances, solve none problem!

 

You did not waste my time... :unsure:

Link to comment
Share on other sites

  • Replies 28
  • Created
  • Last Reply

Top Posters In This Topic

  • lido

    9

  • rlx

    6

  • ronjonp

    5

  • hanhphuc

    4

Top Posters In This Topic

Just test only..

[color="green"];At this level we can list out [/color] 
([color="blue"]vl-registry-descendents[/color]  (strcat "HKEY_LOCAL_MACHINE\\"
	 (vlax-product-key)
	 "\\Applications\\")
 )


[color="green"];but why this level doesn't work ???[/color]
([color="blue"]vl-registry-descendents[/color]
 (strcat "HKEY_LOCAL_MACHINE\\"
  (vlax-product-key)
  "\\Applications\\"
  "AcEAttEdit"
  [color="red"]"\\Commands"[/color]
  ) 
 ) 

 

another approach

(defun foo (app cmd)
 (and (setq app (findfile app))
      (vl-registry-read
 (strcat "HKEY_LOCAL_MACHINE\\"
	 (vlax-product-key)
	 "\\Applications\\"
	 (vl-filename-base app)
	 "\\Commands")
	 (strcase cmd )
	 ) 
 
      ) 
 )

 

_$ (foo "AcEAttEdit.arx" "EATTEDIT")
[b][color="blue"]T[/color][/b]

Thank you hanhphuc for your replay.

Your first snippet returns a list containing the loaded applications. Not at all built-in commands. So, your second snippet return nil for any (?) built-in command.

Link to comment
Share on other sites

Thank you hanhphuc for your replay.

Your first snippet returns a list containing the loaded applications. Not at all built-in commands. So, your second snippet return nil for any (?) built-in command.

yes that's the problem, if we could get the commands descendent list then we could collect all the command, but it failed.

 

That's why I tried another predicate sub (foo app ac cmd) ;edited post#20

but this method is not user friendly unless you know the app & name or (app list by vlookup or assoc)

app="AcTable.arx" name="AcadTable"

 

example:

(foo "AcTable.arx" "AcadTable" "TINSERT")

 

IMO Roy043 has offered the best solution :thumbsup:

Edited by hanhphuc
the best deserves the smiley
Link to comment
Share on other sites

To my knowledge there is no way to obtain a list of command names via Lisp code.

 

For _eattedit and other commands that require user input something like this should work (on most CAD platforms I believe):

(defun CommandAvailable_P (cmd / ret)
 
)

 

Smart one Roy! :geek:

Link to comment
Share on other sites

i think i missed something , i fixed here

 

(defun appcom ( / key l lst )
;hanhphuc 13.04.2018
 (setq key (strcat "HKEY_LOCAL_MACHINE\\" (vlax-product-key) "\\Applications\\"))
 (cdr (acad_strlsort
 (apply 'append
	(mapcar ''((app)
		   (vl-registry-descendents
		    (strcat key app "\\Commands")
		    [color="red"]app[/color]
		    )
		   )
		(vl-registry-descendents
		  key
		  )
		)
	)
 )
      )
 )

 

384 arx commands @ ac2007

("-3DCONFIG"
 "-AecDwgUnits"     "-AecExportToAutoCAD"		   "-ARCHIVE"	      "-BEDIT"		 "-BVHIDE"
 "-BVSHOW"	     "-BVSTATE"		"-COPYTOLAYER"	   "-DIMSTYLE"	      "-DWFADJUST"	 "-DWFATTACH"
 "-EATTEXT"	     "-ETRANSMIT"	"-FIELD"	   "-HYPERLINK"	      "-IMAGE"		 "-IMAGEADJUST"
 "-INTERFERE"	     "-LAYDEL"		"-LAYMCH"	   "-LAYMRG"	      "-MTEXT"		 "-OPENSHEETSET"
 "-PLOTSTAMP"	     "-PUBLISH"		"-REFEDIT"	   "-SHADEMODE"	      "-TABLE"		 "-UNITS"
 "-UPDATEFIELD"     "-VBALOAD"		"-VBARUN"	   "+DSETTINGS"	      "+PUBLISH"	 "3DALIGN"
 "3DCLIP"	     "3DCONFIG"		"3DCORBIT"	   "3DDISTANCE"	      "3DDWF"		 "3DDWFPUBLISH"
 "3DFLY"	     "3DFORBIT"		"3DORBIT"	   "3DORBITCTR"	      "3DORBITTRANSPARENT"
 "3DPAN"	     "3DPANTRANSPARENT"	"3DSIN"		   "3DSWIVEL"	      "3DSWIVELTRANSPARENT"
 "3DWALK"	     "3DZOOM"		"3DZOOMTRANSPARENT"		      "ACAD_INTERNAL_CELLSELECT"
 "ACAD_INTERNAL_REPEATCELLEDIT"	"ACADBLOCKDIALOG"  "ACADWBLOCKDIALOG" "adc"		 "adcclose"
 "adccustomnavigate"			"adcenter"	   "adcnavigate"      "AecDisplayManagerConfigsSelection"
 "AecFileOpenMessage"			"AecFileSaveMessage"		      "AecObjectCopyMessage"
 "AecObjRelDump"    "AecObjRelShow"	"AecObjRelUpdate"  "AecPostDxfinFix"  "AecSetXrefConfig" "AecVersion"
 "AIDIMFLIPARROW"   "AIDIMPREC"	"AIDIMSTYLE"	   "AIDIMTEXTMOVE"    "ALIGN"		 "ANIPATH"
 "APPLOAD"	     "ARCHIVE"		"ARCTEXT"	   "ARRAY"	      "ASSIST"		 "ASSISTCLOSE"
 "ATEXT"	     "ATTACHURL"	"ATTEDIT"	   "ATTSYNC"	      "BACTION"		 "BACTIONSET"
 "BACTIONTOOL"	     "BASSOCIATE"	"BATTMAN"	   "BATTORDER"	      "BAUTHORPALETTE"	 "BAUTHORPALETTECLOSE"
 "BCLOSE"	     "BCYCLEORDER"	"BEDIT"		   "BGPLOTRECEIVE"    "BGRIPSET"	 "BLOCKICON"
 "BlookupTable"     "BMAKE"		"BMOD"		   "BPARAMETER"	      "BROWSER"		 "BROWSER2"
 "BSAVE"	     "BSAVEAS"		"BVHIDE"	   "BVSHOW"	      "BVSTATE"		 "cal"
 "CAMERA"	     "CHECKSTANDARDS"	"CHSPACE"	   "CLASSICIMAGE"     "content"		 "CONVERTCTB"
 "CONVERTOLDLIGHTS" "CONVERTOLDMATERIALS"		   "CONVERTPSTYLES"   "COPYTOLAYER"	 "cui"
 "cuiexport"	     "cuiimport"	"DASHBOARD"	   "DASHBOARDCLOSE"   "DBCCONFIGURE"	 "DBCCONNECT"
 "DBCDEFINELLT"     "DBCDEFINELT"	"DBCDELETELABELS"  "DBCDELETELINKS"   "DBCDELETELLT"	 "DBCDELETELT"
 "DBCDELETEQRY"     "DBCDISCONNECT"	"DBCEDITLINKEDTABLE"		      "DBCEDITLLT"	 "DBCEDITLT"
 "DBCEDITQRY"	     "DBCEDITTABLE"	"DBCEXECUTEQRY"	   "DBCEXPORTLINKS"   "DBCEXPORTQS"	 "DBCEXPORTTS"
 "DBCHIDELABELS"    "DBCIMPORTQRY"	"DBCIMPORTQS"	   "DBCIMPORTTS"      "DBCLINKCONVERSION"
 "DBCLINKMANAGER"   "DBCNEWQRYLT"	"DBCNEWQRYTABLE"   "DBCONNECT"	      "DBCPROPSLBLT"	 "DBCPROPSLT"
 "DBCRELOADLABELS"  "DBCSELECTLINKS"	"DBCSHOWLABELS"	   "DBCSYNC"	      "DBCVIEWLINKEDTABLE"
 "DBCVIEWTABLE"     "DDATTE"		"DDIM"		   "DDINSERT"	      "DDPLOTSTAMP"	 "DDPTYPE"
 "DDUNITS"	     "DDVPOINT"		"DETACHURL"	   "DIM"	      "DIM1"		 "DIMALIGNED"
 "DIMANGULAR"	     "DIMARC"		"DIMBASELINE"	   "DIMCENTER"	      "DIMCONTINUE"	 "DIMDIAMETER"
 "DIMDISASSOCIATE"  "DIMEDIT"		"DIMEX"		   "DIMHORIZONTAL"    "DIMIM"		 "DIMJOGGED"
 "DIMLINEAR"	     "DIMORDINATE"	"DIMOVERRIDE"	   "DIMRADIUS"	      "DIMREASSOCIATE"	 "DIMREGEN"
 "DIMROTATED"	     "DIMSTYLE"		"DIMTEDIT"	   "DIMVERTICAL"      "DISTANTLIGHT"	 "DRAWINGRECOVERY"
 "DRAWINGRECOVERYHIDE"			"DRAWORDER"	   "DSETTINGS"	      "DWFADJUST"	 "DWFATTACH"
 "DWFCLIP"	     "DWGPROPS"		"EATTEDIT"	   "EATTEXT"	      "EATTEXTEDIT"	 "EATTEXTUPDATE"
 "EPLOTEXT"	     "ETRANSMIT"	"ExacReload"	   "ExternalReferences"
 "ExternalReferencesClose"		"FIELD"		   "FILTER"	      "FIND"		 "FLATSHOT"
 "GEOGRAPHICLOCATION"			"HELIX"		   "HIDE"	      "HYPERLINK"	 "HYPERLINKBACK"
 "HYPERLINKFWD"     "HYPERLINKOPEN"	"HYPERLINKOPTIONS" "HYPERLINKSTOP"    "IMAGE"		 "IMAGEADJUST"
 "IMAGEATTACH"	     "IMAGECLIP"	"IMAGEFRAME"	   "IMAGEQUALITY"     "INTERFERE"	 "INTERNALTABLEDIT"
 "JOGSECTION"	     "JUSTIFYTEXT"	"LAYCUR"	   "LAYDEL"	      "LAYER"		 "LAYERP"
 "LAYERPMODE"	     "LAYFRZ"		"LAYISO"	   "LAYLCK"	      "LAYMCH"		 "LAYMRG"
 "LAYOFF"	     "LAYON"		"LAYTHW"	   "LAYTRANS"	      "LAYULK"		 "LAYUNISO"
 "LAYVPI"	     "LAYWALK"		"LEADER"	   "LIGHT"	      "LIGHTLIST"	 "LIGHTLISTCLOSE"
 "LIVESECTION"	     "MARKUP"		"MARKUPCLOSE"	   "MATCHCELL"	      "MATCHPROP"	 "MATERIALASSIGN"
 "MATERIALATTACH"   "MATERIALMAP"	"MATERIALS"	   "MATERIALSCLOSE"   "MIRROR3D"	 "MLEDIT"
 "MLSTYLE"	     "MOCORO"		"MOVEBAK"	   "MTEDIT"	      "MTEXT"		 "MTPROP"
 "NETLOAD"	     "NEWSHEETSET"	"NEWVIEW"	   "OLECONVERT"	      "OLEOPEN"		 "OLERESET"
 "OLESCALE"	     "OPENDWFMARKUP"	"OPENSHEETSET"	   "PAINTER"	      "PAINTPROP"	 "PASTEASHYPERLINK"
 "PLOTSTAMP"	     "POINTLIGHT"	"PPGETACADINPUT"   "PROPERTIES"	      "PROPERTIESCLOSE"	 "PROPULATE"
 "PUBLISH"	     "PUBLISHTOWEB"	"PURGE"		   "qcclose"	      "QDIM"		 "QLATTACH"
 "QLATTACHSET"	     "QLDETACHSET"	"QLEADER"	   "QSELECT"	      "quickcalc"	 "RECTANG"
 "RECTANGLE"	     "REFCLOSE"		"REFEDIT"	   "REFSAVE"	      "REFSET"		 "RENDER"
 "RENDERCROP"	     "RENDERENVIRONMENT"		   "RENDERPRESETS"    "RENDERWIN"	 "RESETBLOCK"
 "REVCLOUD"	     "ROTATE3D"		"RPREF"		   "RPREFCLOSE"	      "RTEXT"		 "SAVEIMG"
 "ScaleListEdit"    "SCALETEXT"	"SECTIONPLANE"	   "SECURITYOPTIONS"  "SELECTURL"	 "Setidrophandler"
 "SHADE"	     "SHADEMODE"	"SHEETSET"	   "SHEETSETHIDE"     "SIGVALIDATE"	 "SOLDRAW"
 "SOLPROF"	     "SOLVIEW"		"SPACETRANS"	   "SPOTLIGHT"	      "STANDARDS"	 "SUNPROPERTIES"
 "SUNPROPERTIESCLOSE"			"SYSVDLG"	   "TABLE"	      "TABLEDIT"	 "TABLEEXPORT"
 "TABLESTYLE"	     "TaskBar"		"TEXTTOFRONT"	   "TINSERT"	      "TOLERANCE"	 "TOOLPALETTES"
 "TOOLPALETTESCLOSE"			"TRANSPARENCY"	   "TXT2MTXT"	      "UNITS"		 "UPDATEFIELD"
 "UPDATETHUMBSNOW"  "VBAIDE"		"VBALOAD"	   "VBAMAN"	      "VBANEW"		 "VBAPREF"
 "VBARUN"	     "VBASTMT"		"VBAUNLOAD"	   "VIEW"	      "VIEWPLOTDETAILS"	 "VISUALSTYLES"
 "VISUALSTYLESCLOSE"			"VPMAX"		   "VPMIN"	      "VTOPTIONS"	 "WALKFLYSETTINGS"
 "WHOHAS"	     "WIPEOUT"		"XOPEN"		   "XP"		      "XPLODE"
 )

 

you can use vl-position , member etc..

(defun bar (cmd) (vl-some ''((x) (wcmatch ([color="blue"]strcase[/color] x) (strcat (strcase cmd)"*"))) (appcom)))

_$ (bar  "eattedit")
T

Edited by hanhphuc
strcase
Link to comment
Share on other sites

Noticed that vlax-product-key can contain an addition code so by removing it you get the result you want.

 

 

; hanhphuc 13.04.2018
(defun appcom ( / key pk i l lst )
 (if (setq i (vl-string-position (ascii ":") (setq pk (vlax-product-key)))) (setq pk (substr pk 1 i)))
 (setq key (strcat "HKEY_LOCAL_MACHINE\\" pk "\\Applications\\"))
 (cdr (acad_strlsort (apply 'append (mapcar ''((app) (vl-registry-descendents (strcat key app "\\Commands") app))(vl-registry-descendents key))))))

this probably also would do the trick :

(vl-registry-descendents (strcat "HKEY_LOCAL_MACHINE\\" (if (setq i (vl-string-position (ascii ":") (setq pk (vlax-product-key)))) (substr pk 1 i) pk) "\\Applications\\"))

Edited by rlx
Link to comment
Share on other sites

@grrr thanks but it was VL trick respond "OP's topic - list the commands" not worth flettery :oops: but what MP's listing code was really impressed!!

 

After all Roy's solution is more relevant as it met "KISS" principle :thumbsup:

 

@rlx IMO registry path product-key maybe varies due to different version ,thanks anyway :)

(defun appcom ( / key [b][color="red"]l lst[/color][/b] )  [color="green"];<-- the [color="red"]l lst[/color] variables unused can be removed.[/color]
The reason was initially using [color="blue"]foreach[/color] later changed to [color="blue"]mapcar[/color]...  

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...