Processing Ajax...

Title
Close Dialog

Message

Confirm
Close Dialog

Confirm
Close Dialog

Confirm
Close Dialog

User Image
alexut
11 discussion posts
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
Jan 27, 2010  • #1
Jon Tackabury (BFS)'s profile on WallpaperFusion.com
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. :)
Jan 29, 2010  • #2
User Image
alexut
11 discussion posts
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.
• Attachment: split_text.jpg [51,518 bytes]
split_text.jpg
split_text.jpg
Feb 6, 2010  • #3
Jon Tackabury (BFS)'s profile on WallpaperFusion.com
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?
Feb 8, 2010  • #4
User Image
alexut
11 discussion posts
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:
Feb 9, 2010  • #5
Jon Tackabury (BFS)'s profile on WallpaperFusion.com
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. :)
Feb 9, 2010  • #6
User Image
alexut
11 discussion posts
:-D That is awesome! hope i can join your beta to!
Feb 10, 2010  • #7
Jon Tackabury (BFS)'s profile on WallpaperFusion.com
Just follow my http://twitter.com/jtackabury, or the http://www.binaryfortress.com/ 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. :)
Feb 12, 2010  • #8
User Image
alexut
11 discussion posts
: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 ? :)
Jun 7, 2010  • #9
Jon Tackabury (BFS)'s profile on WallpaperFusion.com
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? :)
Jun 7, 2010  • #10
User Image
Splat
21 discussion posts
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
Jun 7, 2010  • #11
Jon Tackabury (BFS)'s profile on WallpaperFusion.com
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

using System;
using System.Collections.Generic;
using System.Windows.Forms;

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

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

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

items = new List(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;
}
}
Jun 11, 2010  • #12
User Image
Splat
21 discussion posts
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

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
Jun 15, 2010  • #13
Jon Tackabury (BFS)'s profile on WallpaperFusion.com
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!
Jun 15, 2010  • #14
User Image
alexut
11 discussion posts
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. :)
Jun 26, 2010  • #15
Jon Tackabury (BFS)'s profile on WallpaperFusion.com
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. :)
Jun 30, 2010  • #16
User Image
alexut
11 discussion posts
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.
Jul 1, 2010  • #17
Jon Tackabury (BFS)'s profile on WallpaperFusion.com
I'm glad to hear it worked! Unfortunately it has to wait until all of the key modifiers are released (alt, ctrl... etc), sorry. :(
Jul 5, 2010  • #18
Subscribe to this discussion topic using RSS
Was this helpful?  Login to Vote(-)  Login to Vote(-)