wzc0014

Select string of text between quotes

2 posts in this topic

Hello, 

I am interested in looking at a chunk of text, selecting the string that is in quotes, and copying it to the clipboard. It will always have quotes at the beginning and end, start with https:// and will always contain .mp3 . But everything else is pretty random. This is an example of a piece of text

Quote

 

suhfiushifuhrifuei file: "https://d1gwazgugjenv6.net/after/bef0re/062316.mp3?Expires=1470376621&Signature=h06vK9xR0mbXaMPKO0eQpBSUJX6hvK7l~AgQgCRMcd6DPJmbuMNOaD8P52pnvaGYrQUZUjBUlTfxXACtGyzgP-AdJZkcUlprGUtL47PAqLeiuu-JEomk2Y13qRB7eWjVVl3v0CfjXvgxQXVlwNob2HrmglVFKkusSJRdOTjuwAAZP89Pf~l3w2p6RFy9gL3E1nq3DQowa9NGIQYEdExLPDOYu5jLPI5lhuH8t8vTAZRCwq6YuJtIQ5vJgrQHkk4q7aECn8T8pGvwmossGjrcz-Ga0KlZiefBwFe7XXV66Xor5SVPkaoN3DTQ07ZuAqEtV5ccd6PyOM0iVLFfYjw__&Key-Pair-Id=APKAJ5GT74YAYAGA4KAA",   APKAJ5GT74YAYAGA4KAA


 

I tried doing something like this but it didn't like the quotes. 

$sStart = "file: ""
$sEnd = "","
$aExtract = _StringBetween($sStart, $sEnd)
ClipPut($aExtract)

 

Or is there a better/easier way to do this?

Share this post


Link to post
Share on other sites



Working with quotes in a string can get hairy fast and _StringBetween returns an array, try this code and see if it doesn't help...

