--- In [email protected], "brucexs" <[EMAIL PROTECTED]> wrote:
>
> > 
> > I also want it to switch to that folder and come to the front if
> > another folder is open in DirOpus, whether hidden or minimized.
> >
> 
> This is not easy.
> 
> What you need is some way to send information to a running program.  
> There are at least four ways to do it, but whether any one of them 
> will work in your case depends on your program.
> 
> 1.  Some programs have a "single instance only" option.  Then, if you 
> try to run a second instance, the program is smart enough to take the 
> command line from that second instance and send the information to 
> the already-running instance.  PowerPro works this way for running 
> commands from a command line.  So does TextPad.  Possibly your 
> program has sucn an option.
> 
> 2.  If not, the most reliable way is a COM automation interface.  If 
> your program  supports automation via COM, you could write a script 
> using the COM plugin.  Consult the COM plugin documentation and your 
> program's documentation.
> 
> 3.  Another possibility is DDE.  This is an old technology that MS 
> abandoned when it invented COM, but your program may still support 
> it.  If so, you could use the DDE plugin.  Again, you will need to 
> get the details from documentation of your program and the plugin.
> 
> 4.  Finally, it may be possible to do this by sending keystrokes to 
> your program.  This is the least reliable way and may fail depending 
> on the level of activity on your system.  Assuming there are a series 
> of keys strokes that switch your program to a folder, you would do a 
> script like the following
> 
> if (not anywindow("=yourprog")) do  // program is not running
> run with command line
> quit script
> endif
> 
> find window of your program //see note below
> if window is minimized
> show it using win plugin service
> else
> set it to foreground
> 
> wait for program to become foreground
> send the keys that cause the program to switch to your folder.
> 
> There is one important point above relating to finding the right 
> window to unminimize and to make foreground before sending keys.  As 
> you have learned, something like
> win.show("=yourprog")
> is not reliable.  This is because "=yourprog" can match any window 
> created by yourprog.  Many programs create hidden, off-screen, or 
> zero-sized windows for internal purposes, and it is possible for one 
> of these to be matched by =yourprog, leading to the type of behavior 
> you saw.  
> 
> Instead, you need to find a unique way of identifying the main window 
> that your program displays for you to interact with.  Possibly there 
> is something unique about the caption, e.g. it may always start 
> with "yourprog -".  Or there it may have a special window class.  You 
> can use the exec windowinfo command to look at window classes.  Or 
> you can write a script that uses handlelist("=yourprog") to get all 
> of the handles of the program, and then display the class and caption 
> of each.
> 
> BTW, the =yourprog is the write matcher to use with anywindow 
> function to see if a program is running, since you do want to match 
> any window from that program.
>

Thanks this gives me lots to work with and think about. I'll be busy.


Reply via email to