Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Re: I need to run "WScript" File help!!

Reply
 
Old 03-06-2009   #1 (permalink)
Bill Blanton


 
 

Re: I need to run "WScript" File help!!

I'm crossposting this to the NG that's more expert on the matter.
(to vbscript; see code below)



"Bill Blanton" <bblanton@xxxxxx> wrote in message news:uO1UsStnJHA.1252@xxxxxx
Quote:

> That msg is most likely reporting that it isn't finding the file Hpqdirec.exe.
> WshShell.Exec is an internal script procedure; in this case to launch (dirfile).
> The parameter passed is most likely wrong. Are you sure there are no typos
> in the path\name ?
>
>
> "tjdarth" <tjdarth@xxxxxx> wrote in message news:%23vCvYHsnJHA.1216@xxxxxx
Quote:

>> Thanks Bill for your suggestion. After placing the dirfile in " ", I get an error messag on line 3 which is simply trying to set
>> the variable "oExec" to the command WshShell.exe I get the msg: The system cannot find the file specified -->WshShell.exe! Indeed
>> when I look in system32\ dir the wscript exe is there but the WshShell.exec is not? Is this appl suspiciously hidden somewhere >>
>> else?
Quote:
Quote:

>>
>> Thanks again . . .Tom.J
>> "Bill Blanton" <bblanton@xxxxxx> wrote in message news:e2rRuwfnJHA.1288@xxxxxx
Quote:

>>> If you open a cmd prompt first and then run the file, and the cmd Window
>>> will not disappear, and you may see an error message.
>>>
>>> cscript yourfile.js
>>>
>>> Try wrapping the dirfile variable string in " "
>>> var dirfile= "I:\Program Files\HP\Digital Imaging\bin\Hpqdirec.exe";
>>>
>>>
>>>
>>>
>>> "tjdarth" <tjdarth@xxxxxx> wrote in message news:%23Zb%234UcnJHA.3840@xxxxxx
>>>> Thanks ju for your quick response. At your suggestion, I changed the file type to (.vbs) and used the RUN command to execute
>>>> the
>>>> script. The result is a quick cmd window flash before it closes and I still have not successfully accomplished what I set out
>>>> to do in the first place, which is to start a Windows application thru WScript. The simple script that I am trying to run is
>>>> included below:
>>>>


Quote:
Quote:
Quote:

>>>> var WshShell = new ActiveXObject("WScript.Shell");
>>>> var dirfile= I:\Program Files\HP\Digital Imaging\bin\Hpqdirec.exe; //execute this file!!!
>>>> var oExec = WshShell.Exec(dirfile);
>>>> WScript.Sleep(3000);
>>>> WshShell.SendKeys("%( )"); //equivalent of Alt+spacebar
>>>> WshShell.SendKeys("nn"); //equivalent of click minimize twice
>>>> oExec = WshShell.Exec(dirfile);
>>>>




Quote:
Quote:
Quote:

>>>> This is just a straight forward script that I want to start my Windows application, but nothing else happens. Does anything
>>>> look amist to you?
>>>>
>>>> Thanks for your help . . .
>>>> Tom J.
>>>>
>>>> "ju.c" <bibidybubidyboop@xxxxxx> wrote in message news:%23qIjmyZnJHA.5980@xxxxxx
>>>>> Change the extension to VBS or enter in the Run box or command
>>>>> window:
>>>>>
>>>>> csript "C:\Path To\file.js".
>>>>>
>>>>> If that works for you you could create a context menu item to run JS
>>>>> files by right-clicking them. (Right-click "Run JS File")
>>>>>
>>>>>
>>>>> ju.c
>>>>>
>>>>>
>>>>> "tjdarth" <tjdarth@xxxxxx> wrote in message news:uWQ4xOWnJHA.5980@xxxxxx
>>>>>> Hey guys, I have run across a situation where I need to run a (.js) type wscript on my Win-XP SPIII system. When I place the
>>>>>> short script on my Desktop and Double-click to start the process, I am surprised to have my Dreamweaver CS3 application
>>>>>> startup. I go on the prowl and sure snuff' I find that the (.js) file type is associated with amoung other things Dreamweaver
>>>>>> CS3.
>>>>>> I took the liberty to look-see how the (.vbs) file was handling its process, and it appears that it is dependent on the
>>>>>> following "Microsoft(R) Windows Based Script Host" processor. I'm not sure how to attach this application to my specific
>>>>>> (.js) file.
>>>>>>
>>>>>> Is there a possible way to give me the best of both worlds, or will I have to do some follng' around?
>>>>>>
>>>>>> Any help would be appreciated . . .
>>>>>>
>>>>>> Tom J.
>>>>
>>>>
>>>
>>>
>>
>>
>
>


