bat or vbs re posted

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
danny01234
Posts: 6
Joined: 17 Mar 2016 09:56

bat or vbs re posted

#1 Post by danny01234 » 17 Mar 2016 10:52

Hello

I am very new at this so please be patient with me ..I have a programme that runs on my 32bit XP SP3 Machine, it works very well but has two error messages when launching. The error messages are to do with a non certified GPU but my programme works fine with the GPU so that bit is OK, to launch the programme I have to hit the enter key twice getting past both error messages.

What I really would like to do and I have spent some 6 hours trying to write a bat file or vbs that is a single hit clearly I have no idea how to do this - I would always spend time researching problems but I am stuck with this and wondered if I could get some help.

I have written a bat file contents below that actually launches my prog but then it stops at the first error message waiting for me to hit the enter key.

" cd C:\Program Files\my prog.exe

start /? [enter][enter]

The (my prog.exe) is obviously not the real programme.

Could somebody kindly help me ?? it may well be that what I have below is completely wrong in that case I am more than happy to try something else - I am also not clear if I need a bat or vbs file but what I do know is that I need some help.

Thanks

Ps ( last post not published ) for some reason must have been a publishing glitch/error on my part maybe ?

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: bat or vbs re posted

#2 Post by aGerman » 17 Mar 2016 14:49

You may use a Batch-JScript-Hybrid Script. Try

Code: Select all

@if (@a)==(@b) @end /*

@echo off &setlocal
start "" "C:\Program Files\my prog.exe"
cscript //nologo //e:jscript "%~fs0"
exit /b

*/

var oShell = new ActiveXObject('WScript.Shell');
WScript.Sleep(1000);
oShell.SendKeys('~');
WScript.Sleep(1000);
oShell.SendKeys('~');

Save the script with file extension .bat

You can play around with the delays. Depending on the speed of your computer 1000 milliseconds may or may not be enough time to load the window. Note that the SendKeys method will always be applied to the window that currently has the keyboard focus.

Ps ( last post not published ) for some reason must have been a publishing glitch/error on my part maybe ?

It's not your fault but is a forum policy that the first posts of a new member have to be approved before they are published. We had some bad experiences in the past ...

Regards
aGerman

danny01234
Posts: 6
Joined: 17 Mar 2016 09:56

Re: bat or vbs re posted

#3 Post by danny01234 » 17 Mar 2016 15:41

Hello aGerman

I tried it crossing my fingers .. but it stopped at the same place in the launch sequence, I then did the usual and hit the enter key twice which completed the loading process.

The 1000ms seemed OK but just to satisfy myself I extended both to 1500ms but it made no difference

Any other suggestions would be much appreciated

Ps No explanation needed for the delayed posting - I fully understand

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: bat or vbs re posted

#4 Post by aGerman » 17 Mar 2016 15:47

What kind of program are we talking about? Is it a game? In this case you might have no chance. Most of them are protected against click-bots. Hence SendKeys won't work.

danny01234
Posts: 6
Joined: 17 Mar 2016 09:56

Re: bat or vbs re posted

#5 Post by danny01234 » 17 Mar 2016 15:53

it is a non liner editing programme called Avid Media Composer .. its not a new version at all I have had it for years and it works perfectly so I have never upgraded it .. the only issue I have is that the GPU is not certified which is why I get the error messages when launching but the GPU works perfectly I can use all the effects etc

I just have this nagging issue with the launching - if I am away from the machine or take a call it just sits waiting for me to enter x 2 very annoying.

danny01234
Posts: 6
Joined: 17 Mar 2016 09:56

Re: bat or vbs re posted

#6 Post by danny01234 » 17 Mar 2016 16:03

Not sure if this helps but there is a 38 second delay ( while the programme loads ) before the 1st error message comes up when I hit enter the 2nd time the 2nd error message comes up immediately

This may be a silly question but can an equivalent delay be written into the bat file ??

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: bat or vbs re posted

#7 Post by aGerman » 17 Mar 2016 16:10

Not sure if this helps but there is a 38 second delay ( while the programme loads ) before the 1st error message comes up when I hit enter the 2nd time the 2nd error message comes up immediately

The first Sleep function specifies the delay between starting the program and sending the first Enter. Just try to increase it to - say - 40000 ms.

danny01234
Posts: 6
Joined: 17 Mar 2016 09:56

Re: bat or vbs re posted

#8 Post by danny01234 » 17 Mar 2016 16:17

Getting somewhere now

The first error message came up at the 38 second mark but when I hit enter the 2nd error message flashed and the programme launched .... so something good is happening.

it needs a bit more tweaking I think

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: bat or vbs re posted

#9 Post by aGerman » 17 Mar 2016 16:26

Did you wait the full 40s before you hit Enter?
Did the window have the Keyboard Focus before you hit Enter? If not, please tell me exactly what window title shows up in the task bar when the error message occurs.

danny01234
Posts: 6
Joined: 17 Mar 2016 09:56

Re: bat or vbs re posted

#10 Post by danny01234 » 17 Mar 2016 16:27

Launched it 5 times now .. and it works perfectly

Thank you so much for this, I can not tell you how much of a pain this was but now its all fixed

All the best from the UK

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: bat or vbs re posted

#11 Post by aGerman » 17 Mar 2016 16:29

You're wellcome :)

Post Reply