AutoHotkey Community

It is currently May 27th, 2012, 3:00 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 9 posts ] 
Author Message
PostPosted: March 19th, 2010, 12:08 am 
Offline

Joined: February 19th, 2010, 8:07 pm
Posts: 614
Hi guys.

I just finished the first stage of my program HotShow.
The program simply displays hotkeys pressed in a very elegant window, for use in video tutorials.

Is a personal project. I will use it to create video tutorials but I thought it might come handy to other people as well and actually maybe you can extract any code that you would like to use for other purposes.

The Background image can be downloaded from here:
http://img153.imageshack.us/img153/3006/bgblue.png

Or just use the compiled version which has it integrated.
Compiled version can be downloaded from here:
http://www.megaupload.com/?d=QKXVENJO

Code:
/*
         -------------------------------------------------------
                        HotShow 1.0
         -------------------------------------------------------

         This program will show any pressed key or combination
         of keys on screen in a very elegant way.
         
         Perfect for people who creates video tutorials
         and want to show which hotkeys they press during
         a demostration of the software being used.

----[Author]--------------------------------------------------------
This program was created by RaptorX
Thanks to Tidbit and Titan for help in some of the functions
----[Features]------------------------------------------------------
Right now the program is in its basic form.
Features will be added soon, Please read the To Do  list
----[TODO]----------------------------------------------------------
Customization of:
-Background Image
-Transparency settings
-Fade in/Fade out settings
-Window Positioning options
--------------------------------------------------------------------
*/
#SingleInstance Force
#NoEnv
OnExit, Clean

FileInstall, BG-Blue.png, BG-Blue.png, 1

Gui, +owner +AlwaysOnTop +Disabled +Lastfound -Caption
Gui, Color, FFFFFF
Gui, Add, Picture,,BG-Blue.png
WinsetTitle,Background
Winset, transcolor, FFFFFF 0

Gui, 2: +Owner +AlwaysOnTop +Disabled +Lastfound -Caption
Gui, 2: Color, 026D8D
Gui, 2: Font, Bold s15 Arial
Gui, 2: Add, Text, Center CWhite W250 vHotkeys,
WinsetTitle,HotkeyText
Winset, transcolor, 026D8D 0

Gui, Show, Hide
Gui, 2: Show, Hide

Loop, 95
{
   key := Chr(A_Index + 31)
   Hotkey, ~*%key%, Display
}

Display:
If A_ThisHotkey =
   Return

mods = Ctrl,Shift,Alt,LWin,RWin
prefix =

