Re: [Ql-Users] macros
I'm looking to write a little utility to record keypresses as macros, if necessary assigning them to a hotkey or altkey for later use. Some processes mean repeated strings of keypresses, so it may be handy to record these keypresses and replay them later with an alt or hot key to avoid typing the same commands repeatedly. Anyone have any idea how best to go about achieving this? My first thought would be hook in an interrupt handler to read the 'current key press' word from the system variable. But, my second thought was how to determine if it has changed especially when it is the same keypress as the one before. Well, looking at sv_arbuf is possibly one way of doing this, but does not work with 2 successive identical keypresses (unless the program looks at it for the auto-repeat period and reset it, which is definitely not clean) I'm too far away from my docs to be able to look them up at present, plus I have the boiler man in to fix the central heating. We had a new kitchen put in, a radiator removed and it stopped working. The original plumber says it wasn't removing the radiator that did it and doesn't want to know. Plumbers make big money but have a reputation that they ain't always the easiest of people to deal with (like builders) when things go wrong. Even when it really is their fault. PS. Check Slow Gold source code for hooking in an interrupt handler. Also, there was a caps lock indicator program (Quanta?) a few years back. I think that did a similar thing. OK, thanks for that. -- Dilwyn Jones ___ QL-Users Mailing List http://www.q-v-d.demon.co.uk/smsqe.htm
Re: [Ql-Users] macros
On 21 Nov 2007, at 15:24, Dilwyn Jones wrote: I'm looking to write a little utility to record keypresses as macros, if necessary assigning them to a hotkey or altkey for later use. Some processes mean repeated strings of keypresses, so it may be handy to record these keypresses and replay them later with an alt or hot key to avoid typing the same commands repeatedly. Anyone have any idea how best to go about achieving this? I have a short Procedure called wh in my BOOT. This waits for a keypress. When the keypress occurs the program prints the value in sv_arbuf. The program then either waits for another keypress, or, if the key was ESC, exits from the loop. Repeated keypresses produce repeats of the value in sv_arbuf. This procedure could easily be altered to set all the characters keyed in a string. You have to set an end character of course to stop the process. George ___ QL-Users Mailing List http://www.q-v-d.demon.co.uk/smsqe.htm
Re: [Ql-Users] macros
In a message dated 21/11/2007 15:25:24 GMT Standard Time, [EMAIL PROTECTED] writes: I'm looking to write a little utility to record keypresses as macros, if necessary assigning them to a hotkey or altkey for later use. Some processes mean repeated strings of keypresses, so it may be handy to record these keypresses and replay them later with an alt or hot key to avoid typing the same commands repeatedly. Anyone have any idea how best to go about achieving this? -- Dilwyn Jones ___ QL-Users Mailing List http://www.q-v-d.demon.co.uk/smsqe.htm What about checking for the position of the pointer to the current input key queue. Even if the same key is pressed repeatedly the position of the buffer pointer moves which each character input. I used this when I wrote my screen saver to check for repeatedly pressed keys. sv_keyq=PEEK_L(SystemVariableBase+76) : REM pointer to keyboard queue NewKey=CheckKeys DEFine FuNction CheckKeys LOCal KeyPress REMark Returns 1 for keypress and 0 for no keypress BufPos=PEEK_L(sv_keyq) BufPos2=PEEK_L(BufPos+12) : REM last key pressed IF BufPos2=OldPos : KeyPress=0 IF BufPos2OldPos : KeyPress=1 OldPos=BufPos2 RETurn KeyPress END DEFine CheckKeys The value in Bufpos might be usable to get the key combination, if not sv_arbuf could be peeked to get the value. Duncan ___ QL-Users Mailing List http://www.q-v-d.demon.co.uk/smsqe.htm
Re: [Ql-Users] macros
Ah, this looks very promising - thanks. This helps with the problem of recognising identical consecutive keypresses via sv_arbuf. Noticing a keyboard buffer position change should help with this. Ideally, what I'd like to do is a little program which when you tell it to start recording, until you press a predefined key (e.g. CTRL S) to stop. The program may have the following options: 1 - Record keypresses to a named macro file e.g. enter filename, press given key such as CTRL B to Begin recording, CTRL S to stop recording 2 - Replay keypresses from named file e.g. enter filename, wait for given keypress such as CTRL B to Begin replaying until all of file replayed, recognising special keycodes like below as they are encountered. I foresee it would need a facility to enter pauses where required, e.g. to give a menu time to appear in a slow program, e.g. a keypress like CTRL P (Pause) which is ignored by most programs to insert a 1 second pause into the macro file. I would welcome ideas for other simple facilities to include. It was a suggestion for a program someone sent me recently and I was a bit surprised I couldn't think of an existing program which does this (knowing my luck someone will come back to me on this one and point out a suitable program on my website or in Quanta library!) -- Dilwyn Jones ___ QL-Users Mailing List http://www.q-v-d.demon.co.uk/smsqe.htm
Re: [Ql-Users] macros
Dilwyn Jones wrote: Ah, this looks very promising - thanks. I would welcome ideas for other simple facilities to include. It was a 1) Please let the macro file be human-readable rather than a binary dump. Easy to hand alter and debug! 2) Next version to include mouse-clicks too, eh ;-) I can think of ways to read them, but not to stuff them back into the inter-face. Regarding the other side of your project: what to do once youve recorded the data, I wrote a keyword that stuffs the keyboard queue. The syntax for STUFF is: STUFF -timeout% | code% | string$ [, -timeout% | code% | string$ ] * (optionally repeated) where: -timeout% is a negative integer from -1..-32k frames code% is a character code from 0..255 string$ is a qstring It uses legal traps and is supposed not to get confused by you changing keyboard queue midways.. You can find a copy on my website under Programs/Utilities/LX2. The zip file contains the STUFF_bin toolkit. Let me know if you can use it, with or without some modification. Per ___ QL-Users Mailing List http://www.q-v-d.demon.co.uk/smsqe.htm
Re: [Ql-Users] macros
Duncan, many thanks for that one - as long as you remove the PEEK_L from the sv_keyq= line to avoid a double PEEK_L it works well enough, though I can't make sense of the values in the queue itself - peek(bufpos2) or peek_w(bufpos2) returns almost random data, whereas if I use this routine to detect when to read sv_arbuf it seems to work OK and return ALT pressed or not in its first byte (255 or 0) and the code of key pressed in the second byte of sv_arbuf Any idea what values I SHOULD be finding in the queue? Or perhaps it's safer to do something like: IF NewKey THEN sv_arbuf = PEEK_L(SystemVariableBase+138) alt = PEEK(sv_arbuf) key = PEEK(sv_arbuf+1) END IF Even though I couldn't make sense of the data in the queue, this does seem to form the basis for a workable routine, so many thanks. -- Dilwyn Jones What about checking for the position of the pointer to the current input key queue. Even if the same key is pressed repeatedly the position of the buffer pointer moves which each character input. I used this when I wrote my screen saver to check for repeatedly pressed keys. sv_keyq=PEEK_L(SystemVariableBase+76) : REM pointer to keyboard queue NewKey=CheckKeys DEFine FuNction CheckKeys LOCal KeyPress REMark Returns 1 for keypress and 0 for no keypress BufPos=PEEK_L(sv_keyq) BufPos2=PEEK_L(BufPos+12) : REM last key pressed IF BufPos2=OldPos : KeyPress=0 IF BufPos2OldPos : KeyPress=1 OldPos=BufPos2 RETurn KeyPress END DEFine CheckKeys The value in Bufpos might be usable to get the key combination, if not sv_arbuf could be peeked to get the value. Duncan ___ QL-Users Mailing List http://www.q-v-d.demon.co.uk/smsqe.htm -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.503 / Virus Database: 269.16.1/1140 - Release Date: 19/11/2007 19:05 ___ QL-Users Mailing List http://www.q-v-d.demon.co.uk/smsqe.htm
Re: [Ql-Users] macros
I would welcome ideas for other simple facilities to include. It was a 1) Please let the macro file be human-readable rather than a binary dump. Easy to hand alter and debug! Should be easy enough - just have text equivalents to the keycodes, e.g. 232 represented by F1, 10 by ENTER etc and converted back to ASCII codes again to stuff to the program. 2) Next version to include mouse-clicks too, eh ;-) I can think of ways to read them, but not to stuff them back into the inter-face. In some cases they are represented by ASCII 1 and 2 (e.g. by MKEY%), not actually tried stuffing these codes though to see if these would work, though this was meant for keyboard control, since you couldn't drive the mouse to select a specific loose item or whatever. Regarding the other side of your project: what to do once youve recorded the data, I wrote a keyword that stuffs the keyboard queue. The syntax for STUFF is: STUFF -timeout% | code% | string$ [, -timeout% | code% | string$ ] * (optionally repeated) where: -timeout% is a negative integer from -1..-32k frames code% is a character code from 0..255 string$ is a qstring It uses legal traps and is supposed not to get confused by you changing keyboard queue midways.. You can find a copy on my website under Programs/Utilities/LX2. The zip file contains the STUFF_bin toolkit. Let me know if you can use it, with or without some modification. Ah, this sounds like it might be useful. Must admit I hadn't thought too much about this yet - was more concerned about how to record the keypresses which seemed a much bigger problem until Duncan's suggestion came along. -- Dilwyn Jones ___ QL-Users Mailing List http://www.q-v-d.demon.co.uk/smsqe.htm
Re: [Ql-Users] macros
Fair comment, though I'm not sure how to detect these combinations safely. I'd certainly make the start and stop keypresses configurable, though. -- Dilwyn Jones - Original Message - From: Tony Firshman [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, November 22, 2007 11:30 PM Subject: Re: [Ql-Users] macros Dilwyn Jones wrote: I foresee it would need a facility to enter pauses where required, e.g. to give a menu time to appear in a slow program, e.g. a keypress like CTRL P (Pause) which is ignored by most programs to insert a 1 second pause into the macro file. ... bit not all you infer. How about CTRL CTRL - that would be safer, and say ALT ALT to end. Neither of these I am sure are recognised by any other programs. Tony -- QBBS (QL fido BBS 2:257/67) +44(0)1442-828255 [EMAIL PROTECTED] http://firshman.co.uk Voice: +44(0)1442-828254 Fax: +44(0)1442-828255 Skype: tonyfirshman TF Services, 29 Longfield Road, TRING, Herts, HP23 4DG ___ QL-Users Mailing List http://www.q-v-d.demon.co.uk/smsqe.htm -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.503 / Virus Database: 269.16.1/1140 - Release Date: 19/11/2007 19:05 ___ QL-Users Mailing List http://www.q-v-d.demon.co.uk/smsqe.htm
Re: [Ql-Users] macros
In a message dated 22/11/2007 23:41:28 GMT Standard Time, [EMAIL PROTECTED] writes: Any idea what values I SHOULD be finding in the queue? Or perhaps it's safer to do something like: Hi Dilwyn, sadly I wrote that so long ago (1999) that while I assume I knew what I was doing then I dont know now what I was doing then. I could do some research on it to try to recall. It would be nicer to understand what should be happening. As you say it works and I have used it as a routine on aurora, Qx0, and QPC2. Duncan ___ QL-Users Mailing List http://www.q-v-d.demon.co.uk/smsqe.htm
[Ql-Users] macros
I'm looking to write a little utility to record keypresses as macros, if necessary assigning them to a hotkey or altkey for later use. Some processes mean repeated strings of keypresses, so it may be handy to record these keypresses and replay them later with an alt or hot key to avoid typing the same commands repeatedly. Anyone have any idea how best to go about achieving this? -- Dilwyn Jones ___ QL-Users Mailing List http://www.q-v-d.demon.co.uk/smsqe.htm
Re: [Ql-Users] macros
In message [EMAIL PROTECTED], Dilwyn Jones [EMAIL PROTECTED] writes Hi Dilwyn, I did something similar to what you aiming at some years ago now with recording the actions for controlling a robotic arm. I used an array - DIM statement - to store the keys being pressed, using different letters on the keyboard. Inside the program, the key presses were then converted to a binary number to output to the robotic arm. In this way, a user was able to input a sequence of their own choosing to drive the device. Once stored, this could be repeated over and over again. Another extension would be write the information to a file, and then be able to read it in again at some later time. I'm looking to write a little utility to record keypresses as macros, if necessary assigning them to a hotkey or altkey for later use. Some processes mean repeated strings of keypresses, so it may be handy to record these keypresses and replay them later with an alt or hot key to avoid typing the same commands repeatedly. Anyone have any idea how best to go about achieving this? -- Malcolm Cadman ___ QL-Users Mailing List http://www.q-v-d.demon.co.uk/smsqe.htm
Re: [Ql-Users] macros
Hi Dilwyn, I'm looking to write a little utility to record keypresses as macros, if necessary assigning them to a hotkey or altkey for later use. Some processes mean repeated strings of keypresses, so it may be handy to record these keypresses and replay them later with an alt or hot key to avoid typing the same commands repeatedly. Anyone have any idea how best to go about achieving this? My first thought would be hook in an interrupt handler to read the 'current key press' word from the system variable. But, my second thought was how to determine if it has changed especially when it is the same keypress as the one before. I'm too far away from my docs to be able to look them up at present, plus I have the boiler man in to fix the central heating. We had a new kitchen put in, a radiator removed and it stopped working. The original plumber says it wasn't removing the radiator that did it and doesn't want to know. He will not be getting paid I suspect! Good luck. Cheers, Norman. PS. Check Slow Gold source code for hooking in an interrupt handler. Also, there was a caps lock indicator program (Quanta?) a few years back. I think that did a similar thing. ___ QL-Users Mailing List http://www.q-v-d.demon.co.uk/smsqe.htm