Being a long suffering Windows user, I have developed a mouse habit that I would now like to break, relying more on keyboard shortcuts. But the trouble is that every Windows application introduces yet another set of keyboard shortcuts to remember...
This CUFP hovers above other windows and as you switch between applications it displays a relevant list of shortcut reminders.
use strict; use warnings; use Tk; use Win32::API; # Windows constants my ($ONTOP, $NOTOP, $TOP) = (-1, -2, 0); my ($SWP_NOMOVE, $SWP_NOSIZE) = (2, 1); my $SetWindowPos = new Win32::API("user32", "SetWindowPos", 'NN +NNNNN', 'N'); my $FindWindow = new Win32::API("user32", "FindWindow", 'PP', + 'N'); my $GetForegroundWindow = new Win32::API("user32", "GetForegroundWindo +w",'','N'); my $GetWindowText = new Win32::API("user32", "GetWindowText",'NP +I','I'); my $fg = 0; # foreground hWnd my $flashme = 'Waiting to show shortcut keys'; my $w = new MainWindow; my $fc = $w->Label(-textvariable => \$flashme, -justify => 'left')->pa +ck; my $id = Tk::After->new($w,2000,'repeat',\&showFlashCard); my $flashcards = { 'Microsoft Outlook' => qq{Outlook CTRL-1 - Mail CTRL-2 - Calendar CTRL-4 - Task List CTRL-Y - Go to Folder... CTRL-E - Find... ALT-F1 - Toggle Nav Pane CTRL-SHIFT-V - Move Items to Folder... }, 'SQL Query Analyzer' => qq{Query Analyzer CTRL-D - Results as datagrid CTRL-T - Results as text CTRL-R - Toggle Results Pane CTRL-L - Execution Plan F8 - Toggle Object Browser CTRL-SHIFT-P - Open File }, 'Mozilla Firefox' => qq{Mozilla FireFox CTRL-L - Location CTRL-D - Add Bookmark CTRL-B - Bookmarks } }; # start the UI MainLoop; sub showFlashCard { my $thisfg = $GetForegroundWindow->Call(); if ($fg != $thisfg) { # Foreground Window has changed $fg = $thisfg; my $wt=' 'x150; my $i = $GetWindowText->Call($fg,$wt,150); $wt = substr($wt, 0, $i); #warn "$fg\t$wt\n"; # use this to ascertain window text for my $re (keys %$flashcards) { if ($wt =~ /$re/) { $flashme = $flashcards->{$re}; } } } # Reestablish Z order my $class = "TkTopLevel"; my $topHwnd = $FindWindow->Call($class, $w->title); $topHwnd and $SetWindowPos->Call($topHwnd, $ONTOP, 0, 0, 0, 0, $SW +P_NOMOVE | $SWP_NOSIZE); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Hovering keyboard shortcut reminders for Win32 apps
by dmorgo (Pilgrim) on Jul 17, 2004 at 03:25 UTC | |
|
Re: Hovering keyboard shortcut reminders for Win32 apps
by mrborisguy (Hermit) on May 16, 2005 at 20:29 UTC |