Author Topic: detect if file is open..  (Read 2089 times)

0 Members and 1 Guest are viewing this topic.

Andrea

  • Water Moccasin
  • Posts: 2372
detect if file is open..
« on: November 16, 2006, 02:14:06 PM »
Hi all..

I'm trying to know how can I detect if a txt file is running under notepad.

I mean...

Code: [Select]
(startapp "notepad" filehere)
at this point you can delete the file if you want..
so i need to do something like..

Code: [Select]
(waitfor filehere is not present to any notepad editor be4 continue the routine..)
is this possible ?
Keep smile...

Andrea

  • Water Moccasin
  • Posts: 2372
Re: detect if file is open..
« Reply #1 on: November 16, 2006, 02:24:40 PM »
ok I found something..


Code: [Select]
(acet-sys-spawn 1 "notepad" editedfile)
is this a good way ?
Keep smile...

Patrick_35

  • Guest
Re: detect if file is open..
« Reply #2 on: November 17, 2006, 07:42:19 AM »
I am there almost and I continue to seek, but veiled already a beginning of result

Code: [Select]
(setq WMI (vlax-create-object "WbemScripting.SWbemLocator"))
(setq meth1 (VLAX-INVOKE WMI 'ConnectServer nil nil nil nil nil nil nil nil))
(setq meth2 (vlax-invoke meth1 'ExecQuery (strcat "SELECT DisplayName,State FROM Win32_Service WHERE State = 'Running'")))
(vlax-for item meth2
  (terpri)
  (princ (vlax-get item 'DisplayName))
)
(vlax-for item meth2
  (terpri)
  (princ (vlax-get item 'Name))
)

@+

Guest

  • Guest
Re: detect if file is open..
« Reply #3 on: November 17, 2006, 09:52:49 AM »
What about DOS_ATTRIB?  Or do you not want to rely on a 3rd party app?

LE

  • Guest
Re: detect if file is open..
« Reply #4 on: November 17, 2006, 12:00:17 PM »
There are two functions one made by Tony Tanzillo and another by Dale Fugier - Over here:

http://discussion.autodesk.com/thread.jspa?messageID=1169940


Have fun

Patrick_35

  • Guest
Re: detect if file is open..
« Reply #5 on: November 17, 2006, 05:43:57 PM »
Yes, I find it

Code: [Select]
(defun appli(/ apps item lst meth1 meth2 WMI)
  (setq WMI (vlax-create-object "WbemScripting.SWbemLocator")
        meth1 (vlax-invoke WMI 'ConnectServer nil nil nil nil nil nil nil nil)
        meth2 (vlax-invoke meth1 'ExecQuery "Select * from Win32_Process"))
  (vlax-for item meth2
    (setq lst (append lst (list (vlax-get item 'CommandLine))))
  )
  (vlax-release-object WMI)
  (vlax-release-object meth1)
  (vlax-release-object meth2)
  (vl-remove nil lst)
)

@+

Andrea

  • Water Moccasin
  • Posts: 2372
Re: detect if file is open..
« Reply #6 on: November 18, 2006, 02:28:01 PM »
hmm... :kewl:

interesting...

I like DOSlib...ODCL...and any other 3rtd party tooll...
but if it possible to do it without it.....why not ?

thanks. all...

Keep smile...