bustasnipe

String quick select feature

7 posts in this topic

Hello I have been going to this forum regularly for a couple weeks, getting all sorts of good info from you people.

So first off thanks, you are all gentlemen/women and scholars.

I just wanted to point out that I think it would be neat if you could double click either side of the quotation marks in the Scite editor to select the string of text within. Instead of having to manually select all the text within, which is not hard, but u may sometimes miss a extra character or something. Just like how you can select variables and single words by double clicking. Thanks to all those who have worked on and continue to work on Autoit, I love it.

 

Share this post


Link to post
Share on other sites



The current suggestion I can offer as alternative is to put you caret after the start quotation mark, press Ctrl+Shift and hit the right-arrow till you are at the end quotation mark.
The other option probably is to make your own LUA functions that does this for you and assign a shortcut to it.

Jos

 

 


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Thanks  Jos,

The CTRL + Shift then > will go past the quotes if there is no space between the last char and the end quote.
Even though this account is  almost 6 years old, I only recently started doing anything code related so I will likely not attempt making an lua for a while yet, but I will certainly keep that in mind.

All the best,

 

Chris

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Ok, just for fun:

Add the below func to the personalTools.lua in %localappdata\AutoIt v3\SciTE

--------------------------------------------------------------------------------
-- demo() LUA script
-- to be able to use this script you add the following to your SciTEUSer.properties (without the leading "--"):
--#x lua test func
--command.name.41.$(au3)=Test
--command.mode.41.$(au3)=subsystem:lua,savebefore:no
--command.shortcut.41.$(au3)=Ctrl+Shift+F
--command.41.$(au3)=InvokeTool PersonalTools.Demo
--
--------------------------------------------------------------------------------
function PersonalTools:Demo()
    editor.SelectionStart = editor.CurrentPos
    if editor.StyleAt[editor.CurrentPos] == SCE_AU3_STRING then
        for i = editor.CurrentPos, editor.LineEndPosition[editor:LineFromPosition(editor.CurrentPos)] do
            if editor.StyleAt[i] ~= SCE_AU3_STRING then
                editor.SelectionEnd = i-1
                break
            end
        end
    end
end

.. and add the commented lines in your SciTEUser.properties and remove the " --" at the start of the lines.

Ctrl+Shift+F will select till the end of a String.

Jos

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

This one will find the full string and you can place the caret anywhere in the literal string:

function PersonalTools:Demo()
    editor.SelectionStart = editor.CurrentPos
    if editor.StyleAt[editor.CurrentPos] == SCE_AU3_STRING then
        -- find the beginning of the string
        for i = editor.CurrentPos, editor:PositionFromLine(editor:LineFromPosition(editor.CurrentPos)),-1 do
            if editor.StyleAt[i] ~= SCE_AU3_STRING then
                editor.SelectionStart = i+2
                break
            end
        end
        -- find the end of the string
        for i = editor.CurrentPos, editor.LineEndPosition[editor:LineFromPosition(editor.CurrentPos)] do
            -- Make sure we don't count brackets in strings.
            if editor.StyleAt[i] ~= SCE_AU3_STRING then
                editor.SelectionEnd = i-1
                break
            end
        end
    end
end

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Jos you're the Boss, this works great, thank you!

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

    • LoneWolf_2106
      By LoneWolf_2106
      Hi everybody,
      i have a question related to strings items in an Array and sorting. Maybe someone can advice me how to solve the issue.
      I have an Array of strings, every item of the Array is as following:
      INFO [13.06.2017 11:48:01] [Thread-13] [ConGenImpUsb -> waitForConnection]  INFO [07.06.2017 08:55:44] [main] MDU5 - Ver 5.1x I want to sort the item in the array by date and time, is there any function which allows me to sort by date/time?
      Thanks in advance
    • Innominate
      By Innominate
      How can I filter out everything in a string except for text between specific tags, specifically between <title>Message title</title> and <body id="msgFeedSummaryBody" selected="false">Summary text</body>
       
      I also want to extract the URL, which is given three times:
           1. Message-Id: <https://www.linktopage.htm@localhost.localdomain>
           2. Content-Base: https://linktopage.htm (no closing tag for this, just a line feed with the next one beginning with “Content-Type: “)
           3. <base href="https://www.linktopage.htm">
       
      Having extracted the Message title, Summary text, and URL, I want to save that in one of various text files, with a prompt for user input giving me a way (such as entering a letter, word, or clicking a radio button; the latter is preferable) to specify which file.
       
      Here is the code I have so far:
       
      #include <MsgBoxConstants.au3> Opt("WinTitleMatchMode", 2) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase HotKeySet("^h", "_copy") While 1 Sleep(100) WEnd Func _copy() Send("^u") ; opens the message source of the news feed in my e-mail client (Thunderbird) showing all of the desired information Sleep(1000) Send("^a") ; select all of it Sleep(1000) Send("^c") ; copy it to clipboard EndFunc Now how can I filter the clipboard contents (as above), add to it (adding “-----------------------” as a separator, display it to the screen (for confirmation), and append it as plain text to one of several different files?
       
      Thank you!
    • vikashbitm2010
      By vikashbitm2010
      Hi all,
      I want to return string from autoit script to the python code.
      Autoit:
      Exit("22 FE 45") -> not working
      Exit(1) -> Working
      Exit(0) -> Working
      python:
      import os
      res=os.system(autoitmine.exe)
      print "res",res
      I got some hint of @ExitCode macro, but dont know how to use it to get the string in python variable 'res'.
      Please resolve this issue for me if anyone knows about this.
       
    • jjohn
      By jjohn
      Hi all,
      I have the following code, basically, it populates an array with unique characters found in a string, but it turns out only one character is in the array, i don't want to think it is due to a bug of autoit at this point, so i need your help on why, please
      Dim $sx[0] Dim $cn $ss = "Xx" ConsoleWrite(StringLeft($ss, 1) & " " & StringRight($ss, 1) & @CRLF) ConsoleWrite(StringLeft($ss, 1) = StringRight($ss, 1) & @CRLF) ;here show X <> x ConsoleWrite(@CRLF) ;the following is to populate array $sx with different unique characters in $ss For $b = 1 To StringLen($ss) $flg = 0 For $a = 0 To UBound($sx) - 1 ;if asc(StringMid($ss,$b,1)) = asc($sx[$a]) Then ;if this line is used instead of the next, everything is fine If StringMid($ss, $b, 1) = $sx[$a] Then If StringMid($ss, $b, 1) = "x" Then ConsoleWrite("<<->>" & StringMid($ss, $b, 1) & " " & $sx[$a] & @CRLF) $flg = 1 ExitLoop EndIf Next If $flg = 0 Then $cn = $cn + 1 ReDim $sx[$cn] $sx[$cn - 1] = StringMid($ss, $b, 1) EndIf Next ConsoleWrite(UBound($sx) & @CRLF);list the ubound of $sx ;list what is in array $sx For $a = 0 To UBound($sx) - 1 ConsoleWrite($sx[$a] & @CRLF) Next same code in a file is attached as uniqueChar2Array.au3
    • InunoTaishou
      By InunoTaishou
      I know on other languages when you try to use a string like this
      Global $sString = "Some String" If ($sString) Then ; ... EndIf The compiler will fail because string cannot be used in an expression where it needs a bool (something along those lines). But I see instances in other languages where using $sString in an expression will work and implicitly use the length of the string (or because there is some value in that variable).
      I'm wondering why AutoIt doesn't do the same. If the $sString is used like in my example (or some other expression where it wants a bool type) implicitly use the length of the string instead of the converting to 0?