TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: laison on July 19, 2009, 06:55:30 AM
-
I have been searching a macro that would launch notepad in AutoCad. I ran across this below. It brings up another window. If there is any other macros that would launch notepad can you post it.
Thank you
^C^Cshell;notepad;
-
Have you tried:
(startapp "notepad" "File Name")
-
and
Autocad is waiting for the completion of the program (notepad.exe)
;;Variant 1
;;Autocad is waiting for the completion of the program (notepad.exe)
(setq file-name "C:\\TEST.TXT")
(vl-load-com)
(vlax-invoke-method
(setq ws (vlax-get-or-create-object "wscript.shell"))
"run"
(strcat "notepad.exe\ " file-name)
1
[color=red]:vlax-true[/color]
) ;_ end of vlax-invoke-method
(vlax-release-object ws)
;;Variant 2
;;Autocad isn't waiting for the completion of the program (notepad.exe)
(setq file-name "C:\\TEST.TXT")
(vl-load-com)
(vlax-invoke-method
(setq ws (vlax-get-or-create-object "wscript.shell"))
"run"
(strcat "notepad.exe\ " file-name)
1
[color=red] :vlax-false[/color]
) ;_ end of vlax-invoke-method
(vlax-release-object ws)
-
Hi
An another ;)
(defun xopen(name / di na sh)
(and (setq name (findfile name))
(setq sh (vlax-create-object "Shell.Application"))
(setq di (vlax-invoke sh 'Namespace (vl-filename-directory name)))
(setq na (vlax-invoke di 'parsename (strcat (vl-filename-base name) (vl-filename-extension name))))
(vlax-invoke-method na 'invokeverbex "open")
)
(vlax-release-object sh)
na
)
(setq my_file (xopen "c:/test.txt"))
or
(setq my_file (xopen c:/test.avi"))
@+