Author Topic: Macro for Notepad in Autocad  (Read 3846 times)

0 Members and 1 Guest are viewing this topic.

laison

  • Guest
Macro for Notepad in Autocad
« 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;


CAB

  • Global Moderator
  • Seagull
  • Posts: 10400
Re: Macro for Notepad in Autocad
« Reply #1 on: July 19, 2009, 08:15:30 AM »
Have you tried:
Code: [Select]
(startapp "notepad" "File Name")
I've reached the age where the happy hour is a nap. ()
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

VVA

  • Newt
  • Posts: 166
Re: Macro for Notepad in Autocad
« Reply #2 on: July 20, 2009, 08:59:23 AM »
and
Autocad is waiting for the completion of the program (notepad.exe)
Code: [Select]
;;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)

Patrick_35

  • Bull Frog
  • Posts: 276
  • Rennes, France
Re: Macro for Notepad in Autocad
« Reply #3 on: July 21, 2009, 07:46:55 AM »
Hi

An another ;)

Code: [Select]
(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
)

Code: [Select]
(setq my_file (xopen "c:/test.txt"))
or
(setq my_file (xopen c:/test.avi"))

@+
The shape even of the pyramids of Egypt shows that already the workmen tended to make some less and less.
Will Cuppy, 1884-1949.