Page 5 of 6

Re: PasteColor

Posted: Wed Feb 13, 2013 9:34 am
by guinness
I did think about WinList, but I don't actually know how accurate that is in terms of having the next window in the z-order list being next in the array.

Didn't work for me.

Code: Select all

#include <Constants.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

Local $hGUI = GUICreate('', 0, 0, -9999, -9999)
GUISetState(@SW_SHOW, $hGUI)
GUIRegisterMsg($WM_ACTIVATEAPP, 'WM_ACTIVATEAPP')
GUIDelete($hGUI)

MsgBox($MB_SYSTEMMODAL, '', 'Exit...', 1)

Func WM_ACTIVATEAPP($hWnd, $iMsg, $wParam, $lParam)
	MsgBox($MB_SYSTEMMODAL, '', WinGetTitle(_WinAPI_GetForegroundWindow()))
EndFunc   ;==>WM_ACTIVATEAPP

Re: PasteColor

Posted: Wed Feb 13, 2013 1:38 pm
by tproli
I did a quick test with HotKeySet and PasteColor worked fine in VirtualBox too. I still have issues activating the next control with some type of dialog boxes but perhaps I can fix that too (the Send method works fine in these cases).

I will test it on other machines as well but I'm optimistic. In fact I got excited to make my very first GUI application :) Nothing complicated but an Option window with 2-3 settings. Now I only need some free time to play with it :)

Re: PasteColor

Posted: Wed Feb 13, 2013 2:18 pm
by guinness
I'm very happy for you.

I have been having a hard time working on my SciTE Jump application, now that will teach you a lot about GUIs.

Re: PasteColor

Posted: Wed Feb 13, 2013 2:23 pm
by tproli
Yes, I know I should try something than my all-in-one html editor for AutoIt :)

Re: PasteColor

Posted: Wed Feb 13, 2013 2:48 pm
by guinness
Your what? Interesting.

Re: PasteColor

Posted: Wed Feb 13, 2013 11:17 pm
by tproli
I'm using RJ Texted in most cases when writting any kind of code. Now I jumped to the Scite bandwagon for AutoIt, so far so good. I also added SciteJump to it and seems useful.

Managed to fix the control activation issue but still not 99%. Now I jump to the next control with

Code: Select all

$activeInstance += 1
ControlFocus($activeWindow, "", "[CLASS:" & $activeClass & "; INSTANCE:" & $activeInstance & "]")
which works fine but in rare cases control instances are not in order (e.g. 4,6,5 instead of 4,5,6) so PasteColor obviously returns a wrong value.
Anyway, I think this is not something PasteColor's has to solve and the AlternateSendMethod also covers that (by sending TAB key).

Btw, in SciteJump readme it says
if you wish to integrate into SciTE then right click on the titlebar and select 'Add to SciTE.'
I don't see this option, see:
scitejump.png
scitejump.png (32.2 KiB) Viewed 36020 times
Am I missing something?

Re: PasteColor

Posted: Thu Feb 14, 2013 1:34 am
by guinness
Are you using SciTE4AutoIt3? As this is automatically included. Plus go to the SciTE Jump page and download the latest version, you're using a really old version of SciTE Jump in that image.

Re: PasteColor

Posted: Thu Feb 14, 2013 1:56 am
by tproli
I see, thanks. First I tried your AutoIt Creator but had troubles with the drag-and-drop installation so I manually added the applications (and messed up things).

Re: PasteColor

Posted: Thu Feb 14, 2013 3:47 am
by guinness
Yeh, it's been reported and I will fix it soon.

Re: PasteColor

Posted: Sun Feb 17, 2013 2:28 am
by tproli
I managed to auto-switch the send mode, so it works lightning-fast with windows-style controls and somewhat slower with others.

In case of LibreOffice the color picker controls seem like standard windows controls but in fact they have no IDs, no classnames and so on. In such cases there is no other option than using Send().

To make it even worse, some type of controls doesn't allow sending ctrl+c to copy, e.g. RJ Texted's color picker. In this particulat case ControlGetText returns the value but I'm there are applications where both ways fail. Never thought this could be that problematic.

I a *beautiful* GUI is also on the way but as I have no time nowadays that will appear only in future releases, if ever :)

Re: PasteColor

Posted: Thu Feb 21, 2013 9:59 am
by tproli
Several times I was about to ask for AutoIt help here but fortunately I found the answers before clicking on the Submit button :)

I just finished the Settings window and a Tray icon/menu and it was a great fun. First I messed with the default MessageLoop mode but in the end the OnEvent mode proved to be better.

Now all settings are configurable via the Settings window, including the main hotkey too. There are also several new feature like Enable/Disable (showing different systray icons), HTML color names are also supported (like "LightBlue"), etc.

I still have a few minor things to solve but PasteColor will be released soon.

I think that the Win7 window/control activation issue actually did a good impact on my AutoIt career, don't you think? :)

Re: PasteColor

Posted: Sat Feb 23, 2013 9:03 am
by tproli
@guinness
You are probably familiar with _ReduceMemory():
http://www.autoitscript.com/forum/topic ... ntry137837

I'm using it when hiding the Settings window but is it safe adding it to the main GUI loop?

Code: Select all

Func MainLoop()
	While 1
		Sleep(20)
		_ReduceMemory()
	WEnd
EndFunc;==> MainLoop()
Using like this keeps PasteColor memory usage below 500KB, otherwise (calling it only after user interactions) memory goes up slowly to about 2 MBs. Not using the function at all, memory peaks about 6-7MB.

Re: PasteColor

Posted: Sat Feb 23, 2013 9:41 am
by guinness
I prefer _WinAPI_EmptyWorkingSet, but then again I removed that function from my application ages ago.

I wouldn't use it as it's just hiding memory leaks not solving them. I have no idea why Microsoft created that API function, because Windows should manage memory usage of the application not the developer.

My advice (if you take it) debug your code to see where possible memory leaks are taking place, not only will it make you even more familiar with your code, but you will learn to code correctly.

A source of information about good coding practice: http://www.autoitscript.com/forum/topic ... in-autoit/

Re: PasteColor

Posted: Sat Feb 23, 2013 11:06 am
by tproli
Thanks, will read the topic. I added _WinAPI_EmptyWorkingSet instead, and it has the advantage that it reduces memory for the 64bit version too.

Re: PasteColor

Posted: Sat Feb 23, 2013 12:24 pm
by guinness
If you find a function on the Forum that uses the Windows API, check WinAPIEx, because no doubt it's there with the added plus of working with 64-bit.