Welcome Guest.   Make a donation to an author on the site September 30, 2014, 08:52:42 AM  *

Please login or register.
Or did you miss your validation email?


Login with username and password (forgot your password?)
Why not become a lifetime supporting member of the site with a one-time donation of any amount? Your donation entitles you to a ton of additional benefits, including access to exclusive discounts and downloads, the ability to enter monthly free software drawings, and a single non-expiring license key for all of our programs.


You must sign up here before you can post and access some areas of the site. Registration is totally free and confidential.
 
The N.A.N.Y. Challenge 2012! Download dozens of custom programs!
   
   Forum Home   Thread Marks Chat! Downloads Search Login Register  
Pages: [1]   Go Down
  Reply  |  New Topic  |  Print  
Author Topic: IDEA: program menu printing  (Read 4897 times)
ares09x
Charter Member
***
Posts: 5


see users location on a map View Profile WWW Give some DonationCredits to this forum member
« on: March 11, 2009, 02:12:17 PM »

Greetings,

Perhaps this program already exists, but I have not yet found it ...

A friend of mine asked me to print out all of the menus in a particular program (in this case, it was MSN Premium) and write out explanations of what each of them does.  I would like to have a program that is capable of printing all of the menus that another program makes available in some kind of outline form, even just plain text, so that I can annotate each one with additional information.  I know that I can go through manually and capture the menu pages using something like SnagIt, and add annotations, but that seems like a very manual process to go through for a lot of menus.

As an example, the results for the File menu for MSN might look like this:

File
   • New
  • Mail Message - Ctrl+N
  • Window - Ctrl+Shift+N
  • Appointment - Ctrl+Shift+A
  • Contact - Ctrl+Shift+C
   • Open... - Ctrl+O
   • Save As...
   • Appointment - Ctrl+Shift+A
   • Copy E-mail...
   • Print... - Ctrl+P
   • Print Preview...
   • Send Link by E-mail
   • Close - Alt+F4

I would want to invoke the program and then point it to a .exe file, or else drop a desktop shortcut onto its desktop shortcut to generate an output - it would ask what the output's filename should be and where it should be stored (maybe with some default?).  There might be some options like the format of the output (eg, .txt, RTF, Excel/CSV, etc), but I'd love to start with something basic that will generate this kind of output automatically.

Any ideas about existing programs, or how hard it would be to create such a program?

Thanks,
Bob Y.
« Last Edit: March 11, 2009, 09:22:23 PM by ares09x » Logged
mmdoogie
Supporting Member
**
Posts: 14



View Profile WWW Give some DonationCredits to this forum member
« Reply #1 on: April 07, 2009, 11:20:34 PM »

You might want to give the EXE a look with one of these first.
http://angusj.com/resourcehacker/
http://www.wilsonc.demon.....uk/d10resourceeditor.htm

One way menus can be stored is as resources in the EXE.
If its done this way, there should be a entries for the menus; however, there are lots of other ways to make menus work too.

Its been a while since I've used either, so I don't remember how easy it is to copy the info out, but I think you can save it as a text file or copy and paste it or something.

From the program side, I have an idea of how to go about it, but don't really have time to mash it out right now.
For the other coders out there: with WINAPI you can use GetCursorPos to get the cursor position, then WindowFromPoint to get the hWnd for the window under that point.  From there, you can do GetMenu to get the hMenu.  Then, just recurse through the menu structures to print out the names.

Hope this helps.

--matt
Logged
mouser
First Author
Administrator
*****
Posts: 33,409



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #2 on: April 08, 2009, 08:53:58 AM »

It's a nice idea to use a resource editor, but it probably wont help you too much with menus..

Another thing you could do is record a screencast movie of you opening all the menus, and then just print the frames of your choice (or send them the video if that is sufficient).

It would'nt be too hard to use a screenshot program like Screenshot Captor to capture an image of each menu in turn using a hotkey.. i still think that still might be your best way to go.  So pulldown menu, hit hotkey, pulldown next menu, hit hotkey, etc.. Sometimes the manual approaches are the most efficient.  You'd just want to make sure you have Screenshot Captor configured in the autosave mode so it doesn't prompt you after each screenshot.

