in Education by
My script launches a MS Edge window and then tries to log into Netflix with my credentials. The problem is, at times, the browser window comes up behind the CMD console and the script doesn't work. How do I launch the browser in the foreground or bring it to the foreground after it's launched? <!-- : rem @Echo Off Set "usr_name=#####" Set "usr_pass=#####" %SystemRoot%\System32\cscript.exe //NoLogo "%~f0?.wsf" "%browser%" "%usr_name%" "%usr_pass%" Exit /B --> Dim ObjShell, MyChrome Set ObjShell = WScript.CreateObject("WScript.Shell") MyChrome = Chr(34) & WScript.Arguments(0) & Chr(34) ObjShell.Run MyChrome & "--app=""https://www.netflix.com/login""", 1 WScript.Sleep 5000 ObjShell.SendKeys "{TAB}" ObjShell.SendKeys "{TAB}" ObjShell.SendKeys(WScript.Arguments(1)) ObjShell.SendKeys "{TAB}" ObjShell.SendKeys(WScript.Arguments(2)) ObjShell.SendKeys "{ENTER}" WScript.Sleep 6000 ObjShell.SendKeys "{ESCAPE}" ObjShell.SendKeys "{TAB}" WScript.Sleep 1000 ObjShell.SendKeys "{TAB}" WScript.Sleep 1000 ObjShell.SendKeys "{ENTER}" WScript.Sleep 6000 ObjShell.SendKeys "%{F4}" JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
Scripts that depend on SendKeys are notoriously unreliable. A more reliable approach is to control the browser with Seleniumbasic and Chrome driver or use WebView2 in a C# program. Barring that, one option for adding window control functionality to your existing script is to use the command line tool Cmdow. For example: ObjShell.Run "cmdow ""Netflix*"" /MAX",1,False Update: You can also try the built-in AppActivate method: ObjShell.AppActivate "Netflix"

Related questions

0 votes
    I have a task coming up where I have to manually enter an HKEY_USER key value and string value for ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 3, 2022 in Education by JackTerrance
0 votes
    I am trying to understand why the first line of my batch file fails to execute. My code is as ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 2, 2022 in Education by JackTerrance
0 votes
    I am trying to understand why the first line of my batch file fails to execute. My code is as ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 8, 2022 in Education by JackTerrance
0 votes
    I am trying to understand why the first line of my batch file fails to execute. My code is as ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 7, 2022 in Education by JackTerrance
0 votes
    I am trying to understand why the first line of my batch file fails to execute. My code is as ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 26, 2022 in Education by JackTerrance
0 votes
    Is it possible to use both JScript and VBScript in the same HTA? Can I call VBScript functions from ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 27, 2022 in Education by JackTerrance
0 votes
    Is it possible to use both JScript and VBScript in the same HTA? Can I call VBScript functions from ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 26, 2022 in Education by JackTerrance
0 votes
    ____ is used to fill the selected area with gradient blend of the foreground and background colors. (a) Blend tool ... (d) Rotate tool Select the correct answer from above options...
asked Dec 23, 2021 in Education by JackTerrance
0 votes
    A canvas can have a foreground color in Python? (Yes/No) 1. Yes 2. No...
asked Nov 26, 2020 in Technology by JackTerrance
0 votes
    Which is meant by assuming any two neighboring that are both edge pixels with consistent orientation? (a) Canny edge ... d) None of the mentioned Please answer the above question....
asked Oct 22, 2022 in Education by JackTerrance
0 votes
    Hello I am using native UITableViewCell in my UITableView. When I set the image of the cell it looks ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 10, 2022 in Education by JackTerrance
0 votes
    Can anyone tell me what is edge node in Hadoop? Select the correct answer from above options...
asked Jan 10, 2022 in Education by JackTerrance
0 votes
    Suppose this page is perpendicular to a uniform magnetic field and the magnetic flux through it is 5 wb. If the page is ... 5. 5.8 wb Select the correct answer from above options...
asked Nov 25, 2021 in Education by JackTerrance
0 votes
    Compute the charge enclosed by a cube of 2m each edge centered at the origin and with the ... proposed by,electromagnetic theory engineering physics,electromagnetic theory nptel...
asked Nov 11, 2021 in Education by JackTerrance
...