TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: jxphklibin on April 02, 2009, 03:02:02 AM
-
How to change the dialog title?
The codes as follows:
(defun gps->getfiled (/ str )
(setq str
"Function GetTargetFileName
Set objDialog = CreateObject(\"UserAccounts.CommonDialog\")
objDialog.Filter = \"DwgFile(*.dwg)|*.dwg\"
objDialog.InitialDir = \".\"
If objDialog.ShowOpen <> 0 Then
GetTargetFileName = objDialog.FileName
End If
Set objDialog = Nothing
End Function
ret = GetTargetFileName
"
)
(if (not #wscript#)(setq #wscript# (vlax-create-object "ScriptControl")))
(vlax-put #wscript# 'language "vbs")
(vlax-invoke-method #wscript# 'ExecuteStatement str)
(vlax-invoke-method #wscript# 'eval "ret")
)
(defun Getfile (/ str )
(setq str
"Function GetTargetFileName
Set objDialog = CreateObject(\"UserAccounts.CommonDialog\")
objDialog.Filter = \"DwgFile(*.dwg)|*.dwg|Word|.doc|Excel|.xls|All Files|*.*\"
objDialog.Flags = 1574404
objDialog.FilterIndex = 2
objDialog.InitialDir = \"C:\"
If objDialog.ShowOpen <> 0 Then
GetTargetFileName = objDialog.FileName
End If
Set objDialog = Nothing
End Function
ret = GetTargetFileName
"
)
(if (not #wscript#)(setq #wscript# (vlax-create-object "ScriptControl")))
(vlax-put #wscript# 'language "vbs")
(vlax-invoke-method #wscript# 'ExecuteStatement str)
(vlax-invoke-method #wscript# 'eval "ret")
)
-
objDialog.DialogTitle="Try it"
-
objDialog.DialogTitle="Try it"
; Error: Automation error. Object does not support this property or method: 'objDialog.DialogTitle'
-
_$ (vlax-dump-object (vlax-create-object "ScriptControl") t)
; IScriptControl: Control to host scripting engines that understand the ActiveX Scripting interface
;特性值:
; AllowUI = ...不显示带索引的内容...
; CodeObject (RO) = ...不显示带索引的内容...
; Error (RO) = ...不显示带索引的内容...
; Language = ...不显示带索引的内容...
; Modules (RO) = ...不显示带索引的内容...
; Procedures (RO) = ...不显示带索引的内容...
; SitehWnd = ...不显示带索引的内容...
; State = ...不显示带索引的内容...
; Timeout = ...不显示带索引的内容...
; UseSafeSubset = ...不显示带索引的内容...
;支持的方法:
; AddCode (1)
; AddObject (3)
; Eval (2)
; ExecuteStatement (1)
; Reset ()
; Run (3)
T
_$
-
objDialog.DialogTitle="Try it"
; Error: Automation error. Object does not support this property or method: 'objDialog.DialogTitle'
How about just objDialog.Title = "blah blah blah" ??
-
(if (setq X (VLAX-CREATE-OBJECT "MSComDlg.CommonDialog"))
(progn
(VLAX-PUT-PROPERTY X "DialogTitle" DialogTitle)
(VLAX-PUT-PROPERTY X "Filename" "")
(VLAX-PUT-PROPERTY X "Filter" FILTER)
(VLAX-PUT-PROPERTY X "MaxFileSize" 10000)
(VLAX-PUT-PROPERTY X "Flags" 512)
(VLAX-PUT-PROPERTY X "Action" 1)
(VLAX-GET-PROPERTY X "Filename")
)
)
-
(if (setq X (VLAX-CREATE-OBJECT "MSComDlg.CommonDialog"))
(progn
(VLAX-PUT-PROPERTY X "DialogTitle" DialogTitle)
(VLAX-PUT-PROPERTY X "Filename" "")
(VLAX-PUT-PROPERTY X "Filter" FILTER)
(VLAX-PUT-PROPERTY X "MaxFileSize" 10000)
(VLAX-PUT-PROPERTY X "Flags" 512)
(VLAX-PUT-PROPERTY X "Action" 1)
(VLAX-GET-PROPERTY X "Filename")
)
)
How about just objDialog.Title = "blah blah blah" ??
also return:; Error: Automation error. Object does not support this property or method: 'objDialog.Title'
I know MSComDlg.CommonDialog can, but ScriptControl can not.
-
(setq ddd (vlax-create-object "UserAccounts.CommonDialog"))
(vlax-dump-object ddd t)
;;Result
_$
; ICommonDialog: ICommonDialog Interface
; Valeurs de propriétés:
; FileName = ""
; Filter = ""
; FilterIndex = type de résultat non pris en charge: 19
; Flags = type de résultat non pris en charge: 19
; InitialDir = ""
; Owner (RO) = ...Contenu indexé masqué...
; Méthodes prises en charge:
; ShowOpen ()
T
_$
-
_$ (vlax-dump-object (vlax-create-object "UserAccounts.CommonDialog") t)
; ICommonDialog: ICommonDialog Interface
;特性值:
; FileName = ""
; Filter = ""
; FilterIndex = 不支持结果类型: 19
; Flags = 不支持结果类型: 19
; InitialDir = ""
; Owner (RO) = ...不显示带索引的内容...
;支持的方法:
; ShowOpen ()
T
Yes, use the controls, that approach did not.
-
(GPS->GETFILED)
select one file,and return return full path of the file selected!
(GETFILE)
select some files,but return the directory!
One question:
Could select some files,and return full path of the files selected???
-
Hi
Could select some files,and return full path of the files selected???
I've try it, but it's do not work :(
Just a question, for select one file, why you dont use getfiled function ?
If you want a dll (http://www.cadxp.com/sujetXForum-21443.htm) that allows you to select multiple files
@+
-
Hi
Could select some files,and return full path of the files selected???
I've try it, but it's do not work :(
Just a question, for select one file, why you dont use getfiled function ?
If you want a dll (http://www.cadxp.com/sujetXForum-21443.htm) that allows you to select multiple files
@+
cool ! Merci Patrick.
-
C'est un plaisir Andrea
ps : pas très réactif le forum augi
@+