Page 1 of 1

Quick Search and more...

Posted: 19 Jan 2017 10:17
by shpkong
My first Xyplorer script... :)

Add some keywords to Quick Search: cp=controlpanel, gg=google, wiki=wikipedia, bd=baidu, xyfc=xyplorer form.

You can use "gg:roger federer" to search for news about roger Federer use google web searchengine and "cp:uninstall" to search "uninstall" inside control panel.

Current the websearch only support 4 sites: google, Wikipedia, baidu and xyplorer form. Maybe you can add more by yourselves. :)

All the things is done by Xyplorer itself, I just call them...

P.S. I do not search very carefully inside the form about whether some one else has already posted a script like this before, if so, please delete this post, thank you.

Re: Quick Search and more...

Posted: 19 Jan 2017 10:46
by highend
Congratulations for your first script!

May I suggest at least three things?

You should add a XY version check to make sure that the script is usable (the switch command was only added
recently with v17.30.0002)

Your regex pattern is very... expressive :)
You can make it a bit shorter and more readable:

Code: Select all

"^(cp|gg|wiki|bd|xyfc):"
Your switch case test for "" could be done (better) with the default: at the end of it like:

Code: Select all

...
        case "xyfc:":
            goto "http://www.xyplorer.com/xyfc/search.php?keywords=" . $command;
            break;
        default:
            goto "<curpath>" . "?" . $in;
    }