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

Notification

Icon
Error

Options
Go to last post Go to first unread
Jobssal  
#1 Posted : Thursday, February 23, 2023 3:42:44 AM(UTC)
Jobssal

Rank: Newbie

Reputation:

Groups: Approved
Joined: 2/21/2023(UTC)
Posts: 2
Korea, Republic Of
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.
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.