Sign in to follow this  
Followers 0
Gene

Semi - OT How to call the Help File so as to get context sensitive help

11 posts in this topic

OK, I've got the GUI I've been working on running and not doing unexpected things. I found HelpMaker, a free Help Authoring tool. It creates .chm, .html & .hlp Help files. It took me all day today, but I got the Help file for the GUI done, it needs some polishing, but it is OK for beta. I've found a lot of info. on how to create a Help file, but nothing on how to call a help file and make it open to a specific place. Would someone point me. When a user presses the F1 key, I'd like the help file to open on info. relative to whatever control has the focus, instead of opening at the Overview and leaving them to figure out where they need to look. I have figured out that the Help Topic ID and the Help Context number are used, but I don't know how.

What do I want?

A- Tell me how

B- Point me at some examples that I can figure it out from

C- Point me at something to read, hopefully something that will get to the point

Oh, something else just occurred, if AutoIt is incapable of calling context sensitve help tell me so I don't waste too much time.


[font="Verdana"]Thanks for the response.Gene[/font]Yes, I know the punctuation is not right...

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Extract from a AutoIt project.

Func _ContextualHelp()
    If ProcessExists("KeyHH.exe") Then ProcessClose("KeyHH.exe")

    $sAutoItPath = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt", "InstallDir")

    If FileExists(@ScriptDir & "\CodeWizard.chm") Then
        Select
            Case GUICtrlRead($TAB) = 0;MessageBox Wizard
                Run($sAutoItPath & "\KeyHH.exe -CodeWizard -#klink msgbox CodeWizard.chm",@scriptDir,@SW_HIDE) 

            Case GUICtrlRead($TAB) = 1;InputBox Wizard
                Run($sAutoItPath & "\KeyHH.exe -CodeWizard -#klink inputbox CodeWizard.chm",@scriptDir,@SW_HIDE) 
                
            Case GUICtrlRead($TAB) = 2;SplashText Wizard
                Run($sAutoItPath & "\KeyHH.exe -CodeWizard -#klink splashtext CodeWizard.chm",@scriptDir,@SW_HIDE) 
                
            Case GUICtrlRead($TAB) = 3;SplashImage Wizard
                Run($sAutoItPath & "\KeyHH.exe -CodeWizard -#klink splashimage CodeWizard.chm",@scriptDir,@SW_HIDE) 

            Case GUICtrlRead($TAB) = 4;Colors Wizard
                Run($sAutoItPath & "\KeyHH.exe -CodeWizard -#klink colors CodeWizard.chm",@scriptDir,@SW_HIDE) 

            Case GUICtrlRead($TAB) = 5;Fonts/Cursors Wizard
                Run($sAutoItPath & "\KeyHH.exe -CodeWizard -#klink Fonts/Cursors CodeWizard.chm",@scriptDir,@SW_HIDE) 

        EndSelect
    Else
        #Region --- CodeWizard generated code Start ---
    ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK, Icon=Critical
        MsgBox(16,"CodeWizard","The HelpFile CodeWizard.chm doesn't exist in the directory " & @ScriptDir)
        #EndRegion --- CodeWizard generated code End ---
    EndIf
EndFunc  ;==>_ContextualsHelp
Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

per help

#include <GUIConstants.au3>

GUICreate("My GUI") ; will create a dialog box that when displayed is centered

GUISetHelp("notepad") ; will run notepad if F1 is typed


GUISetState ()    ; will display an empty dialog box

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend

in my useage

GUISetHelp(@ProgramFilesDir & "\Internet Explorer\iexplore.exe http://www.xpcleanmenu.hostrocket.com/Help%20Center/help.html")

couldn't this just be reset to the location per program area open???

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Extract from a AutoIt project.

