Author |
Topic |
|
poweruser84
Russia
24 Posts |
Posted - 08/24/2013 : 05:46:39
|
Hello all Please help me with your suggestion. I want to set the mouse gesture which should:
1. Activate current window which is under mouse cursor 2. Get handle of active window and then get the executable name of proccess which owns this window 3. Minimize active window 4. Run external program with executable name (derived from S+ variable) as command line parameter of running program.
My code: acActivateWindow(acGetOwnerWindowByPoint(acGetMouseLocationX(), acGetMouseLocationY()),0,0) local exename = acGetExecutableName(acGetForegroundWindow(), 0, 0) acMinimizeWindow(nil, acGetMouseLocationX(), acGetMouseLocationY()) acRunProgram("c:\\Windows\\SysWOW64\\pssuspend.exe","????",0,1)
It doesn't work because i can't use exename varibale as an command line parameter.
|
Edited by - poweruser84 on 08/24/2013 05:47:25 |
|
Rob
USA
2615 Posts |
Posted - 08/24/2013 : 06:32:35
|
Try:
acRunProgram("c:\\Windows\\SysWOW64\\pssuspend.exe",exename,0,1)
If you had quotes around exename, then you were passing the literal "exename" instead of the contents of the variable. |
|
|
poweruser84
Russia
24 Posts |
Posted - 08/24/2013 : 08:26:37
|
Thank you for suggestion, Rob!
Is there are possibility to use the contents of the "exename" variable in another mouse gesture? What this gesture does - it's simply suspends process which owns active window. I want to add another gesture for resuming process. So the "exename" variable should be stored to be used in an another gesture/action. Command line looks a little bit more complicated: c:\Windows\SysWOW64\pssuspend.exe -r application.exe
Any suggestion? |
|
|
Rob
USA
2615 Posts |
Posted - 08/24/2013 : 09:22:55
|
Out of curiosity, was there a reason that the S+ action acPauseResumeThreadList didn't work? It sounds like it does the same thing as pssuspend. Not a big deal, just curious if my action didn't work in some way.
Yes, if you remove "local" from preceding the variable name it will persist in the Lua state, until S+ is closed or the engine gets reloaded (clicking the reload tray menu item, calling acReloadConfig, maybe when you click OK on the S+ settings window, but I don't think so) |
|
|
Rob
USA
2615 Posts |
Posted - 08/24/2013 : 09:25:46
|
Oh, and you'd call your resume process like this:
acRunProgram("c:\\Windows\\SysWOW64\\pssuspend.exe","-r "..exename,0,1)
Two dots is how you concatenate strings in Lua. |
|
|
poweruser84
Russia
24 Posts |
Posted - 08/24/2013 : 15:05:46
|
Thank you, Rob. acPauseResumeThreadList - yes, i missed this command. Your program is so great that i still didn't discovered all of its capabilities. |
Edited by - poweruser84 on 08/24/2013 15:06:34 |
|
|
|
Topic |
|
|
|