StrokesPlus.net Forum
»
General Discussion
»
Scripts
»
A script sample that brings a set of frequently used programs to the foreground
Rank: Newbie
Groups: Approved
Joined: 2/21/2023(UTC) Posts: 2  Location: Seoul
|
This is a script sample that sequentially brings only the three programs HCL Notes, Designer, and Administrator to the foreground. Whenever the gesture is repeated, only the target programs come to the foreground repeatedly.
var matches; var forgTitle = ''; var LastNotesTitle = ''; var lastActiveTitle = ''; var targetTitle = ["HCL Notes", "HCL Domino Designer", "HCL Domino Administrator"]; //List of window title arrary to bring to foreground var titleMoveToLast; var isMatched; var fndIdx; var isBreak;
StrokesPlus.Console.Log("Start...");
forgTitle = sp.ForegroundWindow().Title; StrokesPlus.Console.Log("forground win==>" + forgTitle);
var isMatched = false; var fndIdx = -1; for (i = 0; i < targetTitle.length; i++) { if (forgTitle.match(targetTitle[i])) { isMatched = true; fndIdx = i; } }
if (isMatched) { LastNotesTitle = sp.StoreString('LastNotesTitle', targetTitle[fndIdx]); //save } else { LastNotesTitle = sp.GetStoredString('LastNotesTitle'); if (LastNotesTitle != '') { for (i = 0; i < targetTitle.length; i++) { if (LastNotesTitle.match(targetTitle[i])) { isMatched = true; fndIdx = i; } } } }
if (isMatched) { //Order the values up to the current position in the array by sending them to the end of the array. titleMoveToLast = ""; for (i = 0; i <= fndIdx; i++) { titleMoveToLast = targetTitle[0]; targetTitle.splice(0, 1); targetTitle.push(titleMoveToLast); } }
// var lastActiveTitle = sp.LastActiveWindow().Title; // StrokesPlus.Console.Log("last active window==>" + lastActiveTitle);
for (i = 0; i < targetTitle.length; i++) { StrokesPlus.Console.Log(targetTitle[i] + " 찾기..."); matches = sp.WindowsFromTitleRegex(targetTitle[i]); if (matches.Length > 0) { //found.. bring to forground StrokesPlus.Console.Log("found.."); for (j = 0; j < matches.Length; j++) { StrokesPlus.Console.Log('[' + j + ']handle==>' + matches[j].HWnd + '/title==>' + matches[j].Title + '/class==>' + matches[j].ClassName); } isBreak = false; for (j = 0; j < matches.Length; j++) { if (targetTitle[i] != "HCL Domino Administrator") { if (matches[j].ClassName == "SWT_Window0") { // rootwin = matches[0].RootWindow; // StrokesPlus.Console.Log("HWnd==>" + rootwin.HWnd + "/Title==>" + rootwin.Title + "/Class:" + rootwin.ClassName) // rootwin.BringToFront(); // rootwin.Maximize(); StrokesPlus.Console.Log('target handle==>' + matches[j].HWnd + '/title==>' + matches[j].Title + '/class==>' + matches[j].ClassName); matches[j].BringToFront(); matches[j].Maximize();
// sp.MouseMove(matches[j].Location); sp.StoreString('LastNotesTitle', targetTitle[i]);
isBreak = true; break; } } else { //need to find it by class name for Domino Administrators if (matches[j].ClassName == "NOTESframe") { // rootwin = matches[0].RootWindow; // StrokesPlus.Console.Log("HWnd==>" + rootwin.HWnd + "/Title==>" + rootwin.Title + "/Class:" + rootwin.ClassName) // rootwin.BringToFront(); // rootwin.Maximize(); StrokesPlus.Console.Log('target handle==>' + matches[j].HWnd + '/title==>' + matches[j].Title + '/class==>' + matches[j].ClassName); matches[j].BringToFront(); matches[j].Maximize();
// sp.MouseMove(matches[j].Location); sp.StoreString('LastNotesTitle', targetTitle[i]);
isBreak = true; break; } } }
if (isBreak) break; } }
|
---------------------------------- I am a Korean developer and I live in Seoul I'm crazy obsessed with mice. |
|
|
|
StrokesPlus.net Forum
»
General Discussion
»
Scripts
»
A script sample that brings a set of frequently used programs to the foreground
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