trids Posted December 19, 2003 Posted December 19, 2003 << Resurrection of tip from previous board >>Ever been editing a script and wanted a quick confirmation of the parameters to a function? You need Context Sensitive Help! Here is an excellent solution (thanks to Cyberslug) using TextPad as the editor.METHOD:1. Save the following script:;--------------------------------------------------------------------- ; ContextHelp.au3 ; --------------- ; Get help on the selected AutoIt keyword (eq: from within TextPad). ; Create a user-defined tool for TextPad with ; Command: <path to AutoIt3.exe> ; Parameters: <path to this script enclosed in quotes> $SelWord ;--------------------------------------------------------------------- ;Process input parameters If $CmdLine[0] = 1 Then ;get the context keyword, sent in from TextPad $sKeyword = $CmdLine[1] Else ;Didn't send a keyword, so just display main help Run(@WindowsDir & "\hh.exe ""mk:@MSITStore:d:\Program%20Files\AutoIt3\AutoIt.chm::/html/functions.htm""") Exit EndIf $sHelp = "mk:@MSITStore:d:\Program%20Files\AutoIt3\AutoIt.chm::/html/functions/" & $sKeyword & ".htm" If WinExists("AutoIt Help") Then ;Help was up already, so pass it the new keyword to go find WinActivate("AutoIt Help") Send("!{SPACE}j") ;call up the search target box ControlSetText("", "", "Edit1", $sHelp ) Send("{ENTER}") Else ;Help wasn't open yet, so start it up at the right place. Run(@WindowsDir & "\hh.exe " & """" & $sHelp & """") EndIf2. In TextPad, create a tool which executes your local AutoIt3.exe and passes two parameters: the full path and filename of the above script (in quotes); followed by a space; then the TextPad parameter $SelWord. Create a shortcut key for the tool - eg: Alt+F2TO USE:Open an AutoItv3 script in TextPadhighlight a puzzling AutoItv3 functionPress your hotkey (Alt+F2 for me)Help for the command pops up!Have fun
Developers Jos Posted December 19, 2003 Developers Posted December 19, 2003 Great script Cyberslug/cmallett I used it together with my Crimson editor setup... This is needed in the Crimson editor: 1. Open Preferences dialog box and select User Tools page 2. Select an empty slot and fill with the following arguments. - Menu Text: AutoIT Context Help - Command: YOURSCRIPTDIR\ContextHelp.exe - Argument: $(CurrWord) - Initial dir: $(FileDir) - Hot key: F1 - Close on exit: Yes - Save before execute: No Thanks, Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Valik Posted December 19, 2003 Posted December 19, 2003 (edited) Here is a modified version of the original script. Upon attempting to use the original, I noticed the author had embedded the path to the help file. Here is a revised version that alleviates this problem. I tried to make this as non-intrusive as I could. This version first tries to get the path to the help file from the registry. It looks for the install directory that AutoIt's installer sets up. It then assumes the file name. If that fails, it looks for a different registry entry that the script may have set up, if it finds it, it tries that path. If those fail, then the last resort is to simply ask the user where the help file is located. This path is saved to the registry for future reference so that the user isn't prompted every time they try to get help. Watch for word wrap... expandcollapse popup;--------------------------------------------------------------------- ; ContextHelp.au3 ; --------------- ; Get help on the selected AutoIt keyword (eq: from within TextPad). ; Create a user-defined tool for TextPad with ; Command: <path to AutoIt3.exe> ; Parameters: <path to this script enclosed in quotes> $SelWord ;--------------------------------------------------------------------- $szPathToHelp = GetHelpPath() ;Process input parameters If $CmdLine[0] = 1 Then ;get the context keyword, sent in from TextPad $sKeyword = $CmdLine[1] Else ;Didn't send a keyword, so just display main help Run(@WindowsDir & "\hh.exe ""mk:@MSITStore:" & $szPathToHelp & "::/html/functions.htm""") Exit EndIf $sHelp = "mk:@MSITStore:" & $szPathToHelp & "::/html/functions/" & $sKeyword & ".htm" If WinExists("AutoIt Help") Then ;Help was up already, so pass it the new keyword to go find WinActivate("AutoIt Help") Send("!{SPACE}j");call up the search target box ControlSetText("", "", "Edit1", $sHelp ) Send("{ENTER}") Else ;Help wasn't open yet, so start it up at the right place. Run(@WindowsDir & "\hh.exe " & """" & $sHelp & """") EndIf FUNC GetHelpPath() ; First attempt is to look for the AutoIt 3 install in the registry $szPath = RegRead("HKEY_LOCAL_MACHINE\Software\Hiddensoft\AutoIt3", "InstallDir") IF @error = 0 THEN $szPath = $szPath & "\AutoIt.chm" IF NOT(FileExists($szPath)) THEN SetError(1) ENDIF ENDIF ; Second attempt is looking for a key we may have written earlier (This isn't something AutoIt sets, but us) IF NOT(@error = 0) THEN $szPath = RegRead("HKEY_CURRENT_USER\Software\Hiddensoft\AutoIt3", "PathToHelp") IF @error = 0 THEN IF NOT(FileExists($szPath)) THEN SetError(1) ENDIF ENDIF ENDIF ; Third attempt is to have the user select the help file, which will then be saved to the registry IF NOT(@error = 0) THEN $szPath = FileOpenDialog("Please Select AutoIt.chm", "", "AutoIt.chm (*.chm)", 3) IF @error THEN MsgBox(4144, "Error", "Couldn't find AutoIt help file") Exit(-1) ENDIF ; The file will exist or the script will never get this far, so just write this path to the registry so we don't have to ; prompt the user every time RegWrite("HKEY_CURRENT_USER\Software\Hiddensoft\AutoIt3", "PathToHelp", "REG_SZ", $szPath) ENDIF RETURN $szPath ENDFUNC Edited December 19, 2003 by Valik
CyberSlug Posted December 19, 2003 Posted December 19, 2003 Here is a modified version of the original script. Upon attempting to use the original, I noticed the author had embedded the path to the help file.Yep, it was quick and dirty. Thank you for posting a more general/robust solution, Valik And thanks again to Trids for the original idea http://www.textpad.com/forum/viewtopic.php?t=4762 Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Developers Jos Posted December 21, 2003 Developers Posted December 21, 2003 (edited) Just created a script that decompiles the standard Autoit helpfile, then generates an INDEX.hhc and then recompiles it to AutoIt.chm.This now makes the HELP function in editors a lot easier and you can use builtin facilities like in SourceEdit.For Source Edit:Click on Help then Custom Help File and add Autoit.chmNow click CTRL+F1 on any keyword and it will jump right to it.For Crimson :1. Open Preferences dialog box and select User Tools page2. Select an empty slot and fill with the following arguments.- Menu Text: AutoIT Context Help- Command: Your-AutoIt-Dir\AutoIt.chm- Argument: $(CurrWord)- Initial dir: $(FileDir)- Hot key: F1- Close on exit: Yes- Save before execute: NoNow click F1 on any keyword and it will jump right to it.If anybody is interested i can make this helpfile or script available.Jos Edited December 21, 2003 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
trids Posted December 22, 2003 Author Posted December 22, 2003 If anybody is interested i can make this helpfile or script available... I'm interested. In both the script AND the help file, please Jos!
Developers Jos Posted December 22, 2003 Developers Posted December 22, 2003 Trids,Just uploaded it to http://groups.yahoo.com/group/AutoItList/files/AU3/MISC/ file genindex.zip. The file contains the script and the generated Helpfile. Let me know when you need more info...Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
CyberSlug Posted December 22, 2003 Posted December 22, 2003 Just uploaded it to http://groups.yahoo.com/group/AutoItList/files/AU3/MISC/ file genindex.zip. The file contains the script and the generated Helpfile.Works on XP, but I needed to change one line--added the .exe extension:runwait('cmd /c "C:\Program Files\HTML Help Workshop\HHC.exe" autoitn.hhp')Just put it in a directory containting the AutoIt.chm and run.This is quite helpful, JdeB Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now