|
|
|||||||
hi everyone, i'm new to kixtart and i'd like to ask a few questions if anyone would be so kind to answer, i've recently been creating a script to define default printers across a network of 18 remote centres, thing is i'm new to all this and the function i'd like to use i dont understand, the function is the isiniprange one, i dont understand how the dependencies work and what i need to do to create the script so that it'll check the local machines ip address against that defined in the array of said function, anyway thats quite a lot to read so i'll leave it with you guys if you dont mind, thanks for any help you might be able to give me guys, Anth |
||||||||
|
|
|||||||
heh, don't worry... I've been checking and reading it many times and have not understood it by this date! |
||||||||
|
|
|||||||
That's a first, Jooel admitting that he doesn't get a UDF. Maybe we should convert it into the next KiXGolf challenge? Make IsInIPRange smaller and remove the dependencies? Anyway, I think the UDF is straight-forward. However, I also wrote it First of all, please read TCP/IP Primer, Part I - IP Addresses to refresh your TCP/IP network knowledge. Secondly, you'll need to include IsInIPRange and it's two dependiencies in your script as e.g. described in How to use UDFs . Finally, you feed the IP address and an array of networkIDs/subnets into the UDF and you will get a return statement indicating whether the IP address is part of the network. Please implement the example provided in the function header to see how it works. |
||||||||
|
|
|||||||
thanks guys, you've given me a bit of insight into kix, and i feel a little more confident now, and now i'm just gonna have to play about with my script and include the necessary functions (of which i wasnt sure i had to do before), so many thanks guys and if i ever see you out sometime just tap me on the shoulder and i'll buy you a drink. Anth |
||||||||
|
|
|||||||
mm... what drink? scotch? |
||||||||
|
|
|||||||
yeah will a double do? |
||||||||
|
|
|||||||
that sounds nice... even almost worth to travel to england for just that drink |
||||||||
|
|
|||||||
No rocks for me, please |
||||||||
|
|
|||||||
okay guys i think i'm getting there, but could you have a look at this and tell me where i'm going wrong please, oh and dont worry about ice lads, i'll buy you a bottle of glenfiddich each for helping me out, ; DEFAULTPRINTER ; To retrieve local machines IP address and cross reference it against a set of defined subnets ; ; AUTHOR Anthony Alderson CALL "binaryip.kix" CALL "ipmask.kix" CALL "isinsubnet.kix" CALL "isiniprange.kix" $ipaddress='@IPADDRESS0' $iparray[0]='192.168. 12. 0/255.255.255. 0' ;ragworth IF $ipaddress=$iparray[0] ? "you stink" sleep 3 ELSE ? "guess you dont stink after all" sleep 3 ENDIF |
||||||||
|
|
|||||||
drinks ! oh boy, can I help too ? |
||||||||
|
|
|||||||
well, from the function example I can tell:
[ 25. April 2003, 15:28: Message edited by: Lonkero ] |
||||||||
|
|
|||||||
The CALLs to the UDFs are too optimistic. You should also combine them into one file and use a UDF extension. CALL "binaryip.kix" CALL "ipmask.kix" CALL "isinsubnet.kix" CALL "isiniprange.kix" Could become: CALL @ScriptDir+'\IPLibrary.udf' |
||||||||
|
|
|||||||
Hmm, there's a reason why there's an example part in the function header And I believe it should also handle the spaces in the IP addresses, too. |
||||||||
|
|
|||||||
BOOOOZE !!!! whats your problems ? |
||||||||
|
|
|||||||
sorry Jpo, I got here first |
||||||||
|
|
|||||||
thanks lonkero, i've tried your revised script but it doesnt work at present, simply telling me it expects an expression in line 13 which is the 'if isiniprange.......' not sure why its doing as i'm inexperienced at this but shouldnt i split up my @ipaddress0 and the range i'm looking in somehow. oh and i've drunk half the bottle lads so we need quicker responses lol, but cheers all of you anyway for helping me out, Anth |
||||||||
|
|
|||||||
yeah jens i saw that, so if i try it using your example and calling in the outside udf's at the start you think i could tweak it to set the printer up, oh and by the way you're so bloody vague with your replies i can hardly see them on screen lol, cheers, Anth |
||||||||
|
|
|||||||
anthony, make sure the calling lines are proper. I might suggest you do: code:in this situation if script run during logon, they have to be in the same dir as logonscript.CALL @scriptdir+"\isiniprange.kix" the expression error suggests right that, the load has failed. |
||||||||
|
|
|||||||
yeah, the b00ze... no worries man, I have vodka waiting at home |
||||||||
|
|
|||||||
Since you're only checking for a single subnet, the IsInSubnet() should suffice. IsInIPRage is for cases where you have to check for one of many subnets. We e.g. have three separate subnets for VPN connections. code:$ipaddress=@IPADDRESS0 [ 25. April 2003, 15:42: Message edited by: sealeopard ] |
||||||||
|
|
|||||||
well lads its a success, the damn thing works now and i couldnt have done it without any of you, so many many thanks guys (and girls!) and i'd just like to say what a wonderful resource this bulletin board is, so where do i mail the glenfiddich then?? Cheers Everyone, Anth |
||||||||
|
|
|||||||
Jooel Nieminen tangokuja 4 b 46 40520 JKL Suomi Finland what was the pending part? |
||||||||
|
|
|||||||
its in the post jooel, and not sure what you mean by the pending part? but just to let you know with all your help guys i've managed to edit the script to work across 18 different centres now, so big well done to everyone and dont worry i've put you all in under the author(s). thanks everyone, |
||||||||
|
|
|||||||
pending... I ment what was the last piece you added there to make it work... just for future references. |
||||||||
|
|
|||||||
oh sorry jooel, i'll post the full code monday morning and let you have a look, thanks for all your help though, i think all i was doing wrong was just not calling the dependencies in correctly (by not including the full path) other than that i simply used your approach and then created a select-case to fill in 18 centres worth, the codes only been tested locally but i'll be testing it this week in each of our centres and i'll let you all know how it goes. Anth "He who talks too much and knows very little" |
||||||||
|
|
|||||||
Put the list of centers into an .INI file and read it fromt here. Then you can cycle through them and you can easyly adapt your code. example: code:; .INI file code:$networkids=split(readprofilestring('file.ini','','') |
||||||||
|
|
|||||||
thanks for the hint jens, i think i will do that in future but for now i'm happy to leave it as is, the code runs fine and takes but a second or two to complete its cycle, but i will do that in a future script, maybe when i begin to revise this one, but thanks again jens, and thanks for all your help with the code itself, Anth |