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

Notification

Icon
Error

Options
Go to last post Go to first unread
soooulp  
#1 Posted : Friday, February 26, 2021 11:36:00 AM(UTC)
soooulp

Rank: Advanced Member

Reputation:

Groups: Moderators, Approved
Joined: 4/23/2020(UTC)
Posts: 161
China

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.
UserPostedImage
Rob  
#2 Posted : Monday, March 1, 2021 2:42:50 PM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 1,359
United States
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.
Users browsing this topic
Guest
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.