Rank: Advanced Member
Groups: Approved
Joined: 3/30/2019(UTC) Posts: 74 Thanks: 8 times Was thanked: 1 time(s) in 1 post(s)
|
Google Search Enhanced Edition Add a regular matching websites. URL can be opened directly by adding regular matching websites, . Because the website is too complex, you may need to revise it further.Code:sp.SendKeys("^c");
var tmp = clip.GetText();
var reg = /([\w-]+\.)+[\w- ]+.([^a-z])(\/[\w-: ./?%&=]*)?|[a-zA-Z\-\.][\w- ]+.([^a-z])(\/[\w-: ./?%&=]*)?/;
if(reg.test(tmp)){
sp.RunProgram("chrome.exe", tmp, "open", "normal", true, false, false);
}
else{
var tem = "https://www.baidu.com/s?ie=UTF-8&wd="+tmp.replace(' ', '+');
sp.RunProgram("chrome.exe", tem, "open", "normal", true, false, false);
}
|
|
|
|
Rank: Advanced Member
Groups: Approved
Joined: 3/30/2019(UTC) Posts: 74 Thanks: 8 times Was thanked: 1 time(s) in 1 post(s)
|
Dear Rob, when I search for "chrome. exe" with this script, it turns out to be "chrome. exe /". I don't know what caused an extra "/". Can you give me some guidance or suggestions?
|
|
|
|
Rank: Administration
Groups: Translators, Members, Administrators Joined: 1/11/2018(UTC) Posts: 1,360 Location: Tampa, FL Thanks: 28 times Was thanked: 421 time(s) in 357 post(s)
|
"chome.exe" matches your regex, so it thinks it's a website and is trying to send you to "http://chrome.exe/".
I believe the "/" is being added by Chrome in the address bar.
|
1 user thanked Rob for this useful post.
|
|
|
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