Author |
Topic |
|
breakcore
Russia
74 Posts |
Posted - 01/28/2013 : 06:58:19
|
Hi, Rob. May be there already is the way to do that, but I can't figure it out. I use acDisplayText for monitoring purposes a lot, and sometimes need to see the value it displays until that value changes (0.1~5 sec). for example i've made a script for pasting the string from array of strings. When I press right and left mouse buttons and move the mouse to the right each 50px the array index increases and acDisplayText shows me the current string to be pasted, and if i move the mouse up the script pastes the string. Currently i set the duration parameter to 1000, but it can't be interrupted by another acDisplayText message. the acDisplayBalloonTip does this job well but I need to move my eyes to another part of the screen instead of seeing the message at the cursor Can you please make acDisplayText interruptable by another acDisplayText or by something like acDisplayTextExit. Thanks. |
Edited by - breakcore on 01/28/2013 08:02:26 |
|
Rob
USA
2615 Posts |
Posted - 01/28/2013 : 09:39:16
|
I'll add acKillDisplayText to 2.5.9. The reason a subsequent call to acDisplayText doesn't replace the existing one is due to a race condition when gesturing extremely fast, causing the secondary Lua state to be used. Since the actions fire in their own threads, this situation opened the possibility for a collision, causing S+ to crash. However, adding this action function should be fine as I don't believe a collision would do any harm, it would simply try to close a window that's no longer there and exit but ensure the display text window has been closed and is ready to be called again. |
|
|
breakcore
Russia
74 Posts |
Posted - 01/29/2013 : 16:52:31
|
Thanks for update, Rob!!! I've been testing this new function, and it works OK. But when I use it in my perverted ways, it leaves "ghosts" - unkilled texts. And I have to reload S+ for them to disappear. However if I move the mouse slowly it works fine, and i can live with that. So I thought may be you'll take a look at my script and suggest any correction to avoid that "ghosts". I described this script in my first post
----------------------------------------
array={'aaa','bbb','ccc','ddd','eee'}
current_step=1
border=100
step_length=50
array_index=0
while math.abs(acGetMouseLocationY()-gey)<border do --while the y pos of the mouse is within the border (+/-100px)
if current_step==math.floor((gex-acGetMouseLocationX())/step_length) then --if same step then ignore
acDelay(10)
else
array_index=math.fmod(array_index,#array)+1
current_step=math.floor((gex-acGetMouseLocationX())/step_length)
acKillDisplayText() acDelay(100)
acDisplayText(array[array_index],"arial",30,0,0,0,5000,acGetMouseLocationX(),acGetMouseLocationY())
--acDisplayBalloonTip(array[array_index],"",0)
end
end
if (acGetMouseLocationY()-gey)>border then acDelay(10)--if mouse moved down beyond the border then cancel
else acMessageBox(array[array_index],'left',nil) --if moved up ...
end
------------------------------------------ |
Edited by - breakcore on 01/29/2013 17:09:05 |
|
|
Rob
USA
2615 Posts |
Posted - 01/29/2013 : 17:12:04
|
Hmm, what version of S+ (and signed/unsigned) are you running so I can post test versions for you to try.
Edit: Err, I meant platform, 32 or 64-bit. |
|
|
breakcore
Russia
74 Posts |
Posted - 01/29/2013 : 17:38:46
|
it's portable version 64 bit, and config files are from custom file path.
Also it seems acDisplayText consumes CPU a lot, especially when put in a loop with delay 100ms, but may be its a normal behavior ...
a=0 while a<40 do acDisplayText("1111111111","arial",30,0,0,0,100,acGetMouseLocationX(),acGetMouseLocationY()) a=a+1 acDelay(100) end
when i run this script CPU usage raises up to ~70% (though my laptop is not powerful one)
EDIT: the CPU overusage is due to my windows classic theme... The "ghosts" problem is still exists though. |
Edited by - breakcore on 01/29/2013 17:47:03 |
|
|
Rob
USA
2615 Posts |
Posted - 01/29/2013 : 17:46:01
|
Yea, it was never really intended for your kind of use, lol. It may make more sense to create an app which stays running to which you post the message you want displayed.
Each call to acDisplayText actually creates a whole new window, processes WM_PAINT, redrawing the text when Windows tells it to (which is probably a lot based on what you're doing), and destroys the window when it's reached the timeout (or call to acKillDisplayText).
So yea, it's pretty CPU intensive. In early designs, I tried having the text window running all the time, or hiding it, etc. In the end, I always ran into some issue which made it not worth it, the current structure (sans your ghosting) was the cleanest method with the fewest potential for issues.
I'll look around, see if there's anything I come up with.
|
|
|
Rob
USA
2615 Posts |
Posted - 01/29/2013 : 17:47:13
|
And when it creates the window, Windows has to alpha blend a window the size of the entire screen when it loads, so that's a lot of processing as well. |
|
|
breakcore
Russia
74 Posts |
Posted - 01/29/2013 : 18:16:18
|
Thanks for explanation. For super fast response we can always use balloon tips (It is really super fast=) |
|
|
Rob
USA
2615 Posts |
|
Rob
USA
2615 Posts |
Posted - 01/29/2013 : 19:26:36
|
Also, would you mind posting a screenshot of the ghosts so I can better understand the way it's presenting. |
|
|
breakcore
Russia
74 Posts |
Posted - 01/30/2013 : 02:03:40
|
|
|
|
breakcore
Russia
74 Posts |
Posted - 01/30/2013 : 02:09:35
|
sorry I'm not actually launched a new version. The new version seems solved the problem!!! I can't produce any ghosts. But something strange about displayText duration... it became short now, 0.5~1 sec. I'll make more tests...
update: hm... now it works almost perfect! |
Edited by - breakcore on 01/30/2013 03:59:05 |
|
|
Rob
USA
2615 Posts |
Posted - 01/30/2013 : 05:32:06
|
Glad to hear! I'll make a couple other adjustments that I just thought of which may have caused the duration oddity. |
|
|
|
Topic |
|
|
|