My System SpecsSystem Spec
Old 03-07-2009   #2 (permalink)
tjdarth


 
 

Re: I need to run "WScript" File help!!

Thanks Bill, I hope someone might have tackled this before as well.

Tom J.

"Bill Blanton" <bblanton@xxxxxx> wrote in message
news:OGU4XdtnJHA.4168@xxxxxx
Quote:

> I'm crossposting this to the NG that's more expert on the matter.
> (to vbscript; see code below)
>
>
>
> "Bill Blanton" <bblanton@xxxxxx> wrote in message
> news:uO1UsStnJHA.1252@xxxxxx
Quote:

>> That msg is most likely reporting that it isn't finding the file
>> Hpqdirec.exe.
>> WshShell.Exec is an internal script procedure; in this case to launch
>> (dirfile).
>> The parameter passed is most likely wrong. Are you sure there are no
>> typos
>> in the path\name ?
>>
>>
>> "tjdarth" <tjdarth@xxxxxx> wrote in message
>> news:%23vCvYHsnJHA.1216@xxxxxx
Quote:

>>> Thanks Bill for your suggestion. After placing the dirfile in " ", I get
>>> an error messag on line 3 which is simply trying to set the variable
>>> "oExec" to the command WshShell.exe I get the msg: The system cannot
>>> find the file specified -->WshShell.exe! Indeed when I look in system32\
>>> dir the wscript exe is there but the WshShell.exec is not? Is this appl
>>> suspiciously hidden somewhere >> else?
>
Quote:
Quote:

>>>
>>> Thanks again . . .Tom.J
>>> "Bill Blanton" <bblanton@xxxxxx> wrote in message
>>> news:e2rRuwfnJHA.1288@xxxxxx
>>>> If you open a cmd prompt first and then run the file, and the cmd
>>>> Window
>>>> will not disappear, and you may see an error message.
>>>>
>>>> cscript yourfile.js
>>>>
>>>> Try wrapping the dirfile variable string in " "
>>>> var dirfile= "I:\Program Files\HP\Digital Imaging\bin\Hpqdirec.exe";
>>>>
>>>>
>>>>
>>>>
>>>> "tjdarth" <tjdarth@xxxxxx> wrote in message
>>>> news:%23Zb%234UcnJHA.3840@xxxxxx
>>>>> Thanks ju for your quick response. At your suggestion, I changed the
>>>>> file type to (.vbs) and used the RUN command to execute the
>>>>> script. The result is a quick cmd window flash before it closes and I
>>>>> still have not successfully accomplished what I set out to do in the
>>>>> first place, which is to start a Windows application thru WScript. The
>>>>> simple script that I am trying to run is included below:
>>>>>
>
>
>
>
Quote:
Quote:

>>>>> var WshShell = new ActiveXObject("WScript.Shell");
>>>>> var dirfile= I:\Program Files\HP\Digital Imaging\bin\Hpqdirec.exe;
>>>>> //execute this file!!!
>>>>> var oExec = WshShell.Exec(dirfile);
>>>>> WScript.Sleep(3000);
>>>>> WshShell.SendKeys("%( )"); //equivalent of Alt+spacebar
>>>>> WshShell.SendKeys("nn"); //equivalent of click minimize twice
>>>>> oExec = WshShell.Exec(dirfile);
>>>>>
>
>
>
>
>
>
Quote:
Quote:

>>>>> This is just a straight forward script that I want to start my Windows
>>>>> application, but nothing else happens. Does anything look amist to
>>>>> you?
>>>>>
>>>>> Thanks for your help . . .
>>>>> Tom J.
>>>>>
>>>>> "ju.c" <bibidybubidyboop@xxxxxx> wrote in message
>>>>> news:%23qIjmyZnJHA.5980@xxxxxx
>>>>>> Change the extension to VBS or enter in the Run box or command
>>>>>> window:
>>>>>>
>>>>>> csript "C:\Path To\file.js".
>>>>>>
>>>>>> If that works for you you could create a context menu item to run JS
>>>>>> files by right-clicking them. (Right-click "Run JS File")
>>>>>>
>>>>>>
>>>>>> ju.c
>>>>>>
>>>>>>
>>>>>> "tjdarth" <tjdarth@xxxxxx> wrote in message
>>>>>> news:uWQ4xOWnJHA.5980@xxxxxx
>>>>>>> Hey guys, I have run across a situation where I need to run a (.js)
>>>>>>> type wscript on my Win-XP SPIII system. When I place the short
>>>>>>> script on my Desktop and Double-click to start the process, I am
>>>>>>> surprised to have my Dreamweaver CS3 application startup. I go on
>>>>>>> the prowl and sure snuff' I find that the (.js) file type is
>>>>>>> associated with amoung other things Dreamweaver CS3.
>>>>>>> I took the liberty to look-see how the (.vbs) file was handling its
>>>>>>> process, and it appears that it is dependent on the following
>>>>>>> "Microsoft(R) Windows Based Script Host" processor. I'm not sure how
>>>>>>> to attach this application to my specific (.js) file.
>>>>>>>
>>>>>>> Is there a possible way to give me the best of both worlds, or will
>>>>>>> I have to do some follng' around?
>>>>>>>
>>>>>>> Any help would be appreciated . . .
>>>>>>>
>>>>>>> Tom J.
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>

