Binary Fortress Software

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Special paste with ClipboardFusion  (Read 1186 times)

alexut

  • Normal
  • **
  • Offline Offline
  • Posts: 11
    • View Profile
Special paste with ClipboardFusion
« on: January 27, 2010, 01:26:31 am »

Hey, i'm a webdesigner, working very hard with designing stuff and i'm also an excel fan so this is a dual idea, i always strive to improve my efficiency when working so this is a long shot but worth give it a try:

I need a feature in this program that splits up a phrase in to words, rows, paragraphs or an entire text in to two or more equal phrases. So the process would be like that:

I copy paste a text with a special shortcut, and after that clipboard fusion manipulates them so that on my first paste will display only the first word/string, on the second paste it will reveal the second and so on.

Thanks
« Last Edit: June 15, 2010, 10:34:38 am by Jon Tackabury »
Logged

Jon Tackabury

  • Administrator
  • Ultra Poster
  • *****
  • Offline Offline
  • Posts: 3755
    • View Profile
    • Binary Fortress Software
    • Email
Re: special paste with clipboard fusion
« Reply #1 on: January 29, 2010, 12:33:25 am »

This is an interesting idea, but I can't imagine how the UI would look for configuring all of that while keeping it somewhat simple to use. If you have any ideas, I'm all ears. :)
Logged
Lead Developer
Binary Fortress Software
http://www.binaryfortress.com

alexut

  • Normal
  • **
  • Offline Offline
  • Posts: 11
    • View Profile
Re: special paste with clipboard fusion
« Reply #2 on: February 06, 2010, 06:50:20 pm »

Sorry for the somehow late reply, i have added my view on the UI in an attachment, hope it will help you make an ideea on how i see it, spent a while thinking and tried to come up with the best idea.

The dropdown buttons could also be changed with input fields. Depending on how customizable you want this.
Logged

Jon Tackabury

  • Administrator
  • Ultra Poster
  • *****
  • Offline Offline
  • Posts: 3755
    • View Profile
    • Binary Fortress Software
    • Email
Re: special paste with clipboard fusion
« Reply #3 on: February 08, 2010, 06:32:17 pm »

This is an interesting idea, but one that I fear is too specific. However, I have included the ability to write Macros for the upcoming CF 2.0 release. You can write any C# code and CF 2.0 will run it against the Clipboard text. You should be able to write some simple string splitting code as a macro and bind a HotKey to it. Doe that sound like it would suit your needs?
Logged
Lead Developer
Binary Fortress Software
http://www.binaryfortress.com

alexut

  • Normal
  • **
  • Offline Offline
  • Posts: 11
    • View Profile
Re: special paste with clipboard fusion
« Reply #4 on: February 09, 2010, 01:23:53 am »

I'm sure that that this is a feature not that specific, but rather a feature that not many can think at from my perspective, else they would not even want it, but also ask for it. Nevertheless, you are running a business, and I can see where you're standing from your point of view.  I will patiently wait for the macros to come, and hopefully I'll learn some C by than.

 :mrgreen:
Logged

Jon Tackabury

  • Administrator
  • Ultra Poster
  • *****
  • Offline Offline
  • Posts: 3755
    • View Profile
    • Binary Fortress Software
    • Email
Re: special paste with clipboard fusion
« Reply #5 on: February 09, 2010, 10:59:02 am »

Don't worry about learning the code, I'll gladly help you to create the Macro that you need. :) I want to have a library of Macros that other people can download and use, so creating them is not an issue for me. :)
Logged
Lead Developer
Binary Fortress Software
http://www.binaryfortress.com

alexut

  • Normal
  • **
  • Offline Offline
  • Posts: 11
    • View Profile
Re: special paste with clipboard fusion
« Reply #6 on: February 10, 2010, 06:48:38 am »

 :-D That is awesome! hope i can join your beta to!
Logged

Jon Tackabury

  • Administrator
  • Ultra Poster
  • *****
  • Offline Offline
  • Posts: 3755
    • View Profile
    • Binary Fortress Software
    • Email
Re: special paste with clipboard fusion
« Reply #7 on: February 12, 2010, 04:14:22 pm »