#include <Array.au3>
#include <String.au3>
$string = 'suhfiushifuhrifuei file: "https://d1gwazgugjenv6.net/after/bef0re/062316.mp3?Expires=1470376621&Signature=h06vK9xR0mbXaMPKO0eQpBSUJX6hvK7l~AgQgCRMcd6DPJmbuMNOaD8P52pnvaGYrQUZUjBUlTfxXACtGyzgP-AdJZkcUlprGUtL47PAqLeiuu-JEomk2Y13qRB7eWjVVl3v0CfjXvgxQXVlwNob2HrmglVFKkusSJRdOTjuwAAZP89Pf~l3w2p6RFy9gL3E1nq3DQowa9NGIQYEdExLPDOYu5jLPI5lhuH8t8vTAZRCwq6YuJtIQ5vJgrQHkk4q7aECn8T8pGvwmossGjrcz-Ga0KlZiefBwFe7XXV66Xor5SVPkaoN3DTQ07ZuAqEtV5ccd6PyOM0iVLFfYjw__&Key-Pair-Id=APKAJ5GT74YAYAGA4KAA",   APKAJ5GT74YAYAGA4KAA'
$sStart = 'file: "'
$sEnd = '",'
$aExtract = _StringBetween($string, $sStart, $sEnd)
;ClipPut($aExtract)
_ArrayDisplay($aExtract)

 

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Similar Content

    • houser747
      By houser747
      I have previously used _IEFormElementGetObjByName and _IEFormElementSetValue to enter text into a search box on a form and then submit the form.
      I am now trying to enter text into a search box which is not part of a form. 
      Here is the HTML from the website that i'm trying to enter the data on and then submit the search.
      <div class="row">
          <div class="form-group col-xs-12">
              <span id="FullWidthWithSubmenuContent_FullWidthContent_MainContent_AircraftRegistry_lblSearchText" for="input-search">Registreringsbeteckning</span>
              <div class="input-group col-xs-12">
                  <span id="FullWidthWithSubmenuContent_FullWidthContent_MainContent_AircraftRegistry_preSearchText" class="input-group-addon">SE -</span>
                  <input name="ctl00$FullWidthWithSubmenuContent$FullWidthContent$MainContent$AircraftRegistry$txtSearchText" type="text" value="DTH" id="FullWidthWithSubmenuContent_FullWidthContent_MainContent_AircraftRegistry_txtSearchText" class="form-control" />
              </div>
          </div>
      </div>
      <div class="row">
          <div class="form-group col-xs-12">
              <label class="sr-only" for="">Sök</label>
              <input type="submit" name="ctl00$FullWidthWithSubmenuContent$FullWidthContent$MainContent$AircraftRegistry$btnSearch" value="Sök" id="FullWidthWithSubmenuContent_FullWidthContent_MainContent_AircraftRegistry_btnSearch" class="btn btn-primary ladda-button" data-style="expand-right" />
          </div>
      </div>
      Many thanks in advance
      cheers
      Roger
    • robcull
      By robcull
      Hello all! I have had some issues reading text from different types of windows, occasionally, specifically with controlgettext. 
      **Before I begin, I know there are better ways to do what I attempt in the example below. That's not the point of this post. The point is my issues with controlgettext. 
      I am about to cite an example with an application you may be familiar with called SpeedFan (v4.52). My problem is not specific to speedfan, it is simply the most recent and easily reproducible example I can think of. 
      So, the goal of the script below is to get a string of text containing the current fan RPMs from the highlighted control in the screenshot below (see "speedfan_control_details.png").

      Now, here's a simple script for grabbing the window handle and reading the text from that control: 
      $wintitle = "SpeedFan 4.52" $controlID = "197934" ;will be reformatted as "[ID:######]" $hwnd = wingethandle($wintitle) if @error<>0 then msgbox(0, "WinGetHandle", "FAILURE. @error="&@error) Exit EndIf $text = ControlGetText($hwnd, "", "[ID:"&$controlID&"]") if @error=1 then msgbox(0, "ControlGetText", "FAILURE. @error="&@error) ;failure returns "" and @error=1 Exit EndIf msgbox (0, "ControlGetText", "SUCCESS. @error="&@error &@CRLF& "$text="&$text) ;success returns string and @error=0 You'll see that the ControlGetText operation runs without error, however it does not capture any text from the control. If you explore the other controls in this one window, you'll find mixed results across the board. Neither the temps nor voltages can be read, while the log field and some other elements can be read. Even when you read the text from the whole window, those elements are not included in the visible nor hidden texts. 
       
      I have run into this issue many times in the past- inconsistencies in the ability of autoit to interact with certain controls. What is it which makes this text different than any other readable texts? Is there an alternate method of reading the text in the window/control which could work? Any and all info to help me solve this mystery and satisfy my curiosity would be greatly appreciated. 
      Thanks  -Rob C
      PS: Running Autoit v3.3.14.2 on Win7 Ultimate x64
    • thoms
      By thoms
      Hello Forum,
      I'm trying to vertically center text in label controls, but no way. The search on the forum returns no result, or I don't search the right way
      When I insert a button and a label of same size close to each other, the text is centered on the button, but top aligned on the label, or edit. Which doesn't look really aesthetic
      Any idea is welcome
      Thanks in advance,
      Thoms
    • nacerbaaziz
      By nacerbaaziz
      Hello my friends
      I am a totally blind young man
      for easier to read books and articles Among the blind
      i has programmed a tool
      This tool converts text to audio with the possibility to save it into a wav or mp3 file
      It is also compatible with all persons, whether blind or ordinary
      I have completed the work of this tool and want to take your opinion
      i Especially published here for anyone looking about how to convert text to speech, I will put this tool open source for you
      I want to know what your think about it
      and if it need any other additions?
      Note :
      This tool converts texts to audio using sapi 5 voices
      so i was also puted a hot keys to control the tool
      Now I put this project to you for public benefit and I am ready to answer any question.
      Apology :
      I am an Arab youth from Algeria
      I do not mastered English very well
      So I apologize to you if there are written mistakes
      With my greetings and best wishes
      My texts to audio converter.zip
    • FroVN
      By FroVN
      Hi, i want read all text in website doc.google, link : https://docs.google.com/document/d/1ePaOK3w4mOi0fmOF7WQmF5kYvAXQtztVI7018wei_xs/edit (This is all my account , don't remember :v) how i read all text in this web? Tks