Loop, Parse, mods,`,
{
   GetKeyState, mod, %A_LoopField%
   If mod = D
      prefix = %prefix%%A_LoopField% +
}

StringTrimLeft, key, A_ThisHotkey, 2
if key=%a_Space%
   key=Space
Gosub, Show
Return

Show:
Alpha=0
Duration=150
Imgx=23
Imgy=630

GuiControl, 2: Text, Hotkeys, %prefix% %key%
Gui, Show, x%imgx% y%imgy% NoActivate
imgx-=10
imgy+=15
Gui, 2: Show, x%imgx% y%imgy% NoActivate

Gosub, Fadein
Sleep 2000
Gosub, Fadeout
Gui, Hide
Gui, 2: Hide
Return

Fadein:
Loop, %duration%
{
   Alpha+=255/duration
   Winset, transcolor, FFFFFF %Alpha%, Background
   Winset, transcolor, 026D8D %Alpha%, HotkeyText
}
Return

Fadeout:
Loop, %duration%
{
   Alpha-=255/duration
   Winset, transcolor, FFFFFF %Alpha%, Background
   Winset, transcolor, 026D8D %Alpha%, HotkeyText
}
return

Clean:
FileDelete, BG-Blue.png
ExitApp

~*Esc::Goto, Clean

/*
-[Created By]-------------------------------------------------------
                   -RaptorX-
                  
This project can be modified or copied, for personal or commercial
uses provided that you mention the original author.
--------------------------------------------------------------------
*/


As I said this is just a quick code for my personal use but i plan to make it more customizable... different backgrounds, fade times, position and all the other parameters.

Feel free to suggest features or even optimize the code since i am not a great coder yet. :D

Code Update:
---------------------------------------------------------------------------

Code:
/*
         -------------------------------------------------------
                        HotShow 1.0
         -------------------------------------------------------

         This program will show any pressed key or combination
         of keys on screen in a very elegant way.
         
         Perfect for people who creates video tutorials
         and want to show which hotkeys they press during
         a demostration of the software being used.

----[Author]--------------------------------------------------------
This program was created by RaptorX
Thanks to Tidbit and Titan for help in some of the functions
----[Features]------------------------------------------------------
Right now the program is in its basic form.
Features will be added soon, Please read the To Do  list
----[TODO]----------------------------------------------------------
Customization of:
-Background Image
-Transparency settings
-Fade in/Fade out settings
-Window Positioning options
-A Function that if the program detects a word instead of a shortcut it will wait for what you typed and then display the whole word/sentence at once.
--------------------------------------------------------------------
*/
#SingleInstance Force
#NoEnv
OnExit, Clean

FileInstall, BG-Blue.png, BG-Blue.png, 1 ;Background Image
FileInstall, BG-Red.png, BG-Red.png, 1

;These are the windows for the background image, created to be able to create the fade in / fade out effects
Gui, +owner +AlwaysOnTop +Disabled +Lastfound -Caption
Gui, Color, FFFFFF
Gui, Add, Picture,,BG-Red.png
WinsetTitle,Background
Winset, transcolor, FFFFFF 0

Gui, 2: +Owner +AlwaysOnTop +Disabled +Lastfound -Caption
Gui, 2: Color, 026D8D
Gui, 2: Font, Bold s15 Arial
Gui, 2: Add, Text, Center CWhite W250 vHotkeys,
WinsetTitle,HotkeyText
Winset, transcolor, 026D8D 0

Gui, Show, Hide
Gui, 2: Show, Hide

;End of background windows, both are hidden until we press a key

;This loop includes all the alphanumerical characters using the ascii code.
; Code 32 = Space until code 127 = Delete
Loop, 95
{
   key := Chr(A_Index + 31)
   Hotkey, ~*%key%, Display
}

Loop, 24 ;Support for function Keys F1-F24
{
   Hotkey, ~*F%a_index%, Display
}

Hotkey, ~*Numpad0, Display ;Adding Numpad0
Loop, 9 ;Support for Numpad Numbers
{
   Hotkey, ~*Numpad%a_index%, Display
}

NumpadKeys=NumpadDiv,NumpadMult,NumpadAdd,NumpadSub,NumpadEnter ; Support for Numpad operands.

Loop, Parse, NumpadKeys,`,
{
   Hotkey, ~*%a_loopfield%, Display
}

Otherkeys=Tab,Enter,Esc,BackSpace,Del,Insert,Home,End,PgUp,PgDn,Up,Down,Left,Right,ScrollLock,CapsLock,NumLock,Pause

Loop, parse, Otherkeys, `,
{
   Hotkey, ~*%a_loopfield%, Display
}

Display:
If A_ThisHotkey =
   Return

;Msgbox, %a_thishotkey%

mods = Ctrl,Shift,Alt,LWin,RWin
prefix =

Loop, Parse, mods,`,
{
   GetKeyState, mod, %A_LoopField%
   If mod = D
      prefix = %prefix%%A_LoopField% +
}

StringTrimLeft, key, A_ThisHotkey, 2
if key=%a_Space%
   key=Space
Gosub, Show
Return

Show:
Alpha=0
Duration=150
Imgx=23
Imgy=630

GuiControl, 2: Text, Hotkeys, %prefix% %key%
Gui, Show, x%imgx% y%imgy% NoActivate
imgx-=10
imgy+=15
Gui, 2: Show, x%imgx% y%imgy% NoActivate

Gosub, Fadein
Sleep 2000
Gosub, Fadeout
Gui, Hide
Gui, 2: Hide
Return

Fadein:
If faded=1 ;Do not fade if the window already faded in.
{
   Winset, transcolor, FFFFFF 255, Background
   Winset, transcolor, 026D8D 255, HotkeyText
   return
}

Loop, %duration% ; Fade in routine.
{
   Alpha+=255/duration
   Winset, transcolor, FFFFFF %Alpha%, Background
   Winset, transcolor, 026D8D %Alpha%, HotkeyText
   faded=1
}
Return

Fadeout:
Loop, %duration% ; Fade out routine
{
   Alpha-=255/duration
   Winset, transcolor, FFFFFF %Alpha%, Background
   Winset, transcolor, 026D8D %Alpha%, HotkeyText
   faded=0
}
return

Clean:
FileDelete, *.png
ExitApp

~*Esc::Goto, Clean
Pause::Suspend, toggle
/*
-[Created By]-------------------------------------------------------
                   -RaptorX-
                  
This project can be modified or copied, for personal or commercial
uses provided that you mention the original author.
--------------------------------------------------------------------
*/


