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
tproli
Posts: 1172
Joined: Sat Sep 09, 2006 10:14 am
Location: Hungary
Contact:

Re: PasteColor

#46 Post by tproli »

Is it possible that AutoIt fails setting a window active and getting control IDs when running in Virtualbox?
I tried with exactly the same OS (Win7 x64) and it works fine in the real one but not in the virtual.

Instead of using XP detection I made an ini setting "AlternateSendMethod" so users can switch modes to make PasteColor work. In my tests PasteColor works fine on Win7 too with MS Paint and MS-like color pickers but fails on others. Using the alternative send method fixes that.

So I strongly hope this malfunction is only present when running in Virtualbox :)

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

Re: PasteColor

#47 Post by guinness »

Can't say I've come across any problems myself. Could you provide a reproducer perhaps?

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

Re: PasteColor

#48 Post by tproli »

In my tests when launching PasteColor with a hotkey (default usage) the Win taskbar gets activated first when running in VirtualBox (instead of the last active window). I will try to fix that somehow.

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

Re: PasteColor

#49 Post by guinness »

If you use SciTE you should check out my SciTE Jump application.

Now back to your issue...please provide me with your test scripts so I can debug them. Thanks.

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

Re: PasteColor

#50 Post by tproli »

Thanks. I will try solving it myself but if nothing helps I'll apply for some help :)

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

Re: PasteColor

#51 Post by guinness »

OK, actually that's good to hear, sign of a true developer. :mrgreen:

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

Re: PasteColor

#52 Post by tproli »

I figured out that AutoIt cannot grab the active window's title (or handle) if the exe is launched via a hotkey.

So the scenario:
- create a desktop shortcut to PasteColor.exe
- set a hotkey for this shortcut
- execute the hotkey: PasteColor may or may not show the window title in the message box

The problem is that it is not consistent - for me it works in the real OS but not in Virtualbox. I have sent PasteColor to others and it neither worked on their real OS.
I have included two screen captures in the zip below. You can see that in virtualbox there is no window title string in the message box.

Here is a very simple test case:
http://rolandtoth.hu/files/PasteColor-test.zip

Unless you know a simple fix to this I can only think about altering how PasteColor is activated. I guess if it would run in the background and use an internal hotkey instead of Windows' then it would run properly.

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

Re: PasteColor

#53 Post by guinness »

After fixing the error in your source code I ran it and it provided the title. If this doesn't help then please provide a smaller reproducer.

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

Re: PasteColor

#54 Post by tproli »

May I know what was that error?

Only the "Test" function was called in the source, basically only WinGetTitle() and a message box.

Did you test it via a hotkey?

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

Re: PasteColor

#55 Post by guinness »

QuitApp was missing. All I did was drag into SciTE and selected Run.

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

Re: PasteColor

#56 Post by tproli »

It does return the window title when running directly. The problem occurs only when launched via a hotkey.

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

Re: PasteColor

#57 Post by guinness »

OK I just saw your scenario. The reproducer was a little overcomplicated. This is enough to reproduce the issue.

Code: Select all

#include <Constants.au3>

MsgBox($MB_SYSTEMMODAL, WinGetTitle(WinGetHandle('[ACTIVE]')), WinGetHandle('[ACTIVE]'))
I'm sure the issue is down to Windows hotkey invoker UI. Oh and how do I remove the shortcut assignment as now Ctrl + Alt + P is in use and I can't re-assign it.

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

Re: PasteColor

#58 Post by tproli »

Thanks. So you say I would better try another way of using PasteColor? (e.g. run in the background and register an own hotkey?)

Perhaps you need to assign another useless hotkey (win-ctrl-alt-shift-9) and delete the shortcut. Windows shortcuts are pita :)

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

Re: PasteColor

#59 Post by guinness »

I read I have to restart, which I do when I install Windows updates every "patch Tuesday." Have you thought about asking on the AutoIt Forum?

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

Re: PasteColor

#60 Post by tproli »

Not yet, but perhaps I will. I did search several times in the forums but no luck.

http://www.autohotkey.com/board/topic/1 ... ve-window/
Here they say it is a known issue among AutoIt users too:
BTW, it seems that this problem is well known in scripting environments. I got AU3 solution on SysInternals forum. AutoIt users had the very same problem.
http://forum.sysinternals.com/topic10793_page1.html

I think I will give a try to the other activation method first.

Post Reply