Just follow my Twitter feed, or the main news RSS feed. I'll be posting about the beta when it's ready, and I'd love to have you join. It sounds like you'll be giving the Macros a good workout. :)
Logged
Lead Developer
Binary Fortress Software
http://www.binaryfortress.com

alexut

  • Normal
  • **
  • Offline Offline
  • Posts: 11
    • View Profile
Re: special paste with clipboard fusion
« Reply #8 on: June 07, 2010, 03:34:40 pm »

 :mrgreen:

Well here i am ready to put the macros to some intensive test, it seems the feature is getting some buzz, and will be a great time saver for many of my applications.

How about a macro for splitting a phrase in to words :D. Anyone willing to help me here ? :)

Logged

Jon Tackabury

  • Administrator
  • Ultra Poster
  • *****
  • Offline Offline
  • Posts: 3755
    • View Profile
    • Binary Fortress Software
    • Email
Re: special paste with clipboard fusion
« Reply #9 on: June 07, 2010, 03:59:15 pm »

How would the split phrase be returned? Like a comma separated list:
"Hello, how are you." -> "hello, how, are, you"

Or did I miss the point? :)
Logged
Lead Developer
Binary Fortress Software
http://www.binaryfortress.com

Splat

  • Normal
  • **
  • Offline Offline
  • Posts: 18
    • View Profile
Re: special paste with clipboard fusion
« Reply #10 on: June 07, 2010, 07:58:37 pm »

Hi Jon

From what I understood (correct me if I'm wrong), alexut wants it so that the first time he pastes, the first word is pasted, the second time, the second word is pasted, etc.

eg.  "Hello, how are you?"
Paste 1: "Hello,"
Paste 2: "how"
Paste 3: "are"
Paste 4: "you?"

I guess the pseudo code for a macro would be something like:

Get the text off the clipboard. (eg. "Hello, how are you?")
Split the text apart (using RegEx or whatever). (eg. "Hello," "how" "are" "you?")
Get the first result, and paste it to the current application.(eg. "Hello,")
Remove the first result from the original text and save that as the new clipboard text (eg. "how are you?")

So when you run the macro a second time it will return the next word, and so on.

Alternatively, the result that you return could be added to the end of the clipboard text (eg. "how" "are" "you?" "Hello,")
so that as you paste each word, it loops around.

I haven't had a chance to play around with the macros too much yet.  Obviously the new clipboard value is the return value of the ProcessText function, but I'm not sure if you can paste directly from the macro, or if the value has to be returned to the clipboard first before it can be pasted.

PS. As this is a macro, you could use any value for the delimiter (not just the space that I have used in my examples), so you could break the text apart at line breaks or tabs, or using RegEx you could break it apart using things like HTML list items, etc, or even based on length (eg. three equal parts).

Cheers,
 - Stephan
« Last Edit: June 07, 2010, 08:30:30 pm by Splat »
Logged

Jon Tackabury

  • Administrator
  • Ultra Poster
  • *****
  • Offline Offline
  • Posts: 3755
    • View Profile
    • Binary Fortress Software
    • Email
Re: special paste with clipboard fusion
« Reply #11 on: June 11, 2010, 11:05:09 am »

I wasn't sure if this would be possible even with the new 2.0.1 editor, but I think I've done it. Give this a try in version 2.0.1. I am making some improvements to the 2.0.2 editor to make writing this type of Macro a little bit easier, but this should work. Just copy your text string like normal (Ctrl + C), then just hit the assigned HotKey for this Macro and it will chop and paste, each time returning the next word until it's empty. Let me know if it works and I'll post it up in the Macro gallery. Thanks! :)

Code: [Select]
using System;
using System.Collections.Generic;
using System.Windows.Forms;