Logged
skrommel
Fastest code in the west
Developer
***
Posts: 882



View Profile WWW Give some DonationCredits to this forum member
« Reply #3 on: April 08, 2009, 07:17:13 PM »

 smiley Try GetMenus!

Press F1 to extract the menus of the active window to a text file.

Skrommel

[copy or print]
;GetMenus.ahk
; Press F1 to extract the menus of the active window to a text file
;Skrommel @ 2009

#SingleInstance,Force
SetBatchLInes,-1
AutoTrim,Off


F1::
WinGet,hWnd,ID,A
wholemenu=
space=
hMenu:=DllCall("user32\GetMenu","UInt",hWnd)
GETMENU(hMenu)
FileDelete,%A_Temp%\Menus.txt
FileAppend,%wholemenu%,%A_Temp%\Menus.txt
Run,%A_Temp%\Menus.txt
Return


GETMENU(hMenu)
{
  nMaxCount=100
  uFlag:=0x0400  ;MF_BYPOSITION
  global wholemenu
  global space

  menuitemcount:=DllCall("GetMenuItemCount",UInt,hMenu)
  Loop,%menuitemcount%
  {
    nPos:=A_Index-1
    VarSetCapacity(lpString,100,0) ; line inserted on 2008-02-18 -- Hope you dont mind Skrommel! - Moderator!
    length:=DllCall("user32\GetMenuString","UInt",hMenu,"UINT",nPos,"STR",lpString,"int",nMaxCount,"UINT",uFlag)
    wholemenu=%wholemenu%%nPos%%A_Tab%%space%%lpString%`n
    hSubMenu:=DllCall("user32\GetSubMenu","UInt",hMenu,"int",nPos)
    If hSubMenu>-1
    {
      Loop,3
        space=%space%%A_Space%
      GETMENU(hSubMenu)
      StringTrimRight,space,space,3
    }
  }
  Return
}
Logged

Please stop by my site at  1 Hour Software by skrommel  for downloads and more info.
cranioscopical
Friend of the Site
Supporting Member
**
Posts: 4,170



see users location on a map View Profile Read user's biography. Give some DonationCredits to this forum member
« Reply #4 on: April 08, 2009, 09:04:26 PM »

Brilliant!  thumbs up thumbs up
Logged

Chris
mouser
First Author
Administrator
*****
Posts: 33,409



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #5 on: April 08, 2009, 10:45:30 PM »

Don't encourage him chris -- he's making the rest of us coders look bad!
Logged
lanux128
Global Moderator
*****
Posts: 6,100



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #6 on: April 09, 2009, 09:23:04 PM »

Try GetMenus!

Press F1 to extract the menus of the active window to a text file.

great script! i didn't know this was even possible. thumbs up
Logged

skrommel
Fastest code in the west
Developer
***
Posts: 882



View Profile WWW Give some DonationCredits to this forum member
« Reply #7 on: April 10, 2009, 04:21:57 AM »

 embarassed You guys...

Skrommel
Logged

Please stop by my site at  1 Hour Software by skrommel  for downloads and more info.
ares09x
Charter Member
***
Posts: 5


see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #8 on: June 09, 2009, 11:32:33 AM »

Thanks, Skrommel, that's great  Thmbsup - sorry I didn't get back sooner, I've been busy with some University teaching recently Sad.

Since I'm a complete noob about this, what do I send the .ahk file to???  I bet there's an easy answer, and I would love to try this out ...

Best regards,
ares09x (aka Bob Y.)
Logged
lanux128
Global Moderator
*****
Posts: 6,100



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #9 on: June 09, 2009, 08:16:40 PM »

@ares09x: you have to download & install AutoHotKey then copy the above code and save it as <whatevername>.ahk and execute this ahk file.
Logged

ares09x
Charter Member
***
Posts: 5


see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #10 on: June 09, 2009, 08:17:57 PM »

Thanks, lanux128.
Logged
Pages: [1]   Go Up
  Reply  |  New Topic  |  Print  
 
Jump to:  
   Forum Home   Thread Marks Chat! Downloads Search Login Register  

DonationCoder.com | About Us
DonationCoder.com Forum | Powered by SMF
[ Page time: 0.172s | Server load: 0.9 ]