 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
RaptorX
Joined: 19 Feb 2010 Posts: 580
|
Posted: Thu Mar 18, 2010 11:08 pm Post subject: [HotShow 1.0] - OSD Hotkeys for Video Tutorials |
|
|
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.
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 Mon Apr 19, 2010 7:23 am; edited 1 time in total |
|
| Back to top |
|
 |
tidbit
Joined: 09 Mar 2008 Posts: 1807 Location: Minnesota, USA
|
Posted: Fri Mar 19, 2010 2:01 am Post subject: |
|
|
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.
Even monkeys fall from trees. - Japanese proverb |
|
| Back to top |
|
 |
ruespe
Joined: 17 Jun 2008 Posts: 243
|
Posted: Fri Mar 19, 2010 7:32 pm Post subject: |
|
|
| 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 |
|
| Back to top |
|
 |
RaptorX
Joined: 19 Feb 2010 Posts: 580
|
Posted: Fri Mar 26, 2010 5:59 pm Post subject: |
|
|
| 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! |
|
| Back to top |
|
 |
RaptorX
Joined: 19 Feb 2010 Posts: 580
|
Posted: Mon Apr 19, 2010 7:22 am Post subject: Update |
|
|
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. |
|
| Back to top |
|
 |
Guest
|
Posted: Sat Aug 13, 2011 6:10 am Post subject: Re: [HotShow 1.0] - OSD Hotkeys for Video Tutorials |
|
|
...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? |
|
| Back to top |
|
 |
-RaptorX- Guest
|
Posted: Sat Aug 13, 2011 2:36 pm Post subject: |
|
|
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  |
|
| Back to top |
|
 |
Guest
|
Posted: Sat Aug 13, 2011 11:47 pm Post subject: |
|
|
| -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. |
|
| Back to top |
|
 |
RaptorX
Joined: 19 Feb 2010 Posts: 580
|
Posted: Thu Sep 01, 2011 10:50 am Post subject: |
|
|
| 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.
thanks for pointing out i will update it. _________________ • Main Project: AutoHotkey Toolkit |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|