My System SpecsSystem Spec
Old 03-07-2009   #3 (permalink)
James Whitlow


 
 

Re: I need to run "WScript" File help!!

"tjdarth" <tjdarth@xxxxxx> wrote in message
news:%23Zb%234UcnJHA.3840@xxxxxx
Quote:

> Thanks ju for your quick response. At your suggestion, I changed the file
> type to (.vbs) and used the RUN command to execute the script. The result
> is a quick cmd window
> flash before it closes and I still have not successfully accomplished what
> I set out
> to do in the first place, which is to start a Windows application thru
> WScript. The
> simple script that I am trying to run is included below:
>
> var WshShell = new ActiveXObject("WScript.Shell");
> var dirfile= I:\Program Files\HP\Digital Imaging\bin\Hpqdirec.exe;
> //execute this file!!!
> var oExec = WshShell.Exec(dirfile);
> WScript.Sleep(3000);
> WshShell.SendKeys("%( )"); //equivalent of Alt+spacebar
> WshShell.SendKeys("nn"); //equivalent of click minimize twice
> oExec = WshShell.Exec(dirfile);
Try giving it a '.wsf' extension and wrapping it in the XML '<job>' &
'<script>' tags. I tested the below code on my computer (using 'notepad.exe'
renamed as 'Hpqdirec.exe') and it worked. I did have to wrap the path and
double up the slashes, though.

<job>
<script language="javascript">
var WshShell = new ActiveXObject("WScript.Shell");
var dirfile= "I:\\Program Files\\HP\\Digital Imaging\\bin\\Hpqdirec.exe";
var oExec = WshShell.Exec(dirfile);
WScript.Sleep(3000);
WshShell.SendKeys("%( )"); //equivalent of Alt+spacebar
WshShell.SendKeys("nn"); //equivalent of click minimize twice
oExec = WshShell.Exec(dirfile);
</script>
</job>


My System SpecsSystem Spec
Old 03-07-2009   #4 (permalink)
James Whitlow


 
 

Re: I need to run "WScript" File help!!

"James Whitlow" <jwhitlow.60372693@xxxxxx> wrote in message
news:uo2GKiznJHA.1248@xxxxxx
Quote:

> "tjdarth" <tjdarth@xxxxxx> wrote in message
> news:%23Zb%234UcnJHA.3840@xxxxxx
Quote:

>> Thanks ju for your quick response. At your suggestion, I changed the file
>> type to (.vbs) and used the RUN command to execute the script. The result
>> is a quick cmd window
>> flash before it closes and I still have not successfully accomplished
>> what I set out
>> to do in the first place, which is to start a Windows application thru
>> WScript. The
>> simple script that I am trying to run is included below:
>>
>> var WshShell = new ActiveXObject("WScript.Shell");
>> var dirfile= I:\Program Files\HP\Digital Imaging\bin\Hpqdirec.exe;
>> //execute this file!!!
>> var oExec = WshShell.Exec(dirfile);
>> WScript.Sleep(3000);
>> WshShell.SendKeys("%( )"); //equivalent of Alt+spacebar
>> WshShell.SendKeys("nn"); //equivalent of click minimize twice
>> oExec = WshShell.Exec(dirfile);
>
> Try giving it a '.wsf' extension and wrapping it in the XML '<job>' &
> '<script>' tags. I tested the below code on my computer (using
> 'notepad.exe' renamed as 'Hpqdirec.exe') and it worked. I did have to wrap
> the path and double up the slashes, though.
Woops, I forgot to double up the backslashes in the code above. I also
meant to say, 'wrap the path in quotes'.

I did notice that I could just turn the backslashes into forward slashes &
then I don't have to double them up. I also noticed I could use single
quotes instead of double quotes. I work with WSF files a lot, but
exclusively with VBScript and not JavaScript, so I have very little
knowledge of the language itself.

