sebsabul Posted April 4, 2005 Share Posted April 4, 2005 Hey guys I´ve got a problem! I need some help! this is my script: #include <array.au3> ping("192.168.0.3", 10000) If @error = 0 then runwait(@ComSpec & " /c arp.exe -a > "&@tempdir&"\arplog.txt","",@SW_HIDE) $fic=FileOpen(@tempdir&"\arplog.txt",0) if $fic=-1 then Exit $index=4; the list of IP/MAC begins at the 4th line of the file (for my case you have to verify !) $tab_mac=""; array to stock mac while 1 $line=FileReadLine($fic,$index) if @error=-1 then ExitLoop $mac=StringMid($line,25,17); position of the mac in the line (verify for your case) $tab_mac=$tab_mac&$mac&";" $index=$index+1 WEnd $tab_mac=StringSplit($tab_mac,";") ;now You've got an array with : $tab_mac[0]=nbre of mac+1 in the array, $tab_mac[1]=mac1 .... Select Case $tab_mac[0] = "00-50-8d-52-35-87" MsgBox(4096, "Test", "TRUE", 10) Case $tab_mac[1] = "00-50-8d-52-35-87" MsgBox(4096, "Test", "TRUE", 10) Case $tab_mac[2] = "00-50-8d-52-35-87" MsgBox(4096, "Test", "TRUE", 10) Case $tab_mac[3] = "00-50-8d-52-35-87" MsgBox(4096, "Test", "TRUE", 10) Case $tab_mac[4] = "00-50-8d-52-35-87" MsgBox(4096, "Test", "TRUE", 10) Case $tab_mac[5] = "00-50-8d-52-35-87" MsgBox(4096, "Test", "TRUE", 10) Case $tab_mac[6] = "00-50-8d-52-35-87" MsgBox(4096, "Test", "TRUE", 10) Case $tab_mac[7] = "00-50-8d-52-35-87" MsgBox(4096, "Test", "TRUE", 10) Case $tab_mac[8] = "00-50-8d-52-35-87" MsgBox(4096, "Test", "TRUE", 10) Case $tab_mac[9] = "00-50-8d-52-35-87" MsgBox(4096, "Test", "TRUE", 10) Case $tab_mac[10] = "00-50-8d-52-35-87" MsgBox(4096, "Test", "TRUE", 10) Case Else MsgBox(4096, "Test", "FALSE", 10) EndSelect Else do sleep(10000) ping("192.168.0.3", 10000) until @error = 0 EndIF My Problem: If Case $tab_mac[3] ($tab_mac[4], $tab_mac[5],....) should not exist, the script/exe shows an error: ( Not found..) How can i disable the error report or how can i change my script, so that no error is visible?? thank you.. Link to comment Share on other sites More sharing options...
Developers Jos Posted April 4, 2005 Developers Share Posted April 4, 2005 For $x = 1 to $tab_mac[0] if $tab_mac[$x] = "00-50-8d-52-35-87" then MsgBox(4096, "Test", "TRUE", 10) EndIf Next 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...
sebsabul Posted April 4, 2005 Author Share Posted April 4, 2005 Thank you, I understand your way, but I´m too stupid to place it in my script. Can you give me the complete script please? Link to comment Share on other sites More sharing options...
Developers Jos Posted April 4, 2005 Developers Share Posted April 4, 2005 Thank you, I understand your way, but I´m too stupid to place it in my script. Can you give me the complete script please?<{POST_SNAPBACK}>Well, logic says that if you understand you shpould be able to apply it. But whats wrong with as is ?? (in stead of the Select Case stuff) 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...
sebsabul Posted April 4, 2005 Author Share Posted April 4, 2005 (edited) Oh instead of the case stuff? I tried it, but it isn´t work... Edited April 4, 2005 by sebsabul Link to comment Share on other sites More sharing options...
Developers Jos Posted April 4, 2005 Developers Share Posted April 4, 2005 Oh instead of the case stuff? I tried it, but it isn´t work...<{POST_SNAPBACK}>yes... and am I now supposed to guess why and give an answer without any more details provided? :"> The code i gave was to avoid Array errors.... But i didn't really look at the logic of your script. To understand where things go wrong you start added msgboxes that display the key Variables to determine whats going wrong.If you are using SciTE you can add Console debug messages with Alt+D ...This is the fun part of programming called debugging 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...
sebsabul Posted April 4, 2005 Author Share Posted April 4, 2005 mhmm there is no error, wenn i place your script: It happens nothing! the programm works and then exit.. without an error.. i don´t know..why Link to comment Share on other sites More sharing options...
Developers Jos Posted April 4, 2005 Developers Share Posted April 4, 2005 (edited) mhmm there is no error, wenn i place your script: It happens nothing! the programm works and then exit.. without an error.. i don´t know..why<{POST_SNAPBACK}>I don't want to be rude but did you read my post at all ?The people in the forum can only help if you give enough details. A "Doesn't work" statement requires a "Cristal ball" approach.... Edited April 4, 2005 by JdeB 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...
sebsabul Posted April 4, 2005 Author Share Posted April 4, 2005 sorry, yeah i read all your post ^^ i´m so unhappy i understand nothing... i spend hours, no days this script... ok, i will try it. I post it when i have it... thanks. Link to comment Share on other sites More sharing options...
Developers Jos Posted April 4, 2005 Developers Share Posted April 4, 2005 sorry, yeah i read all your post ^^i´m so unhappy i understand nothing... i spend hours, no days this script...ok, i will try it. I post it when i have it... thanks.<{POST_SNAPBACK}>This is what i mean with debugging your script... this should display all found Mac addresses that are returned by ARP... #include <array.au3> Ping("192.168.0.3", 10000) If @error = 0 Then RunWait(@ComSpec & " /c arp.exe -a > " & @TempDir & "\arplog.txt", "", @SW_HIDE) $fic = FileOpen(@TempDir & "\arplog.txt", 0) If $fic = -1 Then Exit $index = 4; the list of IP/MAC begins at the 4th line of the file (for my case you have to verify !) $tab_mac = ""; array to stock mac While 1 $line = FileReadLine($fic, $index) If @error = -1 Then ExitLoop $mac = StringMid($line, 25, 17); position of the mac in the line (verify for your case) $tab_mac = $tab_mac & $mac & ";" $index = $index + 1 WEnd $tab_mac = StringSplit($tab_mac, ";") ;now You've got an array with : $tab_mac[0]=nbre of mac+1 in the array, $tab_mac[1]=mac1 .... For $x = 1 to $tab_mac[0] MsgBox(262144,'Debug line ~20','Selection:' & @lf & '$tab_mac[$x]' & @lf & @lf & 'Return:' & @lf & $tab_mac[$x] & @lf & @lf & '@Error:' & @lf & @Error & @lf & @lf & '@Extended:' & @lf & @Extended);### Debug MSGBOX if $tab_mac[$x] = "00-50-8d-52-35-87" then MsgBox(4096, "Test", "TRUE", 10) EndIf Next Else MsgBox(0,"Ping Failed","Cannot ping 192.168.0.3") EndIfhappy debugging... 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...
sebsabul Posted April 4, 2005 Author Share Posted April 4, 2005 sorry it was my mistake . it works thank you VERY much!! 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