Rank: Advanced Member
Groups: Approved
Joined: 9/13/2018(UTC) Posts: 54 Thanks: 18 times Was thanked: 18 time(s) in 13 post(s)
|
Example of script to translate text in browser. Change "#auto/pl/" to your needs.Code:// SAVE CLIP
cliboard = saveClip();
// COPY
sp.SendKeys("^c");
sp.Sleep(50);
// RUN BROWSER OR ADD NEW TAB AND TRANSLATE
if (clip.ContainsText()) {
var text = clip.GetText();
var url = "https://translate.google.com/?hl=en&tab=wT#auto/pl/";
sp.RunProgram("rundll32.exe", "url.dll,FileProtocolHandler " + url + text, "", "", true, false, false); // launch the browser through the system
}
// RETURN CLIP
returnClip(cliboard);
and here clip functions i use: (i don't copy objects to clip so i don't have to store them)Code:// SAVE CLIPBOARD
function saveClip() {
if (clip.ContainsAudio()) { var Clip = clip.GetAudioStream(); sp.StoreNumber("savedClip", 1); }
else if (clip.ContainsFileDropList()) { var Clip = clip.GetFileDropList(); sp.StoreNumber("savedClip", 2); }
else if (clip.ContainsImage()) { var Clip = clip.GetImage(); sp.StoreNumber("savedClip", 3); }
else if (clip.ContainsText()) { var Clip = clip.GetText(); sp.StoreNumber("savedClip", 4); }
return Clip;
}
// RETURN CLIPBOARD
function returnClip(Clip) {
switch (sp.GetStoredNumber("savedClip")) {
case 1: clip.SetAudio(Clip); break;
case 2: clip.SetFileDropList(Clip); break;
case 3: clip.SetImage(Clip); break;
case 4: clip.SetText(Clip); break;
}
sp.DeleteStoredNumber("savedClip");
}
Edited by user Sunday, November 11, 2018 9:28:09 AM(UTC)
| Reason: Not specified
|
2 users thanked Yuichi 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