<job>
<script language='javascript'>
var WshShell = new ActiveXObject("WScript.Shell");
var dirfile= 'I:/Program Files/HP/Digital Imaging/bin/Hpqdirec.exe';
var oExec = WshShell.Exec(dirfile);
WScript.Sleep(3000);
WshShell.SendKeys("%( )"); //equivalent of Alt+spacebar
WshShell.SendKeys("nn"); //equivalent of click minimize twice
oExec = WshShell.Exec(dirfile);
</script>
</job>


My System SpecsSystem Spec
Old 03-10-2009   #5 (permalink)
tjdarth


 
 

Re: I need to run "WScript" File help!!

Thanks for your help James. I too got this thing to work after adding in the
XML <job>, <script> tags AND changing the "\" to "/" and changing the
filetype to (".wsf"). This should bring closure to this problem at this
time. Thanks tons... . . . . Tom J.
"James Whitlow" <jwhitlow.60372693@xxxxxx> wrote in message
news:epQAbc0nJHA.5228@xxxxxx
Quote:

> "James Whitlow" <jwhitlow.60372693@xxxxxx> wrote in message
> news:uo2GKiznJHA.1248@xxxxxx
Quote:

>> "tjdarth" <tjdarth@xxxxxx> wrote in message
>> news:%23Zb%234UcnJHA.3840@xxxxxx
Quote:

>>> Thanks ju for your quick response. At your suggestion, I changed the
>>> file type to (.vbs) and used the RUN command to execute the script. The
>>> result is a quick cmd window
>>> flash before it closes and I still have not successfully accomplished
>>> what I set out
>>> to do in the first place, which is to start a Windows application thru
>>> WScript. The
>>> simple script that I am trying to run is included below:
>>>
>>> var WshShell = new ActiveXObject("WScript.Shell");
>>> var dirfile= I:\Program Files\HP\Digital Imaging\bin\Hpqdirec.exe;
>>> //execute this file!!!
>>> var oExec = WshShell.Exec(dirfile);
>>> WScript.Sleep(3000);
>>> WshShell.SendKeys("%( )"); //equivalent of Alt+spacebar
>>> WshShell.SendKeys("nn"); //equivalent of click minimize twice
>>> oExec = WshShell.Exec(dirfile);
>>
>> Try giving it a '.wsf' extension and wrapping it in the XML '<job>' &
>> '<script>' tags. I tested the below code on my computer (using
>> 'notepad.exe' renamed as 'Hpqdirec.exe') and it worked. I did have to
>> wrap the path and double up the slashes, though.
>
> Woops, I forgot to double up the backslashes in the code above. I also
> meant to say, 'wrap the path in quotes'.
>
> I did notice that I could just turn the backslashes into forward slashes
> & then I don't have to double them up. I also noticed I could use single
> quotes instead of double quotes. I work with WSF files a lot, but
> exclusively with VBScript and not JavaScript, so I have very little
> knowledge of the language itself.
>
> <job>
> <script language='javascript'>
> var WshShell = new ActiveXObject("WScript.Shell");
> var dirfile= 'I:/Program Files/HP/Digital Imaging/bin/Hpqdirec.exe';
> var oExec = WshShell.Exec(dirfile);
> WScript.Sleep(3000);
> WshShell.SendKeys("%( )"); //equivalent of Alt+spacebar
> WshShell.SendKeys("nn"); //equivalent of click minimize twice
> oExec = WshShell.Exec(dirfile);
> </script>
> </job>
>

My System SpecsSystem Spec
Old 03-10-2009   #6 (permalink)
tjdarth


 
 

Re: I need to run "WScript" File help!!

Bill, I finally got an answer and solved my problem. Take a look at the
crossposting. Thanks agin for all your help as well.

Tom J.
"Bill Blanton" <bblanton@xxxxxx> wrote in message
news:OGU4XdtnJHA.4168@xxxxxx
Quote:

> I'm crossposting this to the NG that's more expert on the matter.
> (to vbscript; see code below)
>
>
>
> "Bill Blanton" <bblanton@xxxxxx> wrote in message
> news:uO1UsStnJHA.1252@xxxxxx
Quote:

>> That msg is most likely reporting that it isn't finding the file
>> Hpqdirec.exe.
>> WshShell.Exec is an internal script procedure; in this case to launch
>> (dirfile).
>> The parameter passed is most likely wrong. Are you sure there are no
>> typos
>> in the path\name ?
>>
>>
>> "tjdarth" <tjdarth@xxxxxx> wrote in message
>> news:%23vCvYHsnJHA.1216@xxxxxx
Quote:

