This App is No Longer Maintained. Visit the Replacement at StrokesPlus.net

StrokesPlus Forum
                       
StrokesPlus Forum
Home | Profile | Active Topics
Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General Discussion
 General Discussion
 acRunProgram: run with specific parameter
 Forum Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

poweruser84

Russia
24 Posts

Posted - 08/24/2013 :  05:46:39  Show Profile
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  Show Profile  Visit Rob's Homepage
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.
Go to Top of Page

poweruser84

Russia
24 Posts

Posted - 08/24/2013 :  08:26:37  Show Profile
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?
Go to Top of Page

Rob

USA
2615 Posts

Posted - 08/24/2013 :  09:22:55  Show Profile  Visit Rob's Homepage
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)
Go to Top of Page

Rob

USA
2615 Posts

Posted - 08/24/2013 :  09:25:46  Show Profile  Visit Rob's Homepage
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.
Go to Top of Page

poweruser84

Russia
24 Posts

Posted - 08/24/2013 :  15:05:46  Show Profile
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
Go to Top of Page
  Previous Topic Topic Next Topic  
 Forum Locked
 Printer Friendly
Jump To:
StrokesPlus Forum © 2011-2018 Rob Yapchanyk Go To Top Of Page
Snitz Forums 2000