youtuber Posted November 20, 2016 Share Posted November 20, 2016 Hello I want to open the site every time i click on the button Case $Button4 If GUICtrlRead($Button4) = "Next site" Then $sitelisturl = StringSplit(StringStripCR(GUICtrlRead($Edit1)), @LF) GUICtrlSetData($Button4, "Open Site") GUICtrlSetData($Input1, $sitelisturl) Else ShellExecute(GUICtrlRead($Input1)) GUICtrlSetData($Button4, "Next site") EndIf Link to comment Share on other sites More sharing options...
JohnOne Posted November 20, 2016 Share Posted November 20, 2016 You said there was a question, what is it? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
mikell Posted November 20, 2016 Share Posted November 20, 2016 +1 Anyway this at least won't work : $sitelisturl = StringSplit(StringStripCR(GUICtrlRead($Edit1)), @LF) GUICtrlSetData($Input1, $sitelisturl) because StringSplit returns an array Link to comment Share on other sites More sharing options...
youtuber Posted November 20, 2016 Author Share Posted November 20, 2016 (edited) I want to do something like this #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 473, 327, 192, 124) $Edit1 = GUICtrlCreateEdit("", 64, 72, 329, 169) GUICtrlSetData(-1, "") $Input1 = GUICtrlCreateInput("", 64, 32, 329, 21) $Button4 = GUICtrlCreateButton("Open Site", 72, 256, 75, 25) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button4 If GUICtrlRead($Button4) = "Next site" Then $sitelisturl = GUICtrlRead($Edit1, @LF) GUICtrlSetData($Button4, "Open Site") GUICtrlSetData($Input1, $sitelisturl) Else ShellExecute(GUICtrlRead($Input1)) GUICtrlSetData($Button4, "Next site") EndIf EndSwitch WEnd Edited November 20, 2016 by youtuber Link to comment Share on other sites More sharing options...
mikell Posted November 20, 2016 Share Posted November 20, 2016 Not sure the way you chose is very convenient... but this works #include <GUIConstantsEx.au3> #include <StringConstants.au3> #Include <Array.au3> ; sample list $sList = "https://www.autoitscript.com" & @crlf & "https://www.google.com" $Form1 = GUICreate("Form1", 473, 327, 192, 124) $Edit1 = GUICtrlCreateEdit("", 64, 72, 329, 169) GUICtrlSetData($Edit1, $sList) $Input1 = GUICtrlCreateInput("", 64, 32, 329, 21) $Button4 = GUICtrlCreateButton("Next Site", 72, 256, 75, 25) GUISetState(@SW_SHOWNA) $aList = StringSplit(GUICtrlRead($Edit1), @crlf, $STR_ENTIRESPLIT) ;_ArrayDisplay($aList) $n = 0 While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button4 If GUICtrlRead($Button4) = "Next site" Then $n += 1 GUICtrlSetData($Input1, $aList[$n] ) GUICtrlSetData($Button4, "Open Site") Else ShellExecute(GUICtrlRead($Input1)) GUICtrlSetData($Button4, "Next site") EndIf EndSwitch WEnd youtuber 1 Link to comment Share on other sites More sharing options...
youtuber Posted November 20, 2016 Author Share Posted November 20, 2016 @mikell thank you How should I be for a message box when the links end? Thank you #include <GUIConstantsEx.au3> #include <StringConstants.au3> $sList = "https://www.autoitscript.com" & @crlf & "https://www.google.com" $Form1 = GUICreate("Form1", 473, 327, 192, 124) $Edit1 = GUICtrlCreateEdit("", 64, 72, 329, 169) GUICtrlSetData($Edit1, $sList) $Input1 = GUICtrlCreateInput("", 64, 32, 329, 21) $Button4 = GUICtrlCreateButton("Next Site", 72, 256, 75, 25) GUISetState(@SW_SHOWNA) $aList = StringSplit(GUICtrlRead($Edit1), @crlf, $STR_ENTIRESPLIT) $n = 0 While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button4 If GUICtrlRead($Button4) = "Next site" Then $n += 1 GUICtrlSetData($Input1, $aList[$n] ) If @error Then MsgBox(0,"finish","links it is over") GUICtrlSetData($Button4, "Open Site") Else ShellExecute(GUICtrlRead($Input1)) GUICtrlSetData($Button4, "Next site") EndIf EndIf EndSwitch WEnd Link to comment Share on other sites More sharing options...
mikell Posted November 20, 2016 Share Posted November 20, 2016 Remember the StringSplit, the number of sites is in $aList[0] Case $Button4 If GUICtrlRead($Button4) = "Next site" Then $n += 1 If $n > $aList[0] Then MsgBox(0,"finish","links it is over") Continueloop EndIf GUICtrlSetData($Input1, $aList[$n] ) GUICtrlSetData($Button4, "Open Site") Else ShellExecute(GUICtrlRead($Input1)) GUICtrlSetData($Button4, "Next site") EndIf youtuber 1 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