Later,
Dick
Edit: Fixed mistake in comment for F12 virtual key code.
Code: Select all
//Waiting for left arrow (VK37)
OnEvent>KEY_DOWN,VK37,0,srt1
//Waiting for up arrow (VK38)
OnEvent>KEY_DOWN,VK38,0,srt2
//Waiting for right arrow (VK39)
OnEvent>KEY_DOWN,VK39,0,srt3
//Waiting for down arrow (VK40)
OnEvent>KEY_DOWN,VK40,0,srt4
//Waiting for Alt+F12
//F12 (VK123)plus 2=Alt
OnEvent>KEY_DOWN,VK123,2,srt5
//This repeat loop constructs the text for the RadioGroup.
//The text is composed of a string of periods
//delimited by %CRLF%.
Let>k=0
Let>RadText=
Repeat>k
Add>k,1
Concat>RadText,.%CRLF%
Until>k,40
//The edit box in the dialog is there to have an item to contain the cursor
//otherwise pressing the arrow keys will move the radioGroup selection. The
//SpeedSelect variable will be made unequal to the itemindex value
//when a new selection is made in the radiogroup. When this occurs
//a comparison test will fail and tab will be pressed moving the dialog
//cursor into the edit box.
Dialog>Dialog1
Caption=Arrow Cursor Speed
Width=138
Height=411
Top=CENTER
Left=CENTER
Close=0
Label=Faster,48,16
Label=Slower,48,288
Edit=msEdit1,48,313,33,msEdit1
RadioGroup=msRadioGroup1,,48,32,33,249,%RadText%.,0
Button=Quit,30,312,75,25,2
Button=Help,30,344,75,25,3
EndDialog>Dialog1
//Construct a variable for the Help Text
//This is primarily for readability and ease of editing
Let>HelpText=Pick a point on the "slider bar" and set the speed%CRLF%
Concat>HelpText,for the mouse cursor to be moved by the arrow keys%CRLF%%CRLF%
Concat>HelpText,Pressing Ctrl+F12 will set the left mouse button down%CRLF%
Concat>HelpText,for dragging with the mouse.%CRLF%%CRLF%
Concat>HelpText,Pressing Ctrl+F12 a second time will release the mouse button.
Dialog>Dialog3
Caption=Arrow Key cursor Help
Width=326
Height=231
Top=CENTER
Left=CENTER
Close=0
Label=%HelpText%,16,16
Button=Ok,112,160,75,25,3
EndDialog>Dialog3
Show>Dialog1
Let>MouseDown=0
Let>SpeedSelect=0
Label>start
GDA>Dialog1,r1
If>r1=2,quit
If>r1=3
Show>Dialog3,r3
CloseDialog>Dialog3
RDA>Dialog1
EndIf
If>%SpeedSelect%<>%dialog1.msRadioGroup1.itemindex%
Let>SpeedSelect=%dialog1.msRadioGroup1.itemindex%
Set>Arrow Cursor Speed
Press Tab
EndIf
//WaitTime is a variable for Wait in the arrow key subroutines.
//It is based on the RadioGroup Item Index value which I added to
//2 then multiplied times .001. The multiplier is an arbitrary number
//as is the choice to add 2.
Let>WaitTime={(0.001*(2+%dialog1.msRadioGroup1.itemindex%))}
//advance is a variable for the number of pixels to be moved each key
//cycle as the arrow key is held down. This was simply a way to make
//the cursor move faster. The "Round" function is needed to prevent fractional
//results which are rejected by the Mouse Move function. Adding 1 to the
//item index is necessary to prevent division by zero.
Let>advance={1+(Round(10/(1+%dialog1.msRadioGroup1.itemindex%)))}
Wait>0.01
Goto>start
Label>quit
SRT>srt1
GCP>X,Y
sub>X,%advance%
Mou>%X%,%Y%
Wait>%WaitTime%
END>srt1
SRT>srt2
GCP>X,Y
sub>Y,%advance%
Mou>%X%,%Y%
Wait>%WaitTime%
END>srt2
SRT>srt3
GCP>X,Y
add>X,%advance%
Mou>%X%,%Y%
Wait>%WaitTime%
END>srt3
SRT>srt4
GCP>X,Y
add>Y,%advance%
Mou>%X%,%Y%
Wait>%WaitTime%
END>srt4
SRT>srt5
If>%MouseDown%=0
Let>MouseDown=1
LDown
Wait>0.1
Else
Let>MouseDown=0
LUp
Wait>0.1
EndIf
END>srt5