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 - vb script on vista X64 not working

Reply
 
Old 10-14-2008   #1 (permalink)


vista x64 ultimare
 
 

vb script on vista X64 not working

the script below works perfectly on vista32 - but on X64 is reports it cannot find the file on line 21

it is for acceessing a remote computer

i know nothing about vb - just found the script in a forum

i have turned telnet on and that is working

can anybody help

thanks

tony



script below

Quote:
ServerName = "192.168.1.9"
Username = "admin" ' Current Username
Passwd = "nas" ' Current Password
XIT = "E" ' Used to "EXIT" from NAS. (upper-case E)
YES = "y" ' Used to confirm an option. (lower-case Y)
SHUT = "8" ' Used to SHUTDOWN NAS. (number eight)
DELAY = 250 ' Minimum 500ms recommended; 1000 works well.

' --------------------------------------------------------------------
' SECTION B: Start a Shell
' --------------------------------------------------------------------
Set WshShell = WScript.CreateObject("WScript.Shell")

' --------------------------------------------------------------------
' SECTION C: Start the TELNET
' --------------------------------------------------------------------
WshShell.Run "telnet " + ServerName
' --------------------------------------------------------------------
' SECTION D: Login. ("Sleep" pauses are needed delays.)
' --------------------------------------------------------------------
WScript.Sleep DELAY
WshShell.SendKeys Username + vbLf
WScript.Sleep DELAY
WshShell.SendKeys Passwd + vbLf

My System SpecsSystem Spec
Old 10-14-2008   #2 (permalink)
Monitor


 
 

Re: vb script on vista X64 not working


"adacom" <guest@xxxxxx-email.com> wrote in message
news:26acd3d36a924dccb1c10cb91f47494b@xxxxxx-gateway.com...
Quote:

>
> the script below works perfectly on vista32 - but on X64 is reports it
> cannot find the file on line 21
>
> it is for acceessing a remote computer
>
> i know nothing about vb - just found the script in a forum
>
> i have turned telnet on and that is working
>
> can anybody help
>
> thanks
>
> tony
>
>
>
> script below
>
Quote:

> > ServerName = "192.168.1.9"
> > Username = "admin" ' Current Username
> > Passwd = "nas" ' Current Password
> > XIT = "E" ' Used to "EXIT" from NAS. (upper-case E)
> > YES = "y" ' Used to confirm an option. (lower-case Y)
> > SHUT = "8" ' Used to SHUTDOWN NAS. (number eight)
> > DELAY = 250 ' Minimum 500ms recommended; 1000 works well.
> >
> > ' --------------------------------------------------------------------
> > ' SECTION B: Start a Shell
> > ' --------------------------------------------------------------------
> > Set WshShell = WScript.CreateObject("WScript.Shell")
> >
> > ' --------------------------------------------------------------------
> > ' SECTION C: Start the TELNET
> > ' --------------------------------------------------------------------
> > WshShell.Run "telnet " + ServerName
> > ' --------------------------------------------------------------------
> > ' SECTION D: Login. ("Sleep" pauses are needed delays.)
> > ' --------------------------------------------------------------------
> > WScript.Sleep DELAY
> > WshShell.SendKeys Username + vbLf
> > WScript.Sleep DELAY
> > WshShell.SendKeys Passwd + vbLf
>
>
> --
> adacom
As a matter of courtesy towards respondents it would be a great idea to
point out which line is line 21. This would also eliminate any confusion
arising from leading blank lines.


My System SpecsSystem Spec
Old 10-14-2008   #3 (permalink)


vista x64 ultimare
 
 

Re: vb script on vista X64 not working

not understanding vb i have to guess which is line 21 - i am assuming blank lines are counted so this would seem to be the error line -or maybe they all are faulty and line 21 is the first faulty line

Quote:
WshShell.Run "telnet " + ServerName
sorry i cannot be sure - that was the reason for my post
My System SpecsSystem Spec
Old 10-14-2008   #4 (permalink)
Pegasus \(MVP\)


 
 

Re: vb script on vista X64 not working


"adacom" <guest@xxxxxx-email.com> wrote in message
news:9da40364818de2ef38e3706996edd426@xxxxxx-gateway.com...
Quote:

>
> not understanding vb i have to guess which is line 21 - i am assuming
> blank lines are counted so this would seem to be the error line -or
> maybe they all are faulty and line 21 is the first faulty line
>
Quote:

>> WshShell.Run "telnet " + ServerName
>
> sorry i cannot be sure - that was the reason for my post
>
>
> --
> adacom
Use notepad.exe to look at your source code, then count your lines. To be
really sure, insert some labels like so:

ServerName = "192.168.1.9"
Quote:

> Username = "admin" ' Current Username
> Passwd = "nas" ' Current Password
> XIT = "E" ' Used to "EXIT" from NAS. (upper-case E)
> YES = "y" ' Used to confirm an option. (lower-case Y)
> SHUT = "8" ' Used to SHUTDOWN NAS. (number eight)
> DELAY = 250 ' Minimum 500ms recommended; 1000 works well.
>
> ' --------------------------------------------------------------------
> ' SECTION B: Start a Shell
> ' --------------------------------------------------------------------
> Set WshShell = WScript.CreateObject("WScript.Shell")
wscript.echo "Label 1"
' --------------------------------------------------------------------
' SECTION C: Start the TELNET
' --------------------------------------------------------------------
wscript.echo "Label 2"
WshShell.Run "telnet " + ServerName
' --------------------------------------------------------------------
' SECTION D: Login. ("Sleep" pauses are needed delays.)
' --------------------------------------------------------------------
wscript.echo "Label 3"
Quote:

