Jump to content
Sign in to follow this  
Saumya4Mishra

How to execute a tcl script in an existing HM session whose PID is known

Recommended Posts

Hi all,

 

I wanna run some script in my already opened HM session. Is there any way we can access the HM session and execute the tcl script?

NOTE:  I have the HM Session PID where I wanna run the script

 

Regards

Saumya

Share this post


Link to post
Share on other sites

 

 

 

Refer above.

 

In your case, this way may be simpler:

Your hm session (eg. with pid 1234) must pre-run a timer (write it in c:/users/name/hmcustom.tcl)

 

That timer checks a file eg. 1234.tcl

If file existing, source it, then clear the file!

 

So everytime you want to excute a script, put it in 1234.tcl

 

A such timer:

proc ::p_MonitorFile {{path {}}} {

   set path_ $path

   after cancel [list ::p_MonitorFile $path_]

   if {$path==""} {

      set path [file join $::env(HOME) [pid].tcl]

   }

   if {[file exists $path]} {

       catch {source $path} err

       file delete $path

       puts "Executed $path got $err"

   }

   after 3000 [list ::p_MonitorFile $path_]

}

Saumya4Mishra likes this

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
You are posting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...