How to open a help file in the same path as procedure file?
jjweimer
Suppose that I load a procedure file. I can expose it from the menu selection. I can click on the ? icon to see information about it. That information includes its path.
How do I get the path information to the procedure file?
I want to use that path information to open the Help file for the procedure, where the help file should be in the same path (folder) as the procedure file.
Does FunctionPath help?
December 10, 2021 at 02:37 pm - Permalink
I do it like this:
OpenHelp /INT=0/Z ParseFilePath(1, FunctionPath(""), ":", 1, 0) + "MyHelpFile.ihf"
December 10, 2021 at 03:04 pm - Permalink
Thanks. This does it in a broad approach.
if (ParamIsDefault(modName))
modName = ""
endif
string fldrPath, helpfile = helpName + ".ihf"
fldrPath = ParseFilePath(1,FunctionPath(modName + funcName),":",1,0)
NewPath/Z/Q/O procName, fldrPath
OpenHelp/P=procName helpfile
//KillPath/Z procName
return 0
end
I might suggest the need for a ProcedurePath(procName) function to return a corresponding path string to a loaded procedure file.
December 10, 2021 at 03:23 pm - Permalink
Oh! A blank input to FunctionPath gets the path to the current function. Of course! Thanks Tony.
December 10, 2021 at 03:36 pm - Permalink
Just wanted to point out that an empty string input to FunctionPath will retrieve the path for the currently executing function's proc file. So, your GetHelp function should be in the same proc file that you want to retrieve the help for... but this is probably obvious.
December 10, 2021 at 06:46 pm - Permalink
In reply to Thanks. This does it in a… by jjweimer
GetWindow /Z $strWin file
return StringFromList(1, S_value) + StringFromList(0, S_value)
end
December 11, 2021 at 01:16 am - Permalink
Gosh Tony. Your making this too easy for WaveMetrics. :-)
December 11, 2021 at 06:00 am - Permalink
It just dawned on me that you want to show a help file that's in a folder alongside your procedure file. Perhaps your procedure file is somewhere outside the Igor User Files folder, but if it is inside the Igor Procedures folder or User Procedures folder in the User Files folder, DisplayHelpTopic will find your help file. DisplayHelpFile does a brute-force search of all the folders in the Igor Pro Folder and User Files folder. The first time to find your file can be lengthy, but once it finds it once, it's open and it will find it quickly the next time.
December 13, 2021 at 11:45 am - Permalink
As AG just pointed out to me in a private email, DisplayHelpFile does not exist. I meant DisplayHelpTopic.
December 14, 2021 at 03:44 pm - Permalink