Page 4 of 6

Re: PasteColor

Posted: Tue Feb 05, 2013 1:52 pm
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 :)

Re: PasteColor

Posted: Tue Feb 05, 2013 3:28 pm
by guinness
Can't say I've come across any problems myself. Could you provide a reproducer perhaps?

Re: PasteColor

Posted: Wed Feb 06, 2013 12:33 am
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.

Re: PasteColor

Posted: Wed Feb 06, 2013 2:37 am
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.

Re: PasteColor

Posted: Wed Feb 06, 2013 4:17 am
by tproli
Thanks. I will try solving it myself but if nothing helps I'll apply for some help :)

Re: PasteColor

Posted: Wed Feb 06, 2013 4:26 am
by guinness
OK, actually that's good to hear, sign of a true developer. :mrgreen:

Re: PasteColor

Posted: Tue Feb 12, 2013 10:06 pm
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.

Re: PasteColor

Posted: Wed Feb 13, 2013 2:11 am
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.

Re: PasteColor

Posted: Wed Feb 13, 2013 3:14 am
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?

Re: PasteColor

Posted: Wed Feb 13, 2013 3:27 am
by guinness
QuitApp was missing. All I did was drag into SciTE and selected Run.

Re: PasteColor

Posted: Wed Feb 13, 2013 3:31 am
by tproli
It does return the window title when running directly. The problem occurs only when launched via a hotkey.

Re: PasteColor

Posted: Wed Feb 13, 2013 3:44 am
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.

Re: PasteColor

Posted: Wed Feb 13, 2013 5:51 am
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 :)

Re: PasteColor

Posted: Wed Feb 13, 2013 9:00 am
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?

Re: PasteColor

Posted: Wed Feb 13, 2013 9:16 am
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.