Last edited by RaptorX on April 19th, 2010, 8:23 am, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 19th, 2010, 3:01 am 
Offline

Joined: March 10th, 2008, 12:55 am
Posts: 1907
Location: Minnesota, USA
quite handy :_)

you know my suggestions, but here they are again:
  • F1-F12 support
  • numberpad support
  • Mouse support
  • Popup at mouse (offset a bit) instead of fixed position.
  • better update system (can easily out-type this version).


ps, sites that have a "wait" like megaupload & rapidshare are lame. use a better host, like http://www.Autohotkey.net or one of the many other good upload sites.

_________________
rawr. be very afraid
*poke*
Note: My name is all lowercase for a reason.
"I think Bigfoot is blurry, that's the problem. It's not the photographer's fault, Bigfoot is blurry. So there's a large, out-of-focus monster roaming the countryside."


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 19th, 2010, 8:32 pm 
Offline

Joined: June 17th, 2008, 7:51 am
Posts: 243
tidbit wrote:
quite handy :_)

you know my suggestions, but here they are again:
  • F1-F12 support
  • numberpad support
  • Mouse support
  • Popup at mouse (offset a bit) instead of fixed position.
  • better update system (can easily out-type this version).

ps, sites that have a "wait" like megaupload & rapidshare are lame. use a better host, like http://www.Autohotkey.net or one of the many other good upload sites.

Yes, very nice. And I agree with tidbit. Plus
  • Enterkey support
  • Cursorkey support
  • Specialkey support (Tab, Del, BS, Home...)

_________________
Greetings
Rog


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 26th, 2010, 6:59 pm 
Offline

Joined: February 19th, 2010, 8:07 pm
Posts: 614
Good, I will be working on that soon, I will make it optional to have the window display at mouse position and I will for sure add support for the other keys. Thanks for the feed back guys!


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Update
PostPosted: April 19th, 2010, 8:22 am 
Offline

Joined: February 19th, 2010, 8:07 pm
Posts: 614
The code was updated, support for numpad keys, arrows and other buttons like home, insert, delete was added.

Removed fade in when a previous key was pressed, that removes the out-typing problem but still if you type too fast you wont be able to see what you wrote because it will be too fast.

I will add functionality that if the program detects a word instead of a shortcut it will wait for what you typed and then display the whole word/sentence at once.

Support for mouse clicks will be added soon.
Code updated in the Original Post.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: August 13th, 2011, 7:10 am 
Code:
FileDelete, *.png

...WOW...do you know how dangerous that line is?

1st of all, why delete all the pngs on exit anyway?

2nd, why delete ALL pngs?...instead of listing the ones you created?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: August 13th, 2011, 3:36 pm 
that only works on the working directory, so basically only the png's that i created are the ones deleted.

Besides that is a little old code... i am sure i made tons of mistakes :)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: August 14th, 2011, 12:47 am 
-RaptorX- wrote:
that only works on the working directory

...yes, so if my working dir is the Desktop...or somewhere else important, it would wipe all the pngs.

-RaptorX- wrote:
Besides that is a little old code... i am sure i made tons of mistakes :)

...I've been watching Blender Tutorials on YouTube & people have been neglecting to say what keys they are pressing, so I wanted to make a "Key OSD"...but then I decided to Google 1st & found this & one other script. I was about to download your code, to test it out, then I saw that line & decided not to try it yet, not without going over every line & making sure it was safe.

Just FYI: that "bgblue.png" on imageshack.us is failing now.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: September 1st, 2011, 11:50 am 
Offline

Joined: February 19th, 2010, 8:07 pm
Posts: 614
Anonymous wrote:
-RaptorX- wrote:
that only works on the working directory

...yes, so if my working dir is the Desktop...or somewhere else important, it would wipe all the pngs.

-RaptorX- wrote:
Besides that is a little old code... i am sure i made tons of mistakes :)

...I've been watching Blender Tutorials on YouTube & people have been neglecting to say what keys they are pressing, so I wanted to make a "Key OSD"...but then I decided to Google 1st & found this & one other script. I was about to download your code, to test it out, then I saw that line & decided not to try it yet, not without going over every line & making sure it was safe.

Just FYI: that "bgblue.png" on imageshack.us is failing now.


i will upload a newer version of the script soon. maybe you will want to take a look at that one. :D

thanks for pointing out i will update it.

_________________
Main Project: AutoHotkey Toolkit
Unless specified otherwise all my code is written for the latest Autohotkey L Unicode version.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Kirtman, Rseding91 and 14 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group