StrokesPlus.net
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
shoichit  
#1 Posted : Monday, February 8, 2021 2:31:24 AM(UTC)
shoichit

Rank: Newbie

Reputation:

Groups: Approved
Joined: 1/31/2021(UTC)
Posts: 8
United States
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. BigGrin Thank you in advance.
Rob Otter  
#2 Posted : Wednesday, February 10, 2021 5:33:00 AM(UTC)
Rob Otter

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 10/26/2020(UTC)
Posts: 50
Germany
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.
thanks 1 user thanked Rob Otter for this useful post.
shoichit on 2/14/2021(UTC)
Rob  
#3 Posted : Wednesday, February 10, 2021 8:47:04 PM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 1,349
United States
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.
thanks 1 user thanked Rob for this useful post.
shoichit on 2/14/2021(UTC)
shoichit  
#4 Posted : Sunday, February 14, 2021 9:13:04 PM(UTC)
shoichit

Rank: Newbie

Reputation:

Groups: Approved
Joined: 1/31/2021(UTC)
Posts: 8
United States
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

thanks 1 user thanked shoichit for this useful post.
Rob on 2/15/2021(UTC)
Rob  
#5 Posted : Wednesday, February 17, 2021 3:41:00 PM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 1,349
United States
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.
Users browsing this topic
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.