Run contents from clipboard

Discussion, questions and support.
Post Reply
david
Posts: 21
Joined: Jun 1st, ’17, 20:08

Post by david » Nov 7th, ’17, 03:18

Hello!

I would like to ask for your help. I've tried several stuff to no avail. I would like to run a file whose path that is on the clipboard. So, normally I do:

Windows + R
Ctrl + V
Enter


I've tried to do it, but no luck. Any ideas?

Best,
David.
User avatar
Marko
Posts: 1718
Joined: Mar 2nd, ’13, 21:02

Post by Marko » Nov 7th, ’17, 10:13

Type: Command

Code: Select all

Run, %Clipboard%
david
Posts: 21
Joined: Jun 1st, ’17, 20:08

Post by david » Nov 7th, ’17, 13:48

Thanks!

Tried that already, and got an error :( Here is a print screen:

http://prntscr.com/h7by1q

I have tried with other content and it works, it somehow does not work from what I copy from Excel. It seems that excel includes a new line character. Here is a paste from what I copied, with quotes so that it denotes start and end.

"C:\Users\David\Google Drive\Epic Lemon\Clientes\Cambia un destino\social media\concientización\usados\conciencia.jpg
"

I tried something like this to try to "clean" the clipboard, but still does not work. I tried using a pice of code from the example of pasting without formatting. Any thoughts how this can work with this strange formatting from excel?

Code: Select all

clipboard := clipboard
Run, %Clipboard%
Thanks so much.
David.
User avatar
Marko
Posts: 1718
Joined: Mar 2nd, ’13, 21:02

Post by Marko » Nov 7th, ’17, 20:15

Excel is known for using it's own clipboard management system. Do you have a path in one of Excel cells? You cannot just copy the cell, try to select and copy the text in the editing field.

Alternatively, one way to trim the new line characters from the end of the string is

Code: Select all

Clipboard := RegExReplace(Clipboard, "\r\n$","")
Sleep 200
Run, %Clipboard%
david
Posts: 21
Joined: Jun 1st, ’17, 20:08

Post by david » Nov 8th, ’17, 00:04

wow, that worked perfectly well. Thanks soooo much!

One additional question :)

Is there a way to add to the script to copy to clipboard and then execute what I have? Just thinking if I can avoid doing a ctrl + c.
User avatar
Marko
Posts: 1718
Joined: Mar 2nd, ’13, 21:02

Post by Marko » Nov 8th, ’17, 17:25

Create a shortcut, Type: Command:

Code: Select all

Send, ^c
Sleep 100
Clipboard := RegExReplace(Clipboard, "\r\n$","")
Sleep 100
Run, %Clipboard%
If it fails, just increase sleeps.
david
Posts: 21
Joined: Jun 1st, ’17, 20:08

Post by david » Nov 9th, ’17, 02:24

wow, you are the man!

Thanks so much for your support!

Best regards,
David.
Post Reply