>>> Thanks Bill for your suggestion. After placing the dirfile in " ", I get
>>> an error messag on line 3 which is simply trying to set the variable
>>> "oExec" to the command WshShell.exe I get the msg: The system cannot
>>> find the file specified -->WshShell.exe! Indeed when I look in system32\
>>> dir the wscript exe is there but the WshShell.exec is not? Is this appl
>>> suspiciously hidden somewhere >> else?
>
Quote:
Quote:

>>>
>>> Thanks again . . .Tom.J
>>> "Bill Blanton" <bblanton@xxxxxx> wrote in message
>>> news:e2rRuwfnJHA.1288@xxxxxx
>>>> If you open a cmd prompt first and then run the file, and the cmd
>>>> Window
>>>> will not disappear, and you may see an error message.
>>>>
>>>> cscript yourfile.js
>>>>
>>>> Try wrapping the dirfile variable string in " "
>>>> var dirfile= "I:\Program Files\HP\Digital Imaging\bin\Hpqdirec.exe";
>>>>
>>>>
>>>>
>>>>
>>>> "tjdarth" <tjdarth@xxxxxx> wrote in message
>>>> news:%23Zb%234UcnJHA.3840@xxxxxx
>>>>> Thanks ju for your quick response. At your suggestion, I changed the
>>>>> file type to (.vbs) and used the RUN command to execute the
>>>>> script. The result is a quick cmd window flash before it closes and I
>>>>> still have not successfully accomplished what I set out to do in the
>>>>> first place, which is to start a Windows application thru WScript. The
>>>>> simple script that I am trying to run is included below:
>>>>>
>
>
>
>
Quote:
Quote:

>>>>> var WshShell = new ActiveXObject("WScript.Shell");
>>>>> var dirfile= I:\Program Files\HP\Digital Imaging\bin\Hpqdirec.exe;
>>>>> //execute this file!!!
>>>>> var oExec = WshShell.Exec(dirfile);
>>>>> WScript.Sleep(3000);
>>>>> WshShell.SendKeys("%( )"); //equivalent of Alt+spacebar
>>>>> WshShell.SendKeys("nn"); //equivalent of click minimize twice
>>>>> oExec = WshShell.Exec(dirfile);
>>>>>
>
>
>
>
>
>
Quote:
Quote:

>>>>> This is just a straight forward script that I want to start my Windows
>>>>> application, but nothing else happens. Does anything look amist to
>>>>> you?
>>>>>
>>>>> Thanks for your help . . .
>>>>> Tom J.
>>>>>
>>>>> "ju.c" <bibidybubidyboop@xxxxxx> wrote in message
>>>>> news:%23qIjmyZnJHA.5980@xxxxxx
>>>>>> Change the extension to VBS or enter in the Run box or command
>>>>>> window:
>>>>>>
>>>>>> csript "C:\Path To\file.js".
>>>>>>
>>>>>> If that works for you you could create a context menu item to run JS
>>>>>> files by right-clicking them. (Right-click "Run JS File")
>>>>>>
>>>>>>
>>>>>> ju.c
>>>>>>
>>>>>>
>>>>>> "tjdarth" <tjdarth@xxxxxx> wrote in message
>>>>>> news:uWQ4xOWnJHA.5980@xxxxxx
>>>>>>> Hey guys, I have run across a situation where I need to run a (.js)
>>>>>>> type wscript on my Win-XP SPIII system. When I place the short
>>>>>>> script on my Desktop and Double-click to start the process, I am
>>>>>>> surprised to have my Dreamweaver CS3 application startup. I go on
>>>>>>> the prowl and sure snuff' I find that the (.js) file type is
>>>>>>> associated with amoung other things Dreamweaver CS3.
>>>>>>> I took the liberty to look-see how the (.vbs) file was handling its
>>>>>>> process, and it appears that it is dependent on the following
>>>>>>> "Microsoft(R) Windows Based Script Host" processor. I'm not sure how
>>>>>>> to attach this application to my specific (.js) file.
>>>>>>>
>>>>>>> Is there a possible way to give me the best of both worlds, or will
>>>>>>> I have to do some follng' around?
>>>>>>>
>>>>>>> Any help would be appreciated . . .
>>>>>>>
>>>>>>> Tom J.
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Can Wscript catch the MS Word Application Event "DocumentBeforePrint" ? VB Script
wscript.echo only a new line / embed a "CR" in a text string ? VB Script
"Extensible Authentication Protocol" service gives "The system cannot find the file specified" error Vista networking & sharing
Windows mail shuts down when "Insert" - "File Attachments" is sele Vista mail
Changing "mailto" protocol via registry--no "clients" file under HKEY_USERS Vista mail


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46