Page 1 of 1 1
Topic Options
#26605 - 2002-08-07 12:00 AM @ras macro buggy.
Armin Linder Offline
Fresh Scripter

Registered: 2002-06-17
Posts: 22
I use shell commands to call rasdial and rasphone to automate some dial-in procedures. Works pretty good so far. I could not, however, find a way to get a return code from one of those programs back into my script, there does not seem to be a way to get at the DOS errorlevel variable (is there ...?)

So I came across the idea to make my code like this:

$NumRAS=@Ras
Shell (... call RASDIAL ...)
If @RAS <= $NumRas
... must have been some sorts of error, otherwise the @RAS counter had raised ...
endif

Unfortunately @ras does not seem to work, since it is always returning the number of ras connections that are already active when entering the script, and does not change it's value after a successful RAS connect.

Anyone found a way to fix that, or a workaround?

Thanks,

Armin Linder

Top
#26606 - 2002-08-07 12:27 AM Re: @ras macro buggy.
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
mmm...
I think the problem is that kix is getting it's info about net and macro's at the start of the script.

so, if you want to get the %errorlevel% into a script, try using just @error

I have got success with it everytime.
I have some ping script, user lastlogon time and that sort of scripts done with kix 3.55 and they work just fine.
_________________________
!

download KiXnet

Top
#26607 - 2002-08-07 12:36 AM Re: @ras macro buggy.
MightyR1 Offline
MM club member
*****

Registered: 1999-09-09
Posts: 1264
Loc: The Netherlands
Armin,

Do you have more than one RAS connection?
_________________________
Greetz,
Patrick Rutten

- We'll either find a way or make one...
- Knowledge is power; knowing how to find it is more powerful...
- Problems don't exist; they are challenges...

Top
#26608 - 2002-08-07 01:24 AM Re: @ras macro buggy.
Armin Linder Offline
Fresh Scripter

Registered: 2002-06-17
Posts: 22
Thanks for the replies.

I have two RAS connections becaue I use a VPN tunnel to dial into a LAN. So I get an ISP connection and a VPN connection on top of it.

Seems you're right, ways I tird to work around the problem were trying enumipinfo (I get more IP adresses if connected ...) and @ipadressx (for the same reason) but those too seem to be initialized only once :-(

So I currently think about dumping ipconfig /all to a file, and then get my IP infos from there (yuck ...).

Any other ideas?

Armin Linder

Top
#26609 - 2002-08-07 01:36 AM Re: @ras macro buggy.
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
You could probably do it with WMI. See http://www.microsoft.com/technet/treeview/default.asp?url=/technet/scriptcenter/default.asp for some ideas. Once you've got something started, try posting to the COM forum.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#26610 - 2002-08-07 04:24 PM Re: @ras macro buggy.
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
I somehow seem to remember that the @RAS macro is indeed returning the number of active RAS connections and not a boolean flag. Just don't remember why I remember this.
_________________________
There are two types of vessels, submarines and targets.

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 640 anonymous users online.
Newest Members
ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder, M_Moore
17887 Registered Users

Generated in 0.057 seconds in which 0.028 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org