guys, help me edit this script to send clipboard texts from the the bottom to top Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
legend maxfreak
Posts: 73
Joined: 03 Sep 2017, 04:35

guys, help me edit this script to send clipboard texts from the the bottom to top

03 Sep 2017, 06:57

^m::
ifWinExist, Whatsapp
}
{
send %ClipBoard%{ENTER}
}
{
User avatar
boiler
Posts: 17173
Joined: 21 Dec 2014, 02:44

Re: guys, help me edit this script to send clipboard texts from the the bottom to top

03 Sep 2017, 07:13

This would be better, but what do you mean by "from the bottom to the top"?

Code: Select all

#IfWinActive, WhatsApp
^m::send %ClipBoard%{ENTER}
User avatar
legend maxfreak
Posts: 73
Joined: 03 Sep 2017, 04:35

Re: guys, help me edit this script to send clipboard texts from the the bottom to top

03 Sep 2017, 11:18

boiler wrote:This would be better, but what do you mean by "from the bottom to the top"?

Code: Select all

#IfWinActive, WhatsApp
^m::send %ClipBoard%{ENTER}

I mean, I want texts copied to clipboard in the script to paste in reverses ...if the words are
bad
boy
gym
loop
I want it to be pasted from the bottom as...
loop
gym
boy
bad
User avatar
Cuadrix
Posts: 236
Joined: 07 May 2017, 08:26

Re: guys, help me edit this script to send clipboard texts from the the bottom to top

03 Sep 2017, 12:55

You are welcome ;) :

Code: Select all

#IfWinActive, WhatsApp

Var := Clipboard
StringReplace, Var, Var, `n, `n, UseErrorLevel
if SubStr(Var, 0) != "`n" ;Checks the total amount of lines in a variable/Clipboard
  ErrorLevel++
LineIndex = %ErrorLevel%

^m::
Loop, Parse, Clipboard, `n
{
	If(A_Index == LineIndex){ ;If current line is equal to the number in LineIndex...
		CurrentLine = %A_LoopField%
		Send, %CurrentLine%{ENTER} ;...Then send current line
		LineIndex-- ;Sends in reverse
		Break
	}
}
Return
User avatar
Cuadrix
Posts: 236
Joined: 07 May 2017, 08:26

Re: guys, help me edit this script to send clipboard texts from the the bottom to top  Topic is solved

03 Sep 2017, 16:30

sir the reverse stuff worked but it just pastes a word per command, pls i want it to paste all the lines at once sir.
Here, try this:

Code: Select all

#IfWinActive, WhatsApp

^m::
clpbrd := Clipboard
ArrayOfText := StrSplit(clpbrd , "`r")
Clipboard :=

LineIndex := ArrayOfText._MaxIndex()
for index, value in ArrayOfText
    ArrayOfText[index] := Trim(value, "`n")
Loop
{
    if (LineIndex<>1)
    {
        Clipboard .= ArrayOfText[LineIndex] . "`r`n"
    }
    else
    {
        Clipboard .= ArrayOfText[LineIndex]
    }
    LineIndex--
} Until LineIndex = 0
Send, %Clipboard%{Enter}
Return
Good luck.
User avatar
legend maxfreak
Posts: 73
Joined: 03 Sep 2017, 04:35

Re: guys, help me edit this script to send clipboard texts from the the bottom to top

03 Sep 2017, 18:38

Cuadrix wrote:
sir the reverse stuff worked but it just pastes a word per command, pls i want it to paste all the lines at once sir.
Here, try this:

Code: Select all

#IfWinActive, WhatsApp

^m::
clpbrd := Clipboard
ArrayOfText := StrSplit(clpbrd , "`r")
Clipboard :=

LineIndex := ArrayOfText._MaxIndex()
for index, value in ArrayOfText
    ArrayOfText[index] := Trim(value, "`n")
Loop
{
    if (LineIndex<>1)
    {
        Clipboard .= ArrayOfText[LineIndex] . "`r`n"
    }
    else
    {
        Clipboard .= ArrayOfText[LineIndex]
    }
    LineIndex--
} Until LineIndex = 0
Send, %Clipboard%{Enter}
Return
Good luck.
:dance:

It worked sir, am so damned happy sir, God bless you.
User avatar
legend maxfreak
Posts: 73
Joined: 03 Sep 2017, 04:35

Re: guys, help me edit this script to send clipboard texts from the the bottom to top

05 Sep 2017, 05:01

legend maxfreak wrote:
Cuadrix wrote:
sir the reverse stuff worked but it just pastes a word per command, pls i want it to paste all the lines at once sir.
Here, try this:

Code: Select all

#IfWinActive, WhatsApp

^m::
clpbrd := Clipboard
ArrayOfText := StrSplit(clpbrd , "`r")
Clipboard :=

LineIndex := ArrayOfText._MaxIndex()
for index, value in ArrayOfText
    ArrayOfText[index] := Trim(value, "`n")
Loop
{
    if (LineIndex<>1)
    {
        Clipboard .= ArrayOfText[LineIndex] . "`r`n"
    }
    else
    {
        Clipboard .= ArrayOfText[LineIndex]
    }
    LineIndex--
} Until LineIndex = 0
Send, %Clipboard%{Enter}
Return
Good luck.
:dance:

It worked sir, am so damned happy sir, God bless you.
How about making it to paste in bulk in reverse cos its kinda slow pasting in reverse with respect to text lines, sir.
User avatar
boiler
Posts: 17173
Joined: 21 Dec 2014, 02:44

Re: guys, help me edit this script to send clipboard texts from the the bottom to top

05 Sep 2017, 05:23

Just change one line to paste instead of sending the text since it's already in the clipboard.

From:
Send, %Clipboard%{Enter}

To:
Send, ^v{Enter}
User avatar
legend maxfreak
Posts: 73
Joined: 03 Sep 2017, 04:35

Re: guys, help me edit this script to send clipboard texts from the the bottom to top

09 Sep 2017, 16:59

legend maxfreak wrote:
legend maxfreak wrote:
Cuadrix wrote:
sir the reverse stuff worked but it just pastes a word per command, pls i want it to paste all the lines at once sir.
Here, try this:

Code: Select all

#IfWinActive, WhatsApp

^m::
clpbrd := Clipboard
ArrayOfText := StrSplit(clpbrd , "`r")
Clipboard :=

LineIndex := ArrayOfText._MaxIndex()
for index, value in ArrayOfText
    ArrayOfText[index] := Trim(value, "`n")
Loop
{
    if (LineIndex<>1)
    {
        Clipboard .= ArrayOfText[LineIndex] . "`r`n"
    }
    else
    {
        Clipboard .= ArrayOfText[LineIndex]
    }
    LineIndex--
} Until LineIndex = 0
Send, %Clipboard%{Enter}
Return
Good luck.
:dance:

Sir help me fix this script to paste in reverse like the one you sent me above...

^m::ifWinExist, MicroEmulator___
Reverse(string)
{
length := StrLen(string)
loop, parse, string
{
loc := Abs(length - A_Index ) + 1
revloc%loc% := A_LoopField
}
Loop %length%
final .= revloc%A_index%
return final
}
ReverseByAdress(adress,len){
Loop % (len){
in.=Chr(NumGet(adress+0,len-A_index,"Char"))
}
return out
}
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: guys, help me edit this script to send clipboard texts from the the bottom to top

11 Sep 2017, 05:26

However, if a hotkey needs to execute only a single line, that line can be listed to the right of the double-colon. :eh:
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: guys, help me edit this script to send clipboard texts from the the bottom to top

11 Sep 2017, 05:31

Another (quite simple) approach to flip the content of the clipboard to an ascending order [here] :)

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: sn1perwild and 105 guests