PasteColor

If you are currently developing portable freeware or planning to do so, use this forum to discuss technical implementation, seek out like-minded developers for partnership, or solicit interested users for beta testing.
Message
Author
User avatar
guinness
Posts: 4118
Joined: Mon Aug 27, 2007 2:00 am
Contact:

Re: PasteColor

#61 Post 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

User avatar
tproli
Posts: 1172
Joined: Sat Sep 09, 2006 10:14 am
Location: Hungary
Contact:

Re: PasteColor

#62 Post 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 :)

User avatar
guinness
Posts: 4118
Joined: Mon Aug 27, 2007 2:00 am
Contact:

Re: PasteColor

#63 Post 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.

User avatar
tproli
Posts: 1172
Joined: Sat Sep 09, 2006 10:14 am
Location: Hungary
Contact:

Re: PasteColor

#64 Post by tproli »

Yes, I know I should try something than my all-in-one html editor for AutoIt :)

User avatar
guinness
Posts: 4118
Joined: Mon Aug 27, 2007 2:00 am
Contact:

Re: PasteColor

#65 Post by guinness »

Your what? Interesting.

User avatar
tproli
Posts: 1172
Joined: Sat Sep 09, 2006 10:14 am
Location: Hungary
Contact:

Re: PasteColor

#66 Post 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 35449 times
Am I missing something?

User avatar
guinness
Posts: 4118
Joined: Mon Aug 27, 2007 2:00 am
Contact:

Re: PasteColor

#67 Post 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.

User avatar
tproli
Posts: 1172
Joined: Sat Sep 09, 2006 10:14 am
Location: Hungary
Contact:

Re: PasteColor

#68 Post 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).

User avatar
guinness
Posts: 4118
Joined: Mon Aug 27, 2007 2:00 am
Contact:

Re: PasteColor

#69 Post by guinness »

Yeh, it's been reported and I will fix it soon.

User avatar
tproli
Posts: 1172
Joined: Sat Sep 09, 2006 10:14 am
Location: Hungary
Contact:

Re: PasteColor

#70 Post 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 :)

User avatar
tproli
Posts: 1172
Joined: Sat Sep 09, 2006 10:14 am
Location: Hungary
Contact:

Re: PasteColor

#71 Post 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? :)

User avatar
tproli
Posts: 1172
Joined: Sat Sep 09, 2006 10:14 am
Location: Hungary
Contact:

Re: PasteColor

#72 Post 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.

User avatar
guinness
Posts: 4118
Joined: Mon Aug 27, 2007 2:00 am
Contact:

Re: PasteColor

#73 Post 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/

User avatar
tproli
Posts: 1172
Joined: Sat Sep 09, 2006 10:14 am
Location: Hungary
Contact:

Re: PasteColor

#74 Post 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.

User avatar
guinness
Posts: 4118
Joined: Mon Aug 27, 2007 2:00 am
Contact:

Re: PasteColor

#75 Post 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.

Post Reply