Func _ContextualHelp()
    If ProcessExists("KeyHH.exe") Then ProcessClose("KeyHH.exe")

    $sAutoItPath = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt", "InstallDir")

    If FileExists(@ScriptDir & "\CodeWizard.chm") Then
        Select
            Case GUICtrlRead($TAB) = 0;MessageBox Wizard
                Run($sAutoItPath & "\KeyHH.exe -CodeWizard -#klink msgbox CodeWizard.chm",@scriptDir,@SW_HIDE) 

            Case GUICtrlRead($TAB) = 1;InputBox Wizard
                Run($sAutoItPath & "\KeyHH.exe -CodeWizard -#klink inputbox CodeWizard.chm",@scriptDir,@SW_HIDE) 
                
            Case GUICtrlRead($TAB) = 2;SplashText Wizard
                Run($sAutoItPath & "\KeyHH.exe -CodeWizard -#klink splashtext CodeWizard.chm",@scriptDir,@SW_HIDE) 
                
            Case GUICtrlRead($TAB) = 3;SplashImage Wizard
                Run($sAutoItPath & "\KeyHH.exe -CodeWizard -#klink splashimage CodeWizard.chm",@scriptDir,@SW_HIDE) 

            Case GUICtrlRead($TAB) = 4;Colors Wizard
                Run($sAutoItPath & "\KeyHH.exe -CodeWizard -#klink colors CodeWizard.chm",@scriptDir,@SW_HIDE) 

            Case GUICtrlRead($TAB) = 5;Fonts/Cursors Wizard
                Run($sAutoItPath & "\KeyHH.exe -CodeWizard -#klink Fonts/Cursors CodeWizard.chm",@scriptDir,@SW_HIDE) 

        EndSelect
    Else
        #Region --- CodeWizard generated code Start ---
    ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK, Icon=Critical
        MsgBox(16,"CodeWizard","The HelpFile CodeWizard.chm doesn't exist in the directory " & @ScriptDir)
        #EndRegion --- CodeWizard generated code End ---
    EndIf
EndFunc  ;==>_ContextualsHelp
Thanks, I'll smoke this over later today and respond when I'm sure I do or don't understand.

B)


[font="Verdana"]Thanks for the response.Gene[/font]Yes, I know the punctuation is not right...

Share this post


Link to post
Share on other sites

per help

#include <GUIConstants.au3>

GUICreate("My GUI"); will create a dialog box that when displayed is centered

GUISetHelp("notepad"); will run notepad if F1 is typed
GUISetState ()      ; will display an empty dialog box

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend

in my useage

GUISetHelp(@ProgramFilesDir & "\Internet Explorer\iexplore.exe http://www.xpcleanmenu.hostrocket.com/Help%20Center/help.html")

couldn't this just be reset to the location per program area open???

8)

I may have missed your point, I already have the .chm Help file opnening when F1 is pressed, but it just opens to the beginning. I want it to open to something relative to what the user is doing.

[font="Verdana"]Thanks for the response.Gene[/font]Yes, I know the punctuation is not right...

Share this post


Link to post
Share on other sites

i think this is great for an "automated" demonstration or help tutorial

http://www.autoitscript.com/forum/index.ph...&gopid=120907

8)

The subject of your link looks very interesting. I have downloaded the .au3 file. I'll look it over later today. Thanks for your time.


[font="Verdana"]Thanks for the response.Gene[/font]Yes, I know the punctuation is not right...

Share this post


Link to post
Share on other sites

I may have missed your point, I already have the .chm Help file opnening when F1 is pressed, but it just opens to the beginning. I want it to open to something relative to what the user is doing.

i was responding to this......

how to call a help file and make it open to a specific place. Would someone point me. When a user presses the F1 key, I'd like the help file to open on info. relative to whatever control has the focus

1 if the help file is open

you could close the help file like stated in gafrosts script ( first line )

then set the GUISetHelp() to run at the exact point/page you want

2 if the help file is not open

just "re-set" the GUISetHelp() to run at the exact point/page you want

under each area of your script

( thus if the user presses "F1" he will be sent to the correct help position )

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

@Gene,

Make sure you create an INDEX in the helpfile since thats what :

KeyHH.exe Helpfile -#klink Keyword is using.

We have done this a while back for AutoIt to enable editors like SciTE to automatically open the Helpfile on the CURRENT selected keyword.


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Extract from a AutoIt project.

Func _ContextualHelp()
    If ProcessExists("KeyHH.exe") Then ProcessClose("KeyHH.exe")

    $sAutoItPath = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt", "InstallDir")

    If FileExists(@ScriptDir & "\CodeWizard.chm") Then
        Select
            Case GUICtrlRead($TAB) = 0;MessageBox Wizard
                Run($sAutoItPath & "\KeyHH.exe -CodeWizard -#klink msgbox CodeWizard.chm",@scriptDir,@SW_HIDE) 

            Case GUICtrlRead($TAB) = 1;InputBox Wizard
                Run($sAutoItPath & "\KeyHH.exe -CodeWizard -#klink inputbox CodeWizard.chm",@scriptDir,@SW_HIDE) 
                
            Case GUICtrlRead($TAB) = 2;SplashText Wizard
                Run($sAutoItPath & "\KeyHH.exe -CodeWizard -#klink splashtext CodeWizard.chm",@scriptDir,@SW_HIDE) 
                
            Case GUICtrlRead($TAB) = 3;SplashImage Wizard
                Run($sAutoItPath & "\KeyHH.exe -CodeWizard -#klink splashimage CodeWizard.chm",@scriptDir,@SW_HIDE) 

            Case GUICtrlRead($TAB) = 4;Colors Wizard
                Run($sAutoItPath & "\KeyHH.exe -CodeWizard -#klink colors CodeWizard.chm",@scriptDir,@SW_HIDE) 

            Case GUICtrlRead($TAB) = 5;Fonts/Cursors Wizard
                Run($sAutoItPath & "\KeyHH.exe -CodeWizard -#klink Fonts/Cursors CodeWizard.chm",@scriptDir,@SW_HIDE) 

        EndSelect
    Else
        #Region --- CodeWizard generated code Start ---
    ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK, Icon=Critical
        MsgBox(16,"CodeWizard","The HelpFile CodeWizard.chm doesn't exist in the directory " & @ScriptDir)
        #EndRegion --- CodeWizard generated code End ---
    EndIf
EndFunc  ;==>_ContextualsHelp
Thank you for the Function, I've used some aspects of it. Until I found the KeyWorks documentation and figured out what a #klink was and what the function of the '-CodeWizard' was I was lost.

I created 2 small functions one to create the command line and one to call the Help file. They are below:

Func _SetHelpTopic()
   $sScrptDir = FileGetShortName(@ScriptDir)
   $sKeyHH = $sScrptDir & "\KeyHH.EXE -MyHelp -#klink "
   $sHelpFile = $sScrptDir & "\stoplighttimer.chm"
   $sHelpCommand = $sKeyHH & $sHelpTopic & " " & $sHelpFile
EndFunc  ;==>_SetHelpTopic


Func SL_GeneralHelp()
   If $sTimerStarted = "Y" Then Return
   $sHelpFilePathName = FileGetShortName(@ScriptDir & "\StopLightTimer.chm")
   If @error = 1 Then MsgBox(0, "Information", "FileGetShortName() failed ")
   $sCmdLine = @ComSpec & " /c " & "start " & $sHelpCommand
   $sFlag = @SW_MINIMIZE
   Run($sCmdLine, "", $sFlag)
EndFunc  ;==>SL_GeneralHelp

When I get to the point of removing extraneous code and commented message boxes I'll probably move the last line of function 1 to be the first line of function 2.

Then near the beginning:

HotKeySet("{F1}", "SL_GeneralHelp")

Then in the GuiGetMsg Select Case tree, at the top of every case except Exit, I have

for the TABs:

If $sVar = 0 Then $sHelpTopic = '"Timing Operation"'
If $sVar = 1 Then $sHelpTopic = '"StopLight Type; Stoplight location;Sound Volume"'
...
If $sVar = 4 Then $sHelpTopic = '"Add Names; Add Activities"'

for regular Case entries:

Case $msg = $SaveNewNmeBtn
     $sHelpTopic = '"Add Names"'
     _SetHelpTopic()
    ...

Case $msg = $Max_Time
     $sHelpTopic = '"Timing Operation#MaxTime"'
     _SetHelpTopic()
     ...

Case $msg = $SLT_Std
     $sHelpTopic = '"Stoplight Type"'
     _SetHelpTopic()
     ...

and so forth...

I tried using GuiSetHelp(), but kept having problems, it was probably my fault. What I'm using is working great. It is reactive in that the user gets help focused on the last thing they touched, figuratively speaking. In my experience, folks don't think about help until something they didn't expect happens.


[font="Verdana"]Thanks for the response.Gene[/font]Yes, I know the punctuation is not right...

Share this post


Link to post
Share on other sites

i was responding to this......

1 if the help file is open

you could close the help file like stated in gafrosts script ( first line )

then set the GUISetHelp() to run at the exact point/page you want

2 if the help file is not open

just "re-set" the GUISetHelp() to run at the exact point/page you want

under each area of your script

( thus if the user presses "F1" he will be sent to the correct help position )

8)

Thanks for the example.

One of the things I discovered is that if you are using keyhh.exe instead of hh.exe. Just call the new index location (with the same syntax as gafrost's function) and it will open the new location in the already open window, it doesn't open a new instanxce of the Help file. I gave an example of what I did in my response to gafrost. I'm very happy with the way it is working, but I'm open to other ideas. :o

I also mentioned my experience with GUIsetHelp() B)


[font="Verdana"]Thanks for the response.Gene[/font]Yes, I know the punctuation is not right...

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