Astray71 Posted February 2, 2019 Share Posted February 2, 2019 Apologies as I am new to Autoit. I'm looking to copy/paste text to notepad, parse it line by line, search if a substring exists in the line and if it does, save the entire line to clipboard to append to a url. Below is what I have so far and I'm not sure what I'm missing... #include <file.au3> $sStart = "https://" $sEnd = "/static/directory/path/" send(^a) send(^c) run("notepad.exe") send(^v) While 1 $line = FileReadLine("Untitled - Notepad") If StringInStr ($line, $sEnd) > 0 Then ClipPut($line) If @error = -1 Then ExitLoop MsgBox(0,'',$line) WEnd FileClose($file) Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 2, 2019 Moderators Share Posted February 2, 2019 Moved to the appropriate forum. Moderation Team 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 Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted February 2, 2019 Share Posted February 2, 2019 Hi @Astray71, and welcome to the AutoIt forums Look at Win* and Control* functions to copy-paste text from a window. File* functions work directly with files and/or handles, so, your code will never do what you're expecting Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
Skysnake Posted February 2, 2019 Share Posted February 2, 2019 Hi Different question: Why put it in Notepad? If you have the FILE (file on disk?) read the file into an array, and search that in memory? Why in Notepad? Skysnake Why is the snake in the sky? Link to comment Share on other sites More sharing options...
orbs Posted February 3, 2019 Share Posted February 3, 2019 21 hours ago, Skysnake said: Why put it in Notepad? because the OP is making his first steps into scripting, and unaware of the difference between AutoIt capabilities of automating an external program, and AutoIt programming capabilities. @Astray71, Skysnake is correct, of course. if the file is not too large, use _FileReadToArray() to read the entire file into an array, then loop the array and do what you want with every line. Signature - my forum contributions: Spoiler UDF: LFN - support for long file names (over 260 characters) InputImpose - impose valid characters in an input control TimeConvert - convert UTC to/from local time and/or reformat the string representation AMF - accept multiple files from Windows Explorer context menu DateDuration - literal description of the difference between given dates Apps: Touch - set the "modified" timestamp of a file to current time Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes SPDiff - Single-Pane Text Diff 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