echoing variables into perlscript console using wscript, vbs

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
pditty8811
Posts: 184
Joined: 21 Feb 2013 15:54

echoing variables into perlscript console using wscript, vbs

#1 Post by pditty8811 » 26 Mar 2013 19:08

Ok, try to follow. I have three scripts here, a batch, .vbs script and a perl script.

In my batch script I'm echoing variables (var5a, var3a, etc...) into a vbs script file called "script.vbs". I then launch that script.vbs with wscript. I then launch a perl script called "PosTimeFilter.pl". The perl script launches in the cmd console. wscript then automatically presses keys that I put into the "script.vbs" as the perl script is running, completing the perl script. The perl script asks for userinput, and script.vbs is feeding the perl that information.

I used the vbs script because I don't think batch can press buttons or input commands into a console.

Everything works as intended. But it has one downfall. When the batch executes the code below you can't press any buttons or click on other windows and let it run in the background. If you do press buttons, it will mess up the script. I'm assuming its the vbs script that is the cause of this.

I'd like my batch script to be working minimized or in the background as this will be running while a game is running in the foreground.
Can I launch my batch minimized or try to overcome this problem?

I guess one way would be to echo it into the perl script file directly, but I don't understand perl.

Note: this isn't all that is in my batch file. There is a whole bunch more. So I do need the batch to run.


This is a small part of what in my batch script:

Code: Select all

echo Set WshShell = WScript.CreateObject("WScript.Shell") > "script.vbs"
echo WScript.Sleep 200 >> "script.vbs"
echo WshShell.SendKeys "s" >> "script.vbs"
echo WshShell.SendKeys "{ENTER}" >> "script.vbs"
echo WshShell.SendKeys "!var5b!" >> "script.vbs"
echo WshShell.SendKeys "{ENTER}" >> "script.vbs"
echo WshShell.SendKeys "!var5a!" >> "script.vbs"
echo WshShell.SendKeys "{ENTER}" >> "script.vbs"
echo WshShell.SendKeys "!var2a!" >> "script.vbs"
echo WshShell.SendKeys "{ENTER}" >> "script.vbs"
echo WshShell.SendKeys "!var2b!" >> "script.vbs"
echo WshShell.SendKeys "{ENTER}" >> "script.vbs"
echo WshShell.SendKeys "!var3a!" >> "script.vbs"
echo WshShell.SendKeys "{ENTER}" >> "script.vbs"
echo WshShell.SendKeys "!var3b!" >> "script.vbs"
echo WshShell.SendKeys "{ENTER}" >> "script.vbs"
echo WScript.Sleep 800 >> "script.vbs"
echo WshShell.SendKeys "y" >> "script.vbs"
echo WshShell.SendKeys "{ENTER}" >> "script.vbs"


cd "E:\Program Files (x86)\Ubisoft\SilentHunterIII\Dynamic Campaign\Perl"

wscript script.vbs

perl PosTimeFilter.pl



This is what is in script.vbs:

Code: Select all

Set WshShell = WScript.CreateObject("WScript.Shell") 
WScript.Sleep 200
WshShell.SendKeys "s" 
WshShell.SendKeys "{ENTER}"
WshShell.SendKeys "19410911"
WshShell.SendKeys "{ENTER}"
WshShell.SendKeys "19410913"
WshShell.SendKeys "{ENTER}"
WshShell.SendKeys "14500"
WshShell.SendKeys "{ENTER}"
WshShell.SendKeys "14496"
WshShell.SendKeys "{ENTER}"
WshShell.SendKeys "-812"
WshShell.SendKeys "{ENTER}"
WshShell.SendKeys "-816"
WshShell.SendKeys "{ENTER}"
WScript.Sleep 800
WshShell.SendKeys "y"
WshShell.SendKeys "{ENTER}"


[EDIT] Perl script removed by moderator[/EDIT]

Squashman
Expert
Posts: 4488
Joined: 23 Dec 2011 13:59

Re: echoing variables into perlscript console using wscript,

#2 Post by Squashman » 27 Mar 2013 05:34

This forum is mostly for Windows NT based batch files. Most people will help with Vbscript but we don't help with Perl on this site. If you need help with Perl then please post on a website that is Perl specific.

Thanks

Post Reply