Sign in to follow this  
Followers 0
DimensionalPunk

Newb Onscreen Keybord

14 posts in this topic

I want to learn how to make an on-screen keyboard with AutoIt. I don't have any programming experience so this is all very new to me. I've figured out how to create keys for typing, but now I'm trying to make a button that is pushed down with the first click and released with the second. Right now I have a simple GUI for the ALT key to get pressed down but I don't know where to go from here. I would eventually like to be able to hold two buttons down at the same time, ie Shift & Alt. Could someone point me in the right direction?

; Learning OSK

#include <GUIConstants.au3>

GUICreate("OSK", 110, 40)

$YesID  = GUICtrlCreateButton("Alt", 0, 0, 110, 40)

GUISetState() ; display the GUI

Do
    $msg = GUIGetMsg()
   
    Select
        Case $msg= $YesID
            Send("{ALTDOWN}")
    EndSelect
Until $msg = $GUI_EVENT_CLOSE

Share this post


Link to post
Share on other sites



Use a "toggle" value:

; Learning OSK

#include <GUIConstants.au3>

GUICreate("OSK", 110, 40)

$YesID  = GUICtrlCreateButton("Alt", 0, 0, 110, 40)
$YesID_Toggle = 1
GUISetState() ; display the GUI

Do
    $msg = GUIGetMsg()
   
    Select
        Case $msg= $YesID
            If $YesID_Toggle Then
               Send("{ALTDOWN}")
            Else
               Send("{ALTUP}")
            EndIf
            $YesID_Toggle = Not $YesID_Toggle 

    EndSelect
Until $msg = $GUI_EVENT_CLOSE

Share this post


Link to post
Share on other sites

Thanks!

I've been trying to figure out how to change the button syle while it's being pressed, where do I put t the GUICtrlSetStyle ($button1, $BS_FLAT)?

I tried adding it right after Send("{ALTDOWN}") but it does nothing.

Share this post


Link to post
Share on other sites

GUICtrlCreateButton ( "text", left, top [, width [, height [, style [, exStyle]]]] )

From the helpfile, you'll want the Style (6th parameter).

Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Share this post


Link to post
Share on other sites

I'm still completely lost. I don't know how to use:

GUICtrlCreateButton ( "text", left, top [, width [, height [, style [, exStyle]]]] )

And all the _Mousehover examples are giving me errors when I try to run them.

Share this post


Link to post
Share on other sites

Make it look better with _Mousehover UDFs by marfdaman

(Check His Sig)

Share this post


Link to post
Share on other sites

I'm still completely lost. I don't know how to use:

And all the _Mousehover examples are giving me errors when I try to run them.

first get beta,

next GuiCtrlCreatebutton()

Text = is what you want the button to say

left = how far in from the left of the GUI window do you want it placed

Top= How far from top of the GUI window to place it

width(opt) = how wide to make it

Height(opt)= how tall to make it

Style(opt)= can modify how you want the button to look

Ex-Style(opt)=same as above

Note= (opt) means it is optional

Check the helpfile, or Here for more info on styles and other functions

Share this post


Link to post
Share on other sites

I'm still completely lost. I don't know how to use:

And all the _Mousehover examples are giving me errors when I try to run them.

If you tell us what kind of errors you are getting, then we could very likely help you solve them :D


Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Share this post


Link to post
Share on other sites

Installing the beta fixed the errors, thanks. Now I'm just trying to wrap my brain around it. I'll get it eventually, I'm an artist so my brain doesn't really work this way. I can't even use the memory button on a calculator. I'm determined to figure this out though. I've been wanting to learn simple programming for years. So far I've been much more successful with AutoIt than any other language I've tried.

Share this post


Link to post
Share on other sites

Installing the beta fixed the errors, thanks. Now I'm just trying to wrap my brain around it. I'll get it eventually, I'm an artist so my brain doesn't really work this way. I can't even use the memory button on a calculator. I'm determined to figure this out though. I've been wanting to learn simple programming for years. So far I've been much more successful with AutoIt than any other language I've tried.

DimensionalPunk,

Do yourself a huge favor an click on this link:

Welcome to AutoIt 1-2-3, Class... is now in Session

If you are just learning to program, don't start by letting yourself develop bad habits by just trying to wing it.

You will save a lot of time and frustration by following this tutorial. It wasn't around when I started using AutoIt. But I would have used it if it was.

taurus905


"Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs

Share this post


Link to post
Share on other sites

DimensionalPunk,

Do yourself a huge favor an click on this link:

Welcome to AutoIt 1-2-3, Class... is now in Session

If you are just learning to program, don't start by letting yourself develop bad habits by just trying to wing it.

You will save a lot of time and frustration by following this tutorial. It wasn't around when I started using AutoIt. But I would have used it if it was.

taurus905

Excellent, I'm on it. Thanks!

Share this post


Link to post
Share on other sites

Well, that didn't help at all. Thanks for everything guys but I think I'll stick to 3D Animation. Keep up the good work on AutoIt, the fact that I even got this far says a lot for it. I've tried learning other languages and this was by far the easiest.

Share this post


Link to post
Share on other sites

Well, that didn't help at all. Thanks for everything guys but I think I'll stick to 3D Animation. Keep up the good work on AutoIt, the fact that I even got this far says a lot for it. I've tried learning other languages and this was by far the easiest.

DimensionalPunk,

Maybe the 'Onscreen Keyboard' wasn't the best place to start programming for someone who is new to AutoIt. I'm glad that you did manage to learn something. Just keep AutoIt in mind in case you come across something else that may be easier for a first script.

Take care,

taurus905


"Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs

Share this post


Link to post
Share on other sites

No, I haven't given up on AutoIt. I have a very successful script working that automates my commercial deleting for my HTPC. I've just given up on trying to teach myself how to get these on-screen keyboard buttons the way I want them. You see I'm a self-taught freelance 3-D artist so I'm used to being able to pick up a program and teach it to myself. Unfortunately this has never been the case when it comes to programming.

I'm quadriplegic and I use a Quadjoy to control the mouse, (I've found that I can control it with my mouth faster than most people can do with their hand). But for pushing buttons I rely on on-screen keyboards. What I'm using now works fine, I was just hoping I could create my own someday. just so you know, I'm not looking for any sympathy help from you guys.

I see in CG forms all the time where somebody has an idea for a project but has no idea how to do it. They start a thread and expect the people in the forum to walk them through every single step. I usually think to myself when I see threads like these that the person isn't ready for that project. So this is just me noticing that I'm doing the same. I'm sure I'll be back on this forum asking for a tip on how to do a different script, but as for the on-screen keyboard I think I'll put it on the back burner. My brother-in-law is a programmer, so with a little help from him I might finish it someday. You guys rock and I refuse to waste your time on my premature expectations. See you in another thread. :D

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0