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

 All Forums
 General Discussion
 General Discussion
 how to active and restore window?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

dizluk

Korea
11 Posts

Posted - 01/02/2014 :  12:09:31  Show Profile  Reply with Quote
Happy new year Rob!

I want to active & restore(show) in minimize application.
so i make a script in Global Actions:

acShellExecute("open", "C:\\~\\~\\notepad.exe", "", "", 9)

but after the guesture, excute at the new window that application.

how do I?

helloooooo!

Edited by - dizluk on 01/02/2014 12:10:36

Rob

USA
2604 Posts

Posted - 01/02/2014 :  12:38:20  Show Profile  Visit Rob's Homepage  Reply with Quote
This is a rather simplistic way of doing it, but should work fine if there's only one Notepad window open:
local notepad = acFindWindow("Notepad")
if notepad > 0 then
	acRestoreWindow(notepad)
	acActivateWindow(notepad)
else
	acShellExecute("open", "C:\\~\\~\\notepad.exe", "", "", 9)
end
If a window with the classname of "Notepad" is already open, restore and activate it, otherwise open Notepad. Note that if you execute the action while Notepad is maximized, it will restore the window. You can search the forum for the definition of "isZoomed" to check if the window is maximized.

As I said, it's a simple starting script which should get you going in the right direction.
Go to Top of Page

dizluk

Korea
11 Posts

Posted - 01/02/2014 :  20:31:19  Show Profile  Reply with Quote
I love you!!

helloooooo!
Go to Top of Page

dizluk

Korea
11 Posts

Posted - 01/12/2014 :  10:01:32  Show Profile  Reply with Quote
Hello Rob!
I have a new problem..

In that case, your solution was well.
But I try to apply to Editplus, unfortunately Editplus has random classname:
Afx:00400000:8:00010005:00000000:00640607

So I use title regex :
acFindWindowByTitleRegex("EditPlus")

But title was created like randomly :
"C:\~\Desktop\a.txt - Editplus"
"C:\b.txt - Editplus"


In this case, how do I?




helloooooo!

Edited by - dizluk on 01/12/2014 10:03:49
Go to Top of Page

Rob

USA
2604 Posts

Posted - 01/12/2014 :  10:22:42  Show Profile  Visit Rob's Homepage  Reply with Quote
Try:

acFindWindowByTitleRegex(".* - EditPlus")
Go to Top of Page

dizluk

Korea
11 Posts

Posted - 01/12/2014 :  12:58:09  Show Profile  Reply with Quote
Thankyou VVVVVVVERY MUCH!

helloooooo!
Go to Top of Page

dizluk

Korea
11 Posts

Posted - 03/31/2014 :  01:17:27  Show Profile  Reply with Quote
I found new issue.

I'm using "TreeDBNotes(http://www.mytreedb.com/treedbnotes_free.html)".

So, I Added new Lua Script :
-----
local TreeDBNotes = acFindWindow("TFormMain.UnicodeClass")

if TreeDBNotes > 0 then
acRestoreWindow(TreeDBNotes)
acActivateWindow(TreeDBNotes)
else
acShellExecute("open", "D:\\Dropbox\\program\\TreeDBNotes\\TreeDBNotes.exe", "", "", 4)
end
-----

This script has Normal Operation that already open, restore and activate it, otherwise open it.
But when it was restore and active, it is become to froze(typing the notes is alright.. but alt+F4, acMinimizeWindow(nil, gsx, gsy) and system operations are abnormal).

How can I solve this problem?

helloooooo!
Go to Top of Page

Rob

USA
2604 Posts

Posted - 04/09/2014 :  12:33:33  Show Profile  Visit Rob's Homepage  Reply with Quote
Sorry for the late response. I've installed TreeDBNotes and used your script, but I'm not having any unexpected behavior (freezing). Can you provide with the exact steps to reproduce the problem?
Go to Top of Page

dizluk

Korea
11 Posts

Posted - 04/10/2014 :  04:27:29  Show Profile  Reply with Quote
Sure!

1. Add action at 'Global Actions'
2. Draw gesture(shellexecute)
2. Run TreeDBNotes
3. Minimize TreeDBNotes
-- Until now operation normally.
4. Draw gesture(restore & activewindow)
5. Click the TreeDBNotes for use, I can see freezing phenomenon.

I'm using windows 7 64bit.
and..... need more support? I want help you!

helloooooo!
Go to Top of Page

Rob

USA
2604 Posts

Posted - 04/10/2014 :  18:30:27  Show Profile  Visit Rob's Homepage  Reply with Quote
Ok, this is because TreeDBNotes is a Delphi application, which has a weird way of constructing and managing windows. There are actually two main windows, one which puts the button on the Taskbar and controls the main window (that you see), and the main window, which manages some of its visibility aspects, but not all. For example, if you maximize TreeDB, the main application window will be marked as maximized, but the Taskbar button window will not. However, if you minimize TreeDB (while it's maximized), the main application window will still be flagged as maximized, even though it's not visible; while the Taskbar button window will be marked as minimized. The main application window will never have a minimized window state, and the Taskbar button window will never have a maximized state.

So you have to determine the state of the window by looking at the master window, which controls the visibility when the application is minimized...yes, it's rather confusing!

First, define this in your Global Lua:

user32 = alien.core.load("user32.dll")

-- ************ IsIconic ************
gIsIconic = user32.IsIconic
gIsIconic:types{ ret = 'long', abi = 'stdcall', 'long'}
function aIsIconic(iWnd)
	return gIsIconic(iWnd)
end

Then use this as your action:
local TreeDBMain = 0
local TreeDBChild = 0
acGetAllWindows(0) --Get all window handles
for num, handle in pairs(sp_all_windows) do 
	if acGetExecutableName(handle,0,0) == "TreeDBNotes.exe" then --If TreeDBNotes
		if acGetClassName(handle,0,0) == "TApplication" then 
			TreeDBMain = handle --This is the master (Taskbar) window
		end
		if acGetClassName(handle,0,0) == "TFormMain.UnicodeClass" then
			TreeDBChild = handle --This is the main application window
		end
	end
end
if TreeDBMain > 0 then
	if aIsIconic(TreeDBMain) then --Check to see if Taskbar window is minimized
		acRestoreWindow(TreeDBMain) --If so, restore
	end
	acActivateWindow(TreeDBChild) --Activate the main application window
else
	acShellExecute("open", "D:\\Dropbox\\program\\TreeDBNotes\\TreeDBNotes.exe", "", "", 4)
end
Go to Top of Page

dizluk

Korea
11 Posts

Posted - 04/15/2014 :  05:03:33  Show Profile  Reply with Quote
thank you Rob!

I'm trying to say of the new sad news.. T_T

App's freezing phenomenon is gone. But I click the text editor space after restore window, all of the rich-editor buttons(Bold, Italic, align, indent, ) are disabled.

please check this...

helloooooo!
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
StrokesPlus Forum © 2011-2018 Rob Yapchanyk Go To Top Of Page
Snitz Forums 2000