Posts: 1,769
Threads: 410
Joined: Feb 2003
I'm trying to create a macro that will dislpay a window with only one word in it and then change that word every so often. I think I have the method but I can't seem to figure out a way to create the window.
Does anyone have any ideas how i can create that window?
TY
Posts: 12,087
Threads: 142
Joined: Dec 2002
How this window should look? What purpose? Maybe you can give a simple algorithm (sequence of actions) for whole macro? What method would you use to change the text? From the same macro or from other macro? You for example can use a custom dialog, or CreateWindowEx function, or MainWindow function.
Posts: 1,769
Threads: 410
Joined: Feb 2003
Here's my idea.
Several years ago I saw a story on CNN/MS-NBC or whatever, that if you displayed just one word at a time and in the same place as the previous word people can read much faster than usual (it may be due to the constant movement of the eyes accross the page/screen). So what I was hoping to do is grab a chunk of text and copy it into the clipboard then start the macro that "getclip"s that text and then places it into the window one word at a time with a predetermined pause between each word.
Does that help at all? I was working on it last night and kicking around the best way to pull out consecutive words from the string but haven't settled on that yet.
Thanks for your input.
Ken
Posts: 12,087
Threads: 142
Joined: Dec 2002
Did you tried it in QM output?
;Copy some text and run this macro ...
double wordspeed=0.15
double sentencespeed=0.5
str s.getclip
ARRAY(str) a
int i n=tok(s a -1 " [9][][160]")
for i 0 n
,ifk(C) break
,ClearOutput
,out a[i]
,if(a[i].end(".")) wait sentencespeed
,else wait (a[i].len*(wordspeed/10)+wordspeed)
ClearOutput
Posts: 1,769
Threads: 410
Joined: Feb 2003
AAAAAAAAAAAAAAAAAAAHHHHHHHHHHHHHHHHHHHHHHHHHH!!!!!!!!!!
hock:
That is
exactly what I was looking for!!!!
I had thought of using the Output but didn't remember about the clearoutput cmd. I there a way to adjust the font attributes in the output and then reset them after the macro finishes?
I'm just looking through and adding some bells like word count and expected read time.
PS: I just caught the code that adjusts the time it waits between words in proportion to the length of the word.... VERY NICE!!!
Posts: 12,087
Threads: 142
Joined: Dec 2002
int hwnd=id(2201 _hwndqm)
int+ g_hfont g_hfontprev
if(!g_hfontprev) g_hfontprev=SendMessage(hwnd WM_GETFONT 0 0)
if(!g_hfont) g_hfont=CreateFont2("Verdana" 15 700)
SendMessage(hwnd WM_SETFONT g_hfont 1)
5
SendMessage(hwnd WM_SETFONT g_hfontprev 1)
Function CreateFont2:
;/
function $font [size] [weight] ;;weight: 400 is normal
dll gdi32 #GetObject hgdiobj cbBuffer !*lpvObject
def SYSTEM_FONT 13
LOGFONT lf
GetObject(GetStockObject(SYSTEM_FONT) sizeof(LOGFONT) &lf)
lf.lfPitchAndFamily=0
lf.lfWidth=0
if(size) lf.lfHeight=-MulDiv(size GetDeviceCaps(GetDC(0) LOGPIXELSY) 72)
else lf.lfHeight=0
lf.lfWeight=weight
strncpy(&lf.lfFaceName font 31)
ret CreateFontIndirect(&lf)
Posts: 1,769
Threads: 410
Joined: Feb 2003
Wow, your really cooking now!
Thanks!
I'm having a variable issue maybe you can help me with.
The output should be the same value in this code but when I try to put the double into the out cmd suddenly the value is 0. Can you tell me why?
ClearOutput
0.3
str s.getclip
ARRAY(str) a
int i n=tok(s a -1 " [9][][160]")
double nd
nd=n
out nd
out "nd value = %d " nd
Posts: 12,087
Threads: 142
Joined: Dec 2002
%d is for integers (the same as %i). Use %g, or %e, or %f.