> WScript.Sleep DELAY
> WshShell.SendKeys Username + vbLf
> WScript.Sleep DELAY
> WshShell.SendKeys Passwd + vbLf
Now invoke your script from the Command Prompt like so:
cscript.exe //nologo c:\MyScript.vbs


My System SpecsSystem Spec
Old 10-14-2008   #5 (permalink)


vista x64 ultimare
 
 

Re: vb script on vista X64 not working

thanks

done some checking and it is as i thought - line 21 in my original posted code is

Quote:
WshShell.Run "telnet " + ServerName
My System SpecsSystem Spec
Old 10-14-2008   #6 (permalink)
Pegasus \(MVP\)


 
 

Re: vb script on vista X64 not working


"adacom" <guest@xxxxxx-email.com> wrote in message
news:04f3bc9291f7aea763f221a8eee3e2e7@xxxxxx-gateway.com...
Quote:

>
> thanks
>
> done some checking and it is as i thought - line 21 in my original
> posted code is
>
Quote:

>>
>> WshShell.Run "telnet " + ServerName
>>
>
>
> --
> adacom
A few observations:
- Does "telnet.exe" exist?
- Where does it reside?
- Is its location included in the %path%?
- What happens when you type "telnet" (without the quotes) at the Command
Prompt?

Also:
- What are you actually trying to do with this script?
- To concatenate strings in VB Scripts, use the & symbol, not the + symbol.
- To make your script more robust, make it "telnet.exe" instead of just
"telnet".
- To avoid confusion, change "ServerName" to "ServerIP" throughout the
program.
- Since I don't have ready access to a 64-bit machine I cannot test your
code. It might be safer to invoke the Run method like so:
WshShell.Run "cmd.exe /c telnet.exe " + ServerName



My System SpecsSystem Spec
Old 10-14-2008   #7 (permalink)


vista x64 ultimare
 
 

Re: vb script on vista X64 not working

Quote  Quote: Originally Posted by Pegasus \(MVP\) View Post
"adacom" <guest@xxxxxx-email.com> wrote in message
news:04f3bc9291f7aea763f221a8eee3e2e7@xxxxxx-gateway.com...
Quote:
>
> thanks
>
> done some checking and it is as i thought - line 21 in my original
> posted code is
>
Quote:
>>
>> WshShell.Run "telnet " + ServerName
>>
>
>
> --
> adacom
A few observations:
- Does "telnet.exe" exist?
- Where does it reside?
- Is its location included in the %path%?
- What happens when you type "telnet" (without the quotes) at the Command
Prompt?

Also:
- What are you actually trying to do with this script?
- To concatenate strings in VB Scripts, use the & symbol, not the + symbol.
- To make your script more robust, make it "telnet.exe" instead of just
"telnet".
- To avoid confusion, change "ServerName" to "ServerIP" throughout the
program.
- Since I don't have ready access to a 64-bit machine I cannot test your
code. It might be safer to invoke the Run method like so:
WshShell.Run "cmd.exe /c telnet.exe " + ServerName
telnet exists - i can run it from a command prompt - not sure where it is - i simply tyle telnet and it runs

its not my script - it is for controlling the software that runs a nas server from windows

it works perfectly in 32bit vista - but gives the errow when run on 64 bit vista

will try some of your suggestions but it will be no more than trial and error as i have no knowledge of vb
My System SpecsSystem Spec
Old 10-15-2008   #8 (permalink)


vista x64 ultimare
 
 

Re: vb script on vista X64 not working

thanks all for the input -as i said i know nothing about vbscripts so what i saw looked fine - but followed the advice from Pegasus and it now works

would just seem X64 is more picky than other versions of windows

so thanks again am well pleased

tony
My System SpecsSystem Spec
Old 10-15-2008   #9 (permalink)


Windows Vista™ Ultimate
 
 

Re: vb script on vista X64 not working

Quote  Quote: Originally Posted by adacom View Post
thanks all for the input -as i said i know nothing about vbscripts so what i saw looked fine - but followed the advice from Pegasus and it now works

would just seem X64 is more picky than other versions of windows

so thanks again am well pleased

tony
Hi Adacom,

I just tried your Script on VistaX64 and it worked perfectly for me?

Steven
My System SpecsSystem Spec
Old 10-15-2008   #10 (permalink)


vista x64 ultimare
 
 

Re: vb script on vista X64 not working

thanks Steven - as it does for me now - i think it was always ok - just seemed to be where it was stored

it was in a directory on drive d where it is/was on vista32 - on 32 it worked fine - but not on 64 - if i move it to the desktop it works

beyond me and i am not taking it further - it works that will do
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Logon script - function array and select case not working VB Script
Group membership script not working-help VB Script
problem passing args to script 'There is no script engine for file extenstion' VB Script
Static USB drive letters in XP (working script) VB Script
why my script not working ? PowerShell


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