jgq85 Posted March 7, 2013 Posted March 7, 2013 I've got a working GUI with script but I'm trying to change from a single input to a multiline inputWhat's a good way to to take multi lines in the box, say I have three lines in the input box:123452345634567Then I want AUtoIt to type out into a box (I switch to the box in another piece of code from a button function), but want it to Send a string, such as the Bing URL search then at the end of the URL it will insert the Asset numbers I put in. Since there are 3 asset numbers it will send three Bing search URL's total, each containing the next asset number I have in the input box...(typed in notepad, for example):http://www.bing.com/search?q=12345http://www.bing.com/search?q=23456http://www.bing.com/search?q=34567GUI:$Assets = GUICtrlCreateEdit("", 0, 56, 105, 81)Related code within script:$AssetNumbersText = GUICtrlRead($Assets, 1) ; reads the text of the edit box Send("Asset <a href=" & chr(34) & "http://www.bing.com/search?q=") ; Types out "Asset" and then the html hyperlink text for a Bing search Send($AssetNumbersText & chr(34) & ">" & $AssetNumbersText & "</a>") ; Types out Asset # from each line and completes the html hyperlink tag
Moderators Melba23 Posted March 7, 2013 Moderators Posted March 7, 2013 jgq85,Read the contents of your edit control and split it into lines with StringSplit. Then loop through the array and concatenate the prefix with the contents of each line: #include <GUIConstantsEx.au3> $hGUI = GUICreate("Test", 500, 500) $cEdit = GUICtrlCreateEdit("", 10, 10, 200, 200) GUICtrlSetData($cEdit, "12345" & @CRLF & "23456" & @CRLF & "34567") $cButton = GUICtrlCreateButton("Read", 10, 300, 80, 30) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cButton $sText = GUICtrlRead($cEdit) $aText = StringSplit($sText, @CRLF, 1) For $i =1 To $aText[0] ConsoleWrite("http://www.bing.com/search?q=" & $aText[$i] & @CRLF) Next EndSwitch WEndAll clear? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
jgq85 Posted April 3, 2013 Author Posted April 3, 2013 Thanks so much, it works great. I need to figure out how to add a text box, or a drag bag, and use it to establish a Number figure. Then, the script will loop based on that number, instead of reading how many lines I have in the text box. So far I just have: Local $i = 0 Do WinActivate("Custom Window 2013", "") Send("http://oursearch.domain.com/assetid=" & "^v") $i = $i + 1 Until $i = 20 So my other GUI field would have to be something readable to set a number for "until" that $i could become equal to?
Moderators Melba23 Posted April 3, 2013 Moderators Posted April 3, 2013 jgq85,To get a simple user-selectable number I would use an input with an updown - look in the Help file to see how to code them. And I would suggest using a For...Next loop - why not let AutoIt look after the counting for you. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
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