Rank: Advanced Member
Groups: Moderators, Approved Joined: 4/23/2020(UTC) Posts: 161 Thanks: 46 times Was thanked: 23 time(s) in 17 post(s)
|
Telegram can’t active when it is closed and run in the background by using the following code, but it can active normally by the RunOrActivate function. I need to active Telegram from the background and select the first chat. So could you share the RunOrActivate function code. Code:
var wndx = sp.WindowsFromTitlePartial("Telegram (");
if(wndx.Count() === 0) {
sp.RunOrActivate('C:\\Users\\Administrator\\Downloads\\Compressed\\Telegram Desktop\\Telegram.exe');
sp.Sleep(5500) ;
sp.SendKeys("{Down}");
sp.Sleep(100) ;
sp.SendKeys("{Enter}");
} else {
if(sp.ForegroundWindow().HWnd.ToString() !== wndx.First().HWnd.ToString()) {
wndx.First().Activate();
}
}
This is the screenshot when active from running in the background.
|
|
|
|
Rank: Administration
Groups: Translators, Members, Administrators Joined: 1/11/2018(UTC) Posts: 1,359 Location: Tampa, FL Thanks: 28 times Was thanked: 419 time(s) in 356 post(s)
|
Honestly, this will have to be something custom, as each app chooses how to manage their own windows. Meaning, you will need to determine the correct way to accomplish this.
I downloaded Telegram portable, so I can try to assist, but I have no one to send me a message :)
I will send you a PM.
|
|
|
|
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