Page 1 of 1 1
Topic Options
#196722 - 2009-11-17 09:28 AM Select login script with ip address
Lennart Offline
Just in Town

Registered: 2009-11-16
Posts: 2
Loc: Nijmegen, Holland
Hello all,

When running this script I get the following error:
ERROR invalid method/function call: missing '<'
Line 11

So there must be an error in the line with octet1 in it.

Can somebody help me with this error?

 Code:

setconsole

;$octet1      = octet 1 of the ipaddress 
;$octet2      = octet 2 of the ipaddress 
;$octet3      = octet 3 of the ipaddress 
;$octet4      = octet 4 of the ipaddress 
;$ipadr         = ipaddress without spaces

;Ip-address opsplitsen voor eenvoudiger gebruik 
$octet1 = Ltrim(SubStr(@IPADDRESS0, 1, 3)) ; Start positie 1ste octet en lengte 
$octet2 = Ltrim(SubStr(@IPADDRESS0, 5, 3)) ; Start positie 2de octet en lengte
$octet3 = Ltrim(SubStr(@IPADDRESS0, 9, 3)) ; Start positie 3de octet en lengte
$octet4 = Ltrim(SubStr(@IPADDRESS0, 13, 3)) ; Start positie 4de octet en lengte
$IPADR = "$octet1.$octet2.$octet3.$octet4" ; weergave

;Zoeken in welk subnet de pc zit...
If ($octet2 = 18)
      Goto Streekweg
   EndIf
If ($octet3 = 46)
      Goto Leuvensbroek
   EndIf
If ($octet3 = 151)
      Goto Eweg
   EndIf
   
:Streekweg
Call $netlogon+"\printer.kix"

:Leuvensbroek
Call $netlogon+"\login.kix"

:Eweg
Call $netlogon+"\Elogin.kix"

exit

Top
#196723 - 2009-11-17 10:18 AM Re: Select login script with ip address [Re: Lennart]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Hi Lennart,

Nice to see an other Dutch guy here.

A small rewrite of your code is below. The brackets at the If statements are not needed and GoTo's are considered very old school and should be avoided like the plaque \:\)

 Code:
;$octet1      = octet 1 of the ipaddress 
;$octet2      = octet 2 of the ipaddress 
;$octet3      = octet 3 of the ipaddress 
;$octet4      = octet 4 of the ipaddress 
;$ipadr         = ipaddress without spaces

;Ip-address opsplitsen voor eenvoudiger gebruik 
$octet1 = LTrim(SubStr(@IPADDRESS0, 1, 3)) ; Start positie 1ste octet en lengte 
$octet2 = LTrim(SubStr(@IPADDRESS0, 5, 3)) ; Start positie 2de octet en lengte
$octet3 = LTrim(SubStr(@IPADDRESS0, 9, 3)) ; Start positie 3de octet en lengte
$octet4 = LTrim(SubStr(@IPADDRESS0, 13, 3)) ; Start positie 4de octet en lengte
$IPADR = "$octet1.$octet2.$octet3.$octet4" ; weergave

;Zoeken in welk subnet de pc zit...
Select
	Case $octet2 = "18"
		Call $netlogon+"\printer.kix"
	Case $octet3 = "46"
		Call $netlogon+"\login.kix"
	Case $octet3 = "151"
		Call $netlogon+"\Elogin.kix"
EndSelect
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#196726 - 2009-11-17 12:42 PM Re: Select login script with ip address [Re: Mart]
Lennart Offline
Just in Town

Registered: 2009-11-16
Posts: 2
Loc: Nijmegen, Holland
Great Mart!

The script works fine! Thank you for helping me. I'm 'Just in Town', I have to learn alot about Kix scripting.

Grtz Lennart

Top
#196728 - 2009-11-17 02:31 PM Re: Select login script with ip address [Re: Lennart]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
We all stared out like that once.

Stick around and lurk all you can. If you have questions don’t be afraid to post them.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

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 323 anonymous users online.
Newest Members
Audio, Hoschi, Comet, rrosell, PatrickPinto
17880 Registered Users

Generated in 0.079 seconds in which 0.05 seconds were spent on a total of 13 queries. Zlib compression enabled.

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