public static class ClipboardFusionHelper
{
private static List<string> items;
private static string LastItem;

public static string ProcessText(string text)
{
if (items == null)
items = new List<string>();
if (LastItem == null)
LastItem = "";

if (items.Count == 0)
{
if (LastItem.Equals(text, StringComparison.Ordinal))
{
Clipboard.Clear();
return "";
}

items = new List<string>(text.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries));
if (items.Count == 0)
{
Clipboard.Clear();
return "";
}
}

string temp = items[0];
items.RemoveAt(0);

if (items.Count == 0)
Clipboard.Clear();

LastItem = temp;
MacroAPI.PasteText(temp);
return temp;
}
}
« Last Edit: June 11, 2010, 12:08:19 pm by Jon Tackabury »
Logged
Lead Developer
Binary Fortress Software
http://www.binaryfortress.com

Splat

  • Normal
  • **
  • Offline Offline
  • Posts: 18
    • View Profile
Re: Special paste with ClipboardFusion
« Reply #12 on: June 15, 2010, 01:56:28 am »

Hi Jon

I have also been trying to get this to work, but I guess that I don't know the API as well as you do.  I was trying to use the MacroAPI.PasteText method and then the MacroAPI.SetClipboardText, but couldn't get it to work quite as I wanted it to.  :|

I have tested your macro in 2.0.1 and it seems to work fine.

One small change that can be made (if you want to keep the text so that it loops over and over) is to add
Code: [Select]
      items.Add(temp);directly after the line with the RemoveAt method (line 34).  This just adds the first item back to the end of the list so that you never run out of items.

Also, as mentioned in my previous post, you can change the Split function to use a regular expression or divide the sting in an equal number of parts, etc. etc.

I will keep some of the techniques you used in mind when creating more macros.  :-)

Let's wait to see if this solved alexut's original question...

Cheers,
 - Stephan
Logged

Jon Tackabury

  • Administrator
  • Ultra Poster
  • *****
  • Offline Offline
  • Posts: 3755
    • View Profile
    • Binary Fortress Software
    • Email
Re: Special paste with ClipboardFusion
« Reply #13 on: June 15, 2010, 10:34:32 am »

That's very true, there are a number of ways to enhance this Macro. I provided this as a baseline to provide the required functionality, but of course anyone can customize it to suit their needs. :) Thanks!
Logged
Lead Developer
Binary Fortress Software
http://www.binaryfortress.com

alexut

  • Normal
  • **
  • Offline Offline
  • Posts: 11
    • View Profile
Re: Special paste with ClipboardFusion
« Reply #14 on: June 26, 2010, 02:31:05 pm »

sorry for the long time to reply... actually way to long,I have been in a two weeks trip, but now i'm back and ready to challenge the macros.

Ok after a couple of unsuccessful attempts i have made the script work. :)

The only problem I'm having is a very (VERY) long delay between the command and the actual word being pasted. Runing Win 7 64bit version.
I'll try a restart... see how it works after and keep you updated. :)
Logged

Jon Tackabury

  • Administrator
  • Ultra Poster
  • *****
  • Offline Offline
  • Posts: 3755
    • View Profile
    • Binary Fortress Software
    • Email
Re: Special paste with ClipboardFusion
« Reply #15 on: June 30, 2010, 11:16:00 am »

The MacroAPI.PasteText function will pause until you've released the alt, ctrl and shift keys. It may seem like it's taking a long time, but it's actually just waiting for you. :)
Logged
Lead Developer
Binary Fortress Software
http://www.binaryfortress.com

alexut

  • Normal
  • **
  • Offline Offline
  • Posts: 11
    • View Profile
Re: Special paste with ClipboardFusion
« Reply #16 on: July 01, 2010, 12:55:46 pm »

lol :)) brilliant... that was it... Could it be made to wait just after releasing one of the key pressed maybe? :) ... not for me, as I have a g11 and I can define macros... but seems a little hard for general use.

Logged

Jon Tackabury

  • Administrator
  • Ultra Poster
  • *****
  • Offline Offline
  • Posts: 3755
    • View Profile
    • Binary Fortress Software
    • Email
Re: Special paste with ClipboardFusion
« Reply #17 on: July 05, 2010, 04:15:45 pm »

I'm glad to hear it worked! Unfortunately it has to wait until all of the key modifiers are released (alt, ctrl... etc), sorry. :(
Logged
Lead Developer
Binary Fortress Software
http://www.binaryfortress.com