StrokesPlus Forum
                       
StrokesPlus Forum
Home | Profile | Register | Active Topics
Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Lua Scripts
 General Action Scripts
 Edit copied Text into Clipboard
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

3di

Germany
26 Posts

Posted - 02/12/2016 :  04:56:21  Show Profile  Reply with Quote
Hi,

it would be very usefull for my everyday work to be able to do a Copy-Paste progress like this Example:

I would like to copy a Number like this
0123 4567 8910 ABCD

and get this in to the clippboard
012345678910ABCD
or this
0123_4567_8910_ABCD

So in this case it should remove the space between the Blocks or change it to "_".

In my opinion it should look a little like this, but i have no idea how i will set this to work

local myClip = acSendKeys("^c")
StringReplace, myClip, %A_SPACE%,, All
acSetClipboardText(myClip)

Have you guys any suggestion how this could be done?

Thanks in Advance and

Best regard

Edited by - 3di on 02/12/2016 05:13:39

Rob

USA
2573 Posts

Posted - 02/12/2016 :  15:56:36  Show Profile  Visit Rob's Homepage  Reply with Quote
This works for me:

acSendKeys("^c")
acDelay(50)
local clip = acGetClipboardText()
clip = clip:gsub(" ", "_")
acSetClipboardText(clip)

Or more condensed:

acSendKeys("^c")
acDelay(50)
acSetClipboardText(acGetClipboardText():gsub(" ", "_"))
Go to Top of Page

3di

Germany
26 Posts

Posted - 02/13/2016 :  07:00:00  Show Profile  Reply with Quote
Hi,

i tried, and it works like a charm for me.
Thanks a lot :-), I appreciate your work here!

Is there a list showing all the possible orders (like gsub, gIsIconic and so on)
Are those orders api stuff or vb/c+ or something.

You might see my very little uncertainty about coding stuff :-).

Best regards
Go to Top of Page

Rob

USA
2573 Posts

Posted - 02/13/2016 :  09:30:48  Show Profile  Visit Rob's Homepage  Reply with Quote
Other than S+ specific actions and variables, usually beginning with "sp" or "ac", the scripting engine is just plain Lua script.

So for example, you could Google search "lua string replace" and find examples of how to do what you need.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
StrokesPlus Forum © 2011-2018 Rob Yapchanyk Go To Top Of Page
Snitz Forums 2000