Hi Gang,
Is the a way when calling (startapp "c:\\windows\\notepad.exe" "txtout2.txt")
to have the program pause until you saved changes to the file? Thanks
Southie
Thanks for the interest Alan
For instance when i run sniip below unless i use some kind of pause thing the txtout1.txt output file would have already been opened read and wrote out to output1.txt before saving txtout1.txt in notepad.
(setq f (open "output1.txt" "w"))
(setq chkstr (startapp "c:\\windows\\notepad.exe" "txtout1.txt"));make changes to file then save
(alert "You have completed and Saved Changes!")
(setq ff (open "txtout1.txt" "r"))
(while (setq a (read-line ff))
(write-line a f)
)
(close ff)
(close f)
For that you would need to be able to add something like an AutoCAD reactor to Notepad's save functionality, and get it to send a message to AutoCAD. Pretty much impossible for closed-source programs with no API for the purpose.
Far easier would be to make AutoCAD wait until the user closes the external program, that wouldn't need any access to its internals.
Can't do that with STARTAPP, but take a look at the dos_exewait function in DOSlib.
--
Thanks for responses guys
Marti can't use dol_lib by contract to many different users.
Dev tried your sugestion but it did not work when i commented out the ;(alert "You have completed and Saved Changes!").
Was hoping for no user intervention. see below and again thanks
(setq ff (open "txtout1.txt" "w"))
(write-line "THIS LINE OF TEXT IS HERE TO ACT LIKE A MARGIN FOR NOTE INPUT." ff)
(close ff)
(setq f (open "output1.txt" "w"))
(setq chkstr (startapp "c:\\windows\\notepad.exe" (findfile "txtout1.txt")));make changes to file then save
;(alert "You have completed and Saved Changes!")
(setq ff (open (findfile "txtout1.txt") "r"))
(while (setq a (read-line ff))
(write-line a f)
)
(close ff)
(close f)
(startapp "c:\\windows\\notepad.exe" (findfile "txtout1.txt"))
(setq ff (open "txtout1.txt" "w")) (write-line "THIS LINE OF TEXT IS HERE TO ACT LIKE A MARGIN FOR NOTE INPUT." ff) (close ff) (setq f (open "output1.txt" "a")) (setq chkstr (startapp "c:\\windows\\notepad.exe" (findfile "txtout1.txt")));make changes to file then save ;(alert "You have completed and Saved Changes!") (Close f) (setq f (open "output1.txt" "a")) (setq ff (open (findfile "txtout1.txt") "r")) (while (setq a (read-line ff)) (write-line a f) ) (close ff) (close f) (startapp "c:\\windows\\notepad.exe" (findfile "txtout1.txt"))
Try this way NOTE the A instead of W
Maybe I can not understand your query.
Find attached 2 files
make-file , use only once
use
make-change-at-notepad
to make the changes
@southie wrote:Thanks for responses guys
Marti can't use dol_lib by contract to many different users.
Another way, if you don't want to use DOSlib, would be to build a busy-wait loop after the STARTAPP call, watching the timestamp of the txtout.txt file.
http://en.wikipedia.org/wiki/Busy_waiting
- better add a timeout, if the user never saves the file...
--