-
Assign keypress to specific action in powerpoint?
Hello there,
I’m looking for a way to help a disabled young boy. He’s learning to use two switches to be able to control the computer. For now he has to learn that both switches do different things. So I want to make a Powerpoint presentation in which the switches activate a different action.
For example: pressing switch 1 will activate button one at the presentation, which has the picture of a guitar on it and plays a guitar song when activated. Pressing switch 2 will activatie button two at the presentation, which had the picture of a piano on it and plays some piano music.
My problem is: this is not possible with Powerpoint itself and I don’t know anything about Visual Basic! I read something about keypress and keyup and keydown and I guess it has something to do with that. But how does it work?
I guess it should look like:
If keypress is enter, play sound 1
If keypress is space, play sound 2
Else, do nothing
Can someone help me with the code? I would be very gracious.
Jip
June 14th, 2011, 07:18 PM
-
Did a quick ppt
uses a text box to capture the control letter and 2 command buttons to fire the action
the buttons are not really required but look the part
the problem I have is getting the textbox to be the component that has the focus when the slide opens
if this can be done the rest of the code is a skoosh
NOTE a number of keys are used by ppt to move pages and turn backgrounds on and off and make the mouse vanish, so letter choices are limited. I used L and R on my left anf right buttons.
if some one can come forward with the textbox gets focus bit.
otherwise you need to click into the text box to activate the key functions
Code:
Private Sub Button1_Click()
TextBox1.BackColor = RGB(255, 0, 0)
End Sub
Private Sub Button2_Click()
TextBox1.BackColor = RGB(0, 255, 255)
End Sub
Private Sub TextBox1_Change()
If UCase(TextBox1.Text) = "A" Then
Button1_Click
End If
If UCase(TextBox1.Text) = "L" Then
Button2_Click
End If
TextBox1.Text = ""
End Sub
if you put textbox1 to the back of the slide and push it off the left a little you will not see the Ibar or the letters
hope this helps
June 17th, 2011, 02:07 PM
-
Thanx, this is a good start.
[QUOTE=the problem I have is getting the textbox to be the component that has the focus when the slide opens.
If this can be done the rest of the code is a skoosh
.....
if some one can come forward with the textbox gets focus bit.
otherwise you need to click into the text box to activate the key functions[/QUOTE]
However, the young man in question can not use the mouse. So he is not able to click on the textbox.
So I'm going to look how to get the focus automatically to the textbox. Now I know what I'm looking for. Thanks!
(Or maybe someone else knows the answer? )
June 18th, 2011, 09:08 AM
-
2 button keypress application
wrote a little vb6 thing for you... have a go and get back to me.
June 18th, 2011, 02:12 PM
-
Originally Posted by Incidentals
wrote a little vb6 thing for you... have a go and get back to me.
Great, this is what I'm looking for! I do understand the ini file, and the wav files. I changed some key's and all went well, exept for the enter key. Space worked fine, but pressing the enter key dit not what I expected. I assume I used the wrong word (just enter, tried return too).
I would love to see the VB script, but how? Can I import the .exe in VB (I tried but I got an error), or can you send it to me?
My user already has two switches. He knows how to use one and will be learning to use 2. I'm not sure yet which keypresses they simulate. But I guess at least space and enter, because most switches do. So I'd like to test these two.
(I live in the Netherlands by the way)
Thanks!
June 18th, 2011, 04:05 PM
-
the device will either show as key codes or ascii characters
i will add a box to show what your device generates
and i'll get the enter key for you
Have you tried simply opening a note pad and seeing what the devices does on the page?
it may expose the asc characters it returns , if not Iwill need to look at keycodes rather than keyascii... no biggy
here to talk
Last edited by Incidentals; June 18th, 2011 at 04:30 PM.
June 18th, 2011, 04:47 PM
-
Originally Posted by Incidentals
the device will either show as key codes or ascii characters
i will add a box to show what your device generates
and i'll get the enter key for you
Have you tried simply opening a note pad and seeing what the devices does on the page?
it may expose the asc characters it returns , if not Iwill need to look at keycodes rather than keyascii... no biggy
here to talk
I have attached the key/device tester as promised
June 19th, 2011, 01:34 AM
-
Originally Posted by Incidentals
I have attached the key/device tester as promised
Thanks, I will test it next friday, when I see this user again. I don't have the switches with me here.
Would it be possible to send the actual VB code? So I can see how it is build? I'd like to play around a bit with VB and Powerpoint to experiment with images etc.
June 24th, 2011, 01:12 AM
-
Originally Posted by jip2011
Thanks, I will test it next friday, when I see this user again. I don't have the switches with me here.
Would it be possible to send the actual VB code? So I can see how it is build? I'd like to play around a bit with VB and Powerpoint to experiment with images etc.
VB comes in many varieties these where vb6, the exe will run anywhere as they do not need any extra dlls, coms or ocxs . To edit the source you would need the appropriate version.
What version of vb do you have if any, other than VBA which is built into MSworks and MSoffice, and which MS version do you have?
here to talk
June 29th, 2011, 02:35 PM
-
Please, please, send me the code... It looks really great and I can not wait to test it and play with it.
Originally Posted by Incidentals
VB comes in many varieties these where vb6, the exe will run anywhere as they do not need any extra dlls, coms or ocxs . To edit the source you would need the appropriate version.
What version of vb do you have if any, other than VBA which is built into MSworks and MSoffice, and which MS version do you have?
here to talk
-
I'm havng same problem
Incidentals
I want to move powerpoint slides (right and left) on a wireless remote, which at the receiver side has
arduino connected to computer via USB cable.
Arduino is programmed to print "R" when given right input and "L" on left input(here to print means to give that alphabet as serial input to the computer).
I have a VB .exe along with .ini file, which is the software i found on a blog. But the .exe is working only
for right movement of slide and not for left.
Can anyone write the VB6 code for moving powerpoint slides right and left on receiving and two
alphabets via USB.
The .exe which i've got has options for selecting COM port which is in the .ini file ( frmicon.Text1.text=6 )
and it also asks for copying MSCOMM32.OCX file in system32 folder of Windows XP.
August 7th, 2017, 06:45 AM
-
Have you been successful in doing so?
I would like to play a sound file in PowerPoint with the help of keyboard keys and not mouse clicks.
For example, I have two images in a slide namely Image A and Image B which are blinking alternately, I also have two sound files namely C and D.
Now when image A is blinking if one presses a key on the keyboard sound C should play and if one does not do anything then after a defined number of blinks image B will start blinking, and when image B is blinking if one were to press a key on the keyboard, sound file D will play, however if one were to do nothing when image B is blinking then image A will start blinking again in a loop and so on and so forth.
Originally Posted by tanuj18
Incidentals
I want to move powerpoint slides (right and left) on a wireless remote, which at the receiver side has
arduino connected to computer via USB cable.
Arduino is programmed to print "R" when given right input and "L" on left input(here to print means to give that alphabet as serial input to the computer).
I have a VB .exe along with .ini file, which is the software i found on a blog. But the .exe is working only
for right movement of slide and not for left.
Can anyone write the VB6 code for moving powerpoint slides right and left on receiving and two
alphabets via USB.
The .exe which i've got has options for selecting COM port which is in the .ini file ( frmicon.Text1.text=6 )
and it also asks for copying MSCOMM32.OCX file in system32 folder of Windows XP.
August 8th, 2017, 09:28 PM
-
I have just seen your message and will get back to you as soon as I can... I will be travelling ... so it might take a day or two. I will need to check the original exe to see what I wrote its been a while.