TomDuDolan Posted May 28, 2011 Share Posted May 28, 2011 Hello Autoit forumers. I am having a bit of trouble displaying output from my code. This is my code: expandcollapse popup#include <IE.au3> #include <string.au3> #include <GuiConstantsEx.au3> #include <AVIConstants.au3> GUICreate("Scriptr",335,203,0,0) SoundPlay("http://scriptr.uk.to/gensound.mp3") $button1=GuiCtrlCreateButton("Router Addresses page",150,170,185,40) $button2=GuiCtrlCreateButton("**** 'em up 'n' Generate!",0,170,150,40) $input1=GuiCtrlCreateInput("MAC_1",0,0,167,20) $input2=GuiCtrlCreateInput("MAC_2",0,20,167,20) $input3=GuiCtrlCreateInput("MAC_3",167,0,167,20) $input4=GuiCtrlCreateInput("MAC_4",167,20,167,20) $input5=GuiCtrlCreateInput("MAC_5",0,40,167,20) $input6=GuiCtrlCreateInput("MAC_6",0,60,167,20) $input7=GuiCtrlCreateInput("MAC_7",167,40,167,20) $input8=GuiCtrlCreateInput("MAC_8",167,60,167,20) GUICtrlCreateLabel("Enjoy the music ;)",0,80,167, 60) $button3=GuiCtrlCreateButton("Click to Exit", 167, 80, 167 ,30) GuiSetState() While 1 $msg=GuiGetMsg() If $msg=-3 Then Exit If $msg=$button1 Then button1() If $msg=$button2 Then button2() If $msg=$button3 Then button3() Wend Func button1() $oIE = _IECreate ("http://scriptr.uk.to/forums/") $oIE = _IECreate ("http://192.168.100.1/addresses.html") _IELoadWait ($oIE) EndFunc Func button2() ;MAC output 1 - which is 00D0xxxxxxxxx ;To be displayed in $input1 $Characters = StringSplit("ABEFCD123456789", "") $SerialNumber = "00D0" For $X = 1 To 8 For $I = 2 To 2 $SerialNumber &= $Characters[Random(1, 15, 1)] Next If $X <> 2 Then $SerialNumber &= "" Next ClipPut ($SerialNumber) Return $SerialNumber EndFunc Func button3() MsgBox(64, "http://scriptr.uk.to says", "Goodbye ^_^'") Exit EndFunc As you can probably see, I want this code here $Characters = StringSplit("ABEFCD123456789", "") $SerialNumber = "00D0" For $X = 1 To 8 For $I = 2 To 2 $SerialNumber &= $Characters[Random(1, 15, 1)] Next If $X <> 2 Then $SerialNumber &= "" Next ClipPut ($SerialNumber) Return $SerialNumber ;to generate a MAC address and to output it in $input1 ;I know it's an input box but it's so it can be highlighted then C&P'd You can probably tell that I am new to autoit but I have been on and off AU for a few years now, but that was just to create funny messages. This seems too complex for me. I have tried different formations in the code, trying to get it to output but still nothing. Can you help me please? Thanks in advance. -Tom. My ickle pieces of software :3Radio Scriptr //Almost completeSimple IP/URL pinger, my first program. //CompletedSimple Downloader // Working - basic stateOn-GoingRadio Scriptr - Radio Server. Link to comment Share on other sites More sharing options...
sleepydvdr Posted May 28, 2011 Share Posted May 28, 2011 I think this is what you are wanting to do. I added comments for why I changed some things: expandcollapse popup#include <IE.au3> #include <string.au3> #include <GuiConstantsEx.au3> #include <AVIConstants.au3> Global $SerialNumber ;$SerialNumber = "MAC_1" ; Do the same for the other MAC_numbers GUICreate("Scriptr",335,203,0,0) SoundPlay("http://scriptr.uk.to/gensound.mp3") $button1=GuiCtrlCreateButton("Router Addresses page",150,170,185,40) $button2=GuiCtrlCreateButton("**** 'em up 'n' Generate!",0,170,150,40) $input1=GuiCtrlCreateInput("MAC_1",0,0,167,20) $input2=GuiCtrlCreateInput("MAC_2",0,20,167,20) $input3=GuiCtrlCreateInput("MAC_3",167,0,167,20) $input4=GuiCtrlCreateInput("MAC_4",167,20,167,20) $input5=GuiCtrlCreateInput("MAC_5",0,40,167,20) $input6=GuiCtrlCreateInput("MAC_6",0,60,167,20) $input7=GuiCtrlCreateInput("MAC_7",167,40,167,20) $input8=GuiCtrlCreateInput("MAC_8",167,60,167,20) GUICtrlCreateLabel("Enjoy the music ;)",0,80,167, 60) $button3=GuiCtrlCreateButton("Click to Exit", 167, 80, 167 ,30) GuiSetState() While 1 $msg=GuiGetMsg() If $msg=-3 Then Exit If $msg=$button1 Then button1() If $msg=$button2 Then button2() If $msg=$button3 Then button3() Wend Func button1() $oIE = _IECreate ("http://scriptr.uk.to/forums/") $oIE = _IECreate ("http://192.168.100.1/addresses.html") _IELoadWait ($oIE) EndFunc Func button2() ;MAC output 1 - which is 00D0xxxxxxxxx ;To be displayed in $input1 $Characters = StringSplit("ABEFCDEF123456789", "") ; <-- Added E & F because Hex values go up to F For $X = 1 To 8 $SerialNumber = "00D0" ; <-- Moved to this location to re-initialize for each loop For $I = 2 To 2 $SerialNumber &= $Characters[Random(1, 17, 1)] ; <-- Changed 15 to 17 because of E & F being added Next If $X = 1 Then GUICtrlSetData($input1, $SerialNumber) ElseIf $X = 2 Then GUICtrlSetData($input2, $SerialNumber) ElseIf $X = 3 Then GUICtrlSetData($input3, $SerialNumber) ElseIf $X = 4 Then GUICtrlSetData($input4, $SerialNumber) ElseIf $X = 5 Then GUICtrlSetData($input5, $SerialNumber) ElseIf $X = 6 Then GUICtrlSetData($input6, $SerialNumber) ElseIf $X = 7 Then GUICtrlSetData($input7, $SerialNumber) Else GUICtrlSetData($input8, $SerialNumber) EndIf If $X <> 2 Then $SerialNumber &= "" Next ClipPut ($SerialNumber) Return $SerialNumber EndFunc Func button3() MsgBox(64, "http://scriptr.uk.to says", "Goodbye ^_^'") Exit EndFunc PS, you should have warned me music was going to start blaring. If I had a heart attack, I wouldn't have been able to help you. #include <ByteMe.au3> Link to comment Share on other sites More sharing options...
TomDuDolan Posted May 28, 2011 Author Share Posted May 28, 2011 (edited) I think this is what you are wanting to do. I added comments for why I changed some things: expandcollapse popup#include <IE.au3> #include <string.au3> #include <GuiConstantsEx.au3> #include <AVIConstants.au3> Global $SerialNumber ;$SerialNumber = "MAC_1" ; Do the same for the other MAC_numbers GUICreate("Scriptr",335,203,0,0) SoundPlay("http://scriptr.uk.to/gensound.mp3") $button1=GuiCtrlCreateButton("Router Addresses page",150,170,185,40) $button2=GuiCtrlCreateButton("**** 'em up 'n' Generate!",0,170,150,40) $input1=GuiCtrlCreateInput("MAC_1",0,0,167,20) $input2=GuiCtrlCreateInput("MAC_2",0,20,167,20) $input3=GuiCtrlCreateInput("MAC_3",167,0,167,20) $input4=GuiCtrlCreateInput("MAC_4",167,20,167,20) $input5=GuiCtrlCreateInput("MAC_5",0,40,167,20) $input6=GuiCtrlCreateInput("MAC_6",0,60,167,20) $input7=GuiCtrlCreateInput("MAC_7",167,40,167,20) $input8=GuiCtrlCreateInput("MAC_8",167,60,167,20) GUICtrlCreateLabel("Enjoy the music ;)",0,80,167, 60) $button3=GuiCtrlCreateButton("Click to Exit", 167, 80, 167 ,30) GuiSetState() While 1 $msg=GuiGetMsg() If $msg=-3 Then Exit If $msg=$button1 Then button1() If $msg=$button2 Then button2() If $msg=$button3 Then button3() Wend Func button1() $oIE = _IECreate ("http://scriptr.uk.to/forums/") $oIE = _IECreate ("http://192.168.100.1/addresses.html") _IELoadWait ($oIE) EndFunc Func button2() ;MAC output 1 - which is 00D0xxxxxxxxx ;To be displayed in $input1 $Characters = StringSplit("ABEFCDEF123456789", "") ; <-- Added E & F because Hex values go up to F For $X = 1 To 8 $SerialNumber = "00D0" ; <-- Moved to this location to re-initialize for each loop For $I = 2 To 2 $SerialNumber &= $Characters[Random(1, 17, 1)] ; <-- Changed 15 to 17 because of E & F being added Next If $X = 1 Then GUICtrlSetData($input1, $SerialNumber) ElseIf $X = 2 Then GUICtrlSetData($input2, $SerialNumber) ElseIf $X = 3 Then GUICtrlSetData($input3, $SerialNumber) ElseIf $X = 4 Then GUICtrlSetData($input4, $SerialNumber) ElseIf $X = 5 Then GUICtrlSetData($input5, $SerialNumber) ElseIf $X = 6 Then GUICtrlSetData($input6, $SerialNumber) ElseIf $X = 7 Then GUICtrlSetData($input7, $SerialNumber) Else GUICtrlSetData($input8, $SerialNumber) EndIf If $X <> 2 Then $SerialNumber &= "" Next ClipPut ($SerialNumber) Return $SerialNumber EndFunc Func button3() MsgBox(64, "http://scriptr.uk.to says", "Goodbye ^_^'") Exit EndFunc PS, you should have warned me music was going to start blaring. If I had a heart attack, I wouldn't have been able to help you. Haha thank you! Will give it a whirl. I integrated the music so I had something to listen to while being bored modifying the whole script over and over. That's excelent! Thank you! Now from what you put in, I will be able to learn from that thanks for adding the reason why you changed the script. -Tom. Edited May 28, 2011 by TomDuDolan My ickle pieces of software :3Radio Scriptr //Almost completeSimple IP/URL pinger, my first program. //CompletedSimple Downloader // Working - basic stateOn-GoingRadio Scriptr - Radio Server. 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