views:

75

answers:

1

I want to have SlickEdit control another window.

I have an idea of how this could be done using some window’s apis but I am not sure how to implement this in SlickEdit. I am assuming Slick-C (SlickEdit's macro language) would be used. I have done some limited coding in Slick-C but I am not sure if window apis can be run.

Here is what I want done using windows API.

  • BringWindowToTop (This will bring the other window to the top)
  • SetForegroundWindow
  • Simulate pressing the F7 in the other window by using SendKey.
  • SendKey is a method in WScript.Shell .

It sounds pretty straight forward, all I need to know is how to do it in SlickEdit.

Update:

I pretty much used the concept jussij outlined but in a language I am familar with called PL/B. I already had most of these APIs working for another process, so it was pretty easy to create this new program and had SlickEdit shell out to run the program.

Here is what was needed inside of SlickEdit:

_command BenShellSAV1P198() name_info(','VSARG2_MACRO|VSARG2_MARK|VSARG2_REQUIRES_MDI_EDITORCTL|VSARG2_READ_ONLY)
{
   save_all();
   shell("T:\\Sunbelt\\CODE\\plbwin.exe -h -i PlbBenTDSm.INI SAV1P198.PLC","N");
}

Then I bound that macro to a hot key and it all works just fine.

+2  A: 

SendKey is a method in WScript.Shell.

I am pretty sure everthing you describe can be done at the WScript level.

So you could write a script that does all the work and once you have it working, just add it as a tool to SlickEdit by running the script using the cscript.exe executable.

jussij
I used this in theory but instead of cscript I used a language called PL/B, which I already had most of this functionality programmed. See update above.
Gerhard Weiss