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
 Lua Scripts
 General Action Scripts
 Closing Apps
 Forum Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

p_ewing

5 Posts

Posted - 04/05/2012 :  01:57:41  Show Profile
If I wanted to close an app, say thunderbird.exe
Do I use acCloseApplication or acTerminateProcess? And how do you use them?

Rob

USA
2615 Posts

Posted - 04/05/2012 :  09:03:16  Show Profile  Visit Rob's Homepage
Do you mean where Thunderbird isn't the foreground window (like using the included Close Program action)?

I admit, it does seem that closing a program by using the executable's name is something that S+ should have a direct action for. I'll have to add that to the TO DO list. In the meantime, I tested this script and it seemed to work for me:

local iHandle = 0
iHandle = acFindWindowByTitleRegex(".*Mozilla Thunderbird")
if iHandle > 0 then
acCloseApplication(iHandle, 0, 0)
end

What it does is find the Thunderbird window by matching the window title to the regular expression pattern (".*Mozilla Thunderbird"), then passing the handle of the Thunderbird window to acCloseApplication. You could pass it into acTerminateProcess, but I only recommend using that action for when you want to force kill a process, not just exit the program normally.

Let me know if this works for you.
Go to Top of Page

aShai33

21 Posts

Posted - 07/28/2013 :  22:45:28  Show Profile
I tried using the example above and I changed the app that I'm trying to close, still didn't work. I'm trying to make a script to close the magnifier glass in windows 7. Thanks
Go to Top of Page

Rob

USA
2615 Posts

Posted - 07/28/2013 :  22:51:39  Show Profile  Visit Rob's Homepage
This seems to work for me:

local iHandle = 0
iHandle = acFindWindow("MagUIClass") 
if iHandle > 0 then
	acCloseApplication(iHandle, 0, 0)
end
Go to Top of Page

aShai33

21 Posts

Posted - 07/28/2013 :  23:00:02  Show Profile
quote:
Originally posted by Rob

This seems to work for me:

local iHandle = 0
iHandle = acFindWindow("MagUIClass") 
if iHandle > 0 then
	acCloseApplication(iHandle, 0, 0)
end




Wow, Keep up the great work!!!!
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