methodclass Posted November 16, 2007 Share Posted November 16, 2007 hello all,using @ipaddress1 to obtain the primary ip address of the machine script is being run from. it works fine onmy windows xp workstation and a few windows nt4/2000 machines, but i get the odd nt4/2000 workstation thatdisplays;'Line -1:Error: Error in expression'ive confirmed it is @ipaddress1 causing this error, as i made a copy of the script and replaced any reference to@ipaddress1 with a string (containing an ip address) and the script runs fine.i care little about the nt4 workstations, but id like to get a consistent result from the windows 2000 machines...any ideas? Link to comment Share on other sites More sharing options...
phearkrypt Posted November 16, 2007 Share Posted November 16, 2007 (edited) #include<inet.au3> $errz=objevent("autoit.error","errplx") $obj=objcreate("winhttp.winhttprequest.5.1") $obj.open("post","http://www.google.com",false) msgbox(0+64,"notify","your"&" "&"ip"&" "&"is:"&" "&_getip()) func errplx() msgbox(0+16,"error","zomgs"&" "&"you"&" "&"has"&" "&"no"&" "&"intarwebz!1one1337") exit endfunc Edited November 16, 2007 by phearkrypt Link to comment Share on other sites More sharing options...
methodclass Posted November 16, 2007 Author Share Posted November 16, 2007 (edited) #include<inet.au3> msgbox(0+64,"notify","your"&" "&"ip"&" "&"is:"&" "&_getip()) when i use this, i receive a box saying 'your ip is: -1' both on windows nt4 and windows xp.. dont have a windows 2000 ws handy at the moment [update, just tried your other piece of code, same problem] Edited November 16, 2007 by logik Link to comment Share on other sites More sharing options...
phearkrypt Posted November 16, 2007 Share Posted November 16, 2007 (edited) Could you try to run this: run(@comspec&" "&"/c ipconfig") Edited November 16, 2007 by phearkrypt Link to comment Share on other sites More sharing options...
methodclass Posted November 16, 2007 Author Share Posted November 16, 2007 could you try to run this: run(@comspec&" "&"/c ipconfig") yes that works.. but? Link to comment Share on other sites More sharing options...
phearkrypt Posted November 16, 2007 Share Posted November 16, 2007 (edited) Great. Try to use stdoutread() works great, I could help you if its too hard. Edited November 16, 2007 by phearkrypt Link to comment Share on other sites More sharing options...
methodclass Posted November 16, 2007 Author Share Posted November 16, 2007 Great. Try to use StdoutRead() works great, I could help you if its too hard. i think rather than waste time writing huge ugly routines that parse command line output, the bug should rather be fixed. its ok, will continue to use @ipaddress1 thankyou for your help phearkrypt Link to comment Share on other sites More sharing options...
weaponx Posted November 16, 2007 Share Posted November 16, 2007 If there is a real problem with a builtin function you should post in Bug Reports with exact Windows versions / service pack levels Link to comment Share on other sites More sharing options...
methodclass Posted November 16, 2007 Author Share Posted November 16, 2007 If there is a real problem with a builtin function you should post in Bug Reports with exact Windows versions / service pack levelsno prob was just doing that now Link to comment Share on other sites More sharing options...
phearkrypt Posted November 16, 2007 Share Posted November 16, 2007 (edited) #include<constants.au3> #include<string.au3> #include<array.au3> msgbox(0+64,"notify",getip()) func getip() $cmd=run(@comspec&" "&"/c ipconfig","",@sw_hide,$stdout_child) $stdr=stdoutread($cmd) $str=_stringbetween($stdr,"192"," "&" "&" "&" "&" "&" "&" "&" "&"Subnet") _arraytoclip($str) clipput("192"&clipget()) return clipget() endfuncUpdated.NOTE: There is something odd with the spaces. I dont have time to fix that. Edited November 16, 2007 by phearkrypt Link to comment Share on other sites More sharing options...
methodclass Posted November 16, 2007 Author Share Posted November 16, 2007 #include<constants.au3>#include<string.au3>#include<array.au3>msgbox(0+64,"notify",getip())func getip()$cmd=run(@comspec&" "&"/c ipconfig","",@sw_hide,$stdout_child)$stdr=stdoutread($cmd)$str=_stringbetween($stdr,"192"," "&" "&" "&" "&" "&" "&" "&" "&"Subnet")_arraytoclip($str)clipput("192"&clipget())return clipget()endfuncnot all networks use 192. as the network address, in my case we use 10. and public interface 165.thanks for helping mate, i'll leave this one to be fixed in the next revision of autoit Link to comment Share on other sites More sharing options...
phearkrypt Posted November 16, 2007 Share Posted November 16, 2007 Well, Just to give you a quick start. I hope that its pretty much as you wanted. Link to comment Share on other sites More sharing options...
AzKay Posted November 16, 2007 Share Posted November 16, 2007 This most probably wont be "fixed", because AutoIt is meant for XP, But, might oo; # MY LOVE FOR YOU... IS LIKE A TRUCK- # Link to comment Share on other sites More sharing options...
Nahuel Posted November 16, 2007 Share Posted November 16, 2007 This most probably wont be "fixed", because AutoIt is meant for XP, But, might oo;AutoIt is for XP? Now where did you get that from? @logik: I have a Win2000 ws. Could you post a reproducer script? I've used this macro and it works fine. Link to comment Share on other sites More sharing options...
Developers Jos Posted November 16, 2007 Developers Share Posted November 16, 2007 This most probably wont be "fixed", because AutoIt is meant for XP, But, might oo;Good contribution... about as good as saying "that you don't have the foggiest idea what you are talking about but want to say something anyways..".@logik,Log the value of @ipaddress1 in a file or something so you can see why things go wrong on those machines.What is your script doing with this IPAddress ? Show some code that you think is causing the issue so we can see what is happening.Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
methodclass Posted November 18, 2007 Author Share Posted November 18, 2007 Good contribution... about as good as saying "that you don't have the foggiest idea what you are talking about but want to say something anyways..".@logik,Log the value of @ipaddress1 in a file or something so you can see why things go wrong on those machines.What is your script doing with this IPAddress ? Show some code that you think is causing the issue so we can see what is happening.Joshey dude..@ipaddress1 simply needs to be referenced for the error to occur, it halts program execution (ie. not just a warning)have put this up to the bugs section but simply do not have the time to jump through the hoops they want me to do with testing.its a very isolated bug by the looks but ive had it occur on a few workstations now. Link to comment Share on other sites More sharing options...
SkinnyWhiteGuy Posted November 18, 2007 Share Posted November 18, 2007 If you, who found the bug and posted about the bug, don't have time to test it out, then tough luck. You are the only one who has seen the exact error message, and just telling them a simple "just use it, it breaks" doesn't help cause they wouldn't have released AutoIt with it in there if it was broken for most cases. Those "hoops", as you call them, are the dev team's attempts at trying to reproduce the bug, and only you can help with that. If you feel that it would be a waste of time doing that, then learn to script around the bug, cause they can't fix something they can't find, and it would be a "waste of their time" to go trying to reinstall/setup a bunch of different workstations in an attempt to recreate one small error that only 1 person has submitted, when they have lives of their own, as well as other bugs/features to implement. In short, either help yourself by helping the devs, or drop it. Link to comment Share on other sites More sharing options...
Developers Jos Posted November 18, 2007 Developers Share Posted November 18, 2007 (edited) hey dude..@ipaddress1 simply needs to be referenced for the error to occur, it halts program execution (ie. not just a warning)have put this up to the bugs section but simply do not have the time to jump through the hoops they want me to do with testing.its a very isolated bug by the looks but ive had it occur on a few workstations now.Are you 100% sure there is no other statement needed than just @IPAddress1 to make it error out ?Anything special on the PC that makes it error out ?Does it also error out when running with AutoIt3.exe on that specific PC and what is the exact error when using that ?Jos Edited November 18, 2007 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now