Jump to content
Sign in to follow this  
methodclass

@ipaddress1 flawed

Recommended Posts

methodclass

hello all,

using @ipaddress1 to obtain the primary ip address of the machine script is being run from. it works fine on

my windows xp workstation and a few windows nt4/2000 machines, but i get the odd nt4/2000 workstation that

displays;

'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?

Share this post


Link to post
Share on other sites
phearkrypt

#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 by phearkrypt

Share this post


Link to post
Share on other sites
methodclass

#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 by logik

Share this post


Link to post
Share on other sites
phearkrypt

Could you try to run this:

run(@comspec&" "&"/c ipconfig")
Edited by phearkrypt

Share this post


Link to post
Share on other sites
methodclass

could you try to run this:

run(@comspec&" "&"/c ipconfig")
yes that works.. but?

Share this post


Link to post
Share on other sites
phearkrypt

Great.

Try to use

stdoutread()
works great,

I could help you if its too hard.

Edited by phearkrypt

Share this post


Link to post
Share on other sites
methodclass

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

Share this post


Link to post
Share on other sites
weaponx

If there is a real problem with a builtin function you should post in Bug Reports with exact Windows versions / service pack levels

Share this post


Link to post
Share on other sites
methodclass

If there is a real problem with a builtin function you should post in Bug Reports with exact Windows versions / service pack levels

no prob was just doing that now

Share this post


Link to post
Share on other sites
phearkrypt

#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()
endfunc

Updated.

NOTE: There is something odd with the spaces. I dont have time to fix that. :P

Edited by phearkrypt

Share this post


Link to post
Share on other sites
methodclass

#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()

endfunc

not 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

Share this post


Link to post
Share on other sites
phearkrypt

Well, Just to give you a quick start.

I hope that its pretty much as you wanted.

Share this post


Link to post
Share on other sites
AzKay

This most probably wont be "fixed", because AutoIt is meant for XP, But, might oo;


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites
Nahuel

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? :P

@logik: I have a Win2000 ws. Could you post a reproducer script? I've used this macro and it works fine.

Share this post


Link to post
Share on other sites
Jos

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..".:P

@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


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
methodclass

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..".:P

@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

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.

Share this post


Link to post
Share on other sites
SkinnyWhiteGuy

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.

Share this post


Link to post
Share on other sites
Jos

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 by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×