Braina Forums

Braina Assistant => Braina and Braina PRO Support => Topic started by: demond0jones on Feb 03, 2017, 12:37 AM

Title: Batch files not executing (login batch script)
Post by: demond0jones on Feb 03, 2017, 12:37 AM
I am attempting to use a log in batch script that works when I double click the script but not when I attempt to use it as a custom command. 

Steps:

1. Created custom command: Check my gmail
2. Entered custom command: open C:\Users\AccountName\Software\Braina Scripts\GmailLogin.bat

Again, the script does work if double clicked and use to work in another Virtual Assistant.  I am having difficulty executing with Braina.


The batch script:

@echo off
start https://sawnee.smarthub.coop/Login.html#login:
:WScript.Sleep 3000
:Set a = createobject("wscript.shell")
:a.SendKeys "Username"
:a.SendKeys "{TAB}"
:a.SendKeys "Password"
:a.SendKeys "{ENTER}"
FindStr "^:" "%~sf0">temp.vbs & cscript //nologo temp.vbs & del temp.vbs
Title: Re: Batch files not executing (login batch script)
Post by: saurav on Feb 03, 2017, 08:29 AM
 Try Open "C:\Users\AccountName\Software\Braina Scripts\GmailLogin.bat" (note that the filepaths containing spaces should be enclosed within double quotes)
Title: Re: Batch files not executing (login batch script)
Post by: demond0jones on Feb 04, 2017, 12:01 AM
The command you recommended will open still only open the link.  It is as if the command is only carrying out part of the batch file which is go to that particular website; the rest of the command fails to execute.  Any suggestions?
Title: Re: Batch files not executing (login batch script)
Post by: saurav on Feb 04, 2017, 07:25 AM
@demond0jones Seems like you are using vbscript in a batch file. You may try following command cmd: Start C:\Users\AccountName\Software\Braina Scripts\GmailLogin.bat Note that in this case double quotes are not there

Also you are sending keystrokes which can be also achieved using Braina's in-built feature of keystrokes emulation: https://www.brainasoft.com/braina/automate-keystrokes.html
Title: Re: Batch files not executing (login batch script)
Post by: demond0jones on Feb 05, 2017, 03:39 PM
It would appear that the keystrokes work well; however, will the ability to run batch scripts be resolved?  Also, and this could also be user error on my on my part but I am having difficulty using the {APPACTIVATE WindowTitle} keystroke for browsers.  I have tried the following:

{APPACTIVATE firefox}
{APPACTIVATE firefox.exe}
{APPACTIVATE internet explorer}
{APPACTIVATE internet explorer.exe}

So without the command, there are times when using the keystrokes for login will create a "miss" in the actual window it should be typing. 
Title: Re: Batch files not executing (login batch script)
Post by: saurav on Feb 09, 2017, 01:34 PM
@demond0jones You need to mention the window title instead of the program name for APPACTIVATE. Also if you have used the Open command to open a webpage and provided the needed delay using the DELAY command, the window will be in focus by default and you wont need to use APPACTIVATE command.