Rank: Newbie
Groups: Approved
Joined: 1/31/2021(UTC) Posts: 8 Location: Liberty Lake Thanks: 4 times Was thanked: 1 time(s) in 1 post(s)
|
It would be great if "Script Help" has a search function. I often have to look for a function and I have to go into each section "Extensions", "Files" and so on when I can't guess what section it would belong to. For example, if I can search by a word like "registry", I can find any occurrences in the help. That would be much easier to find related functions. BTW, it looks like the Help is generated from "Resources.resources" under "Resources" folder. Is there any way to convert this to text format or HTML so I can open it with a text editor to search? I can open the resource file as is but it is not reader-friendly. Thank you in advance.
|
|
|
|
Rank: Advanced Member
Groups: Approved
Joined: 10/26/2020(UTC) Posts: 50 Location: Darmstadt Thanks: 15 times Was thanked: 2 time(s) in 2 post(s)
|
I second that. Would be a big help as you often do not know in which category to search for a specific function.
|
1 user thanked Rob Otter for this useful post.
|
|
|
Rank: Administration
Groups: Translators, Members, Administrators Joined: 1/11/2018(UTC) Posts: 1,349 Location: Tampa, FL Thanks: 28 times Was thanked: 416 time(s) in 354 post(s)
|
I've added a function in 0.4.1.5 which returns the help data in a JSON string and shows a message box with one method. If someone else doesn't get to it first, I'll probably expand this to include using an HTMLWindow to provide search functionality against the data. Code:var jsh = JSON.parse(sp.GetHelpJson());
sp.MessageBox(`Files Section:
Name: ${jsh.SectionFiles.Name}
Description: ${jsh.SectionFiles.Description}
Method: ${jsh.SectionFiles.Methods.GetFileVersionInfo.Name}
Description: ${jsh.SectionFiles.Methods.GetFileVersionInfo.Description}
Returns: ${jsh.SectionFiles.Methods.GetFileVersionInfo.Returns}
Parameter: ${jsh.SectionFiles.Methods.GetFileVersionInfo.Parameters.filePath.Name}
Description: ${jsh.SectionFiles.Methods.GetFileVersionInfo.Parameters.filePath.Description}
Type: ${jsh.SectionFiles.Methods.GetFileVersionInfo.Parameters.filePath.Type}
`, "Example");
Obviously, you could iterate the object and search, etc. Use clip.SetText(sp.GetHelpJson()); then paste it here to see the full result in an easy to browse format.
|
1 user thanked Rob for this useful post.
|
|
|
Rank: Newbie
Groups: Approved
Joined: 1/31/2021(UTC) Posts: 8 Location: Liberty Lake Thanks: 4 times Was thanked: 1 time(s) in 1 post(s)
|
Thank you. This is exactly what I needed!!! For anyone using emacs org-mode, you can use this code to create an org-mode table from the output. I save the clipboard contents and open it in Emacs. Pressing C-c C-c will adjust the table width. (You can then save it so you don't have to do C-c C-c everytime) Code:function get_help_contents () {
var jsh = JSON.parse(sp.GetHelpJson());
var text,desc, ex;
function check_for_linebreak (str) {
return str.replace (/\r\n/g, "|\r\n|||");
//return str.replace (/\r\n/g, "|\r\n|");
}
text = "; -*-eval: (progn (org-mode)(toggle-truncate-lines)); -*-\r\n|-|-|-|\r\n";
for (let i in jsh) {
desc = check_for_linebreak (jsh [i].Description) ;
text += `| *Name: ${jsh [i].Name}* |*Description*|${desc}`;
for (let t in jsh [i].Methods) {
desc = check_for_linebreak (jsh[i].Methods [t].Description);
ex = check_for_linebreak (jsh[i].Methods [t].SimpleExample);
text += `
||*Method*|${jsh[i].Methods [t].Name}|
||*Description*| ${desc}|
||*Returns*| ${jsh[i].Methods [t].Returns}|
||*Parameter*| ${jsh[i].Methods [t].Parameters}|
||*Example*| ${ex}|
|-|-|-|`;
}
text += "\r\n|-|-|-|\r\n";
}
clip.SetText(text);
}
Edited by user Sunday, February 14, 2021 11:15:50 PM(UTC)
| Reason: Not specified
|
1 user thanked shoichit for this useful post.
|
|
|
Rank: Administration
Groups: Translators, Members, Administrators Joined: 1/11/2018(UTC) Posts: 1,349 Location: Tampa, FL Thanks: 28 times Was thanked: 416 time(s) in 354 post(s)
|
Don't forget to add something like below for Properties (I didn't test the script below at all): Code:for (let p in jsh [i].Properties) {
// Only some objects have properties, but should be included
desc = check_for_linebreak (jsh[i].Properties [p].Description);
ex = check_for_linebreak (jsh[i].Properties [p].SimpleExample);
text += `
||*Method*|${jsh[i].Properties [p].Name}|
||*Description*| ${desc}|
||*Type*| ${jsh[i].Properties [p].Type}|
||*Example*| ${ex}|
|-|-|-|`;
}
Also in looking at this, I realized I missed the Type property for Properties objects - fixed in 0.4.1.6.
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.
Important Information:
The StrokesPlus.net Forum uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close