ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Main Area and Open Discussion > General Software Discussion

Is this a worthwhile idea for a program?

(1/8) > >>

tranglos:
(How does one create a poll?)

OK, I'm thinking out loud here, so please bear with me or ignore :) Here's a scenario I've had to contend with countless times. I'm translating a large document that contains innumerable specifications, such as power consumption, capacity, operating temperatures, dimensions, weight etc. So, lots of numbers. When translating between English and Polish it involves endless tweaking of punctuation. English "1.5" becomes "1,5" in Polish (decimal separator). English 12,000 becomes "12<non-breaking-space>000" in Polish (thousands separator). Then there are other little tweaks of spacing (we don't put a space before the degree ° sign, for example) and units of measure. You can imagine it gets tedious quickly. Today I've gone though well over a hundred of such lines.

This needs to be automated, and implemented in such a way that it works with any text editing application.  Plus, the solution needs to be abstracted enough to be generally useful.

For a long time I've looked for an excuse to write an app that executes user-created scripts. (At the moment there seems to be a dearth of Delphi scripting solutions that handle Unicode, so this might present a big obstacle, but right now I want to think positive for once :-) Would this be useful at all? Here's what I'm imagining:

1) You press a hotkey, and the as-yet-unnamed app acquires text from the application you are working in. This can be done via the clipboard or (better, harder) by accessing the text directly. So the app grabs the text and:

2) executes a script that you preselected when starting your work. In my case the script would do the appropriate replacements on the various numeric values, but it could do anything. Then:

3) the app puts the result back on clipboard or injects it directly into your editor.

Questions:

So, does this seem like a worthwhile standalone project? Assume the app does nothing else except the points above.

What existing solutions could be used to achieve the same goal? I suppose AHK could be coerced to do that. Anything else? Is it even remotely interesting?

(Yes, I've considered adding this to Echo, but I am not convinced it's a good idea. For one thing, Echo would be capturing the clipboard and modifying its contents nearly instantly, and that would play badly with other apps that monitor the clipboard. In general, I think it'd create a mess, but I haven't excluded that route just yet.)

Ath:
Might I drop the suggestion 'regex replace' at just in front of your shoes? The source-capturing and result-presenting would be the next challenge ofcourse, but this is just a quicky suggestion ;)

tranglos:
Might I drop the suggestion 'regex replace' at just in front of your shoes? The source-capturing and result-presenting would be the next challenge ofcourse, but this is just a quicky suggestion ;)
-Ath (October 07, 2011, 02:19 PM)
--- End quote ---

A script can do anything, so it can certainly do regex replacement, as long as the scripting language (or its libraries) have support for regular expressions.

It would be another matter to ask for user input every time. Possible of course, but not as automated as I would like.

Curt:
I sure would use such a program  :-*

However, the Anglophile part of the world makes it difficult to simply make one rule. Many or even most Americans have erroneous learned to say and write "kgs" for kilograms. You and I are using "kg", because we know it never is plural; 1 gram, 2 gram. Are you ready to double the set of rules?

tranglos:
However, the Anglophile part of the world makes it difficult to simply make one rule. Many or even most Americans have erroneous learned to say and write "kgs" for kilograms. You and I are using "kg", because we know it never is plural; 1 gram, 2 gram. Are you ready to double the set of rules?-Curt (October 07, 2011, 02:40 PM)
--- End quote ---

That goes in the script :)

All the program itself does is grab text, pass it on to the script, then put the changed text back. In the script you can do whatever. You are right of course, and then there are different rules for different languages - which is why for the application to be useful to anyone but me, it has to be script based. Then there is no limit to the transformation rules you can create.



Navigation

[0] Message Index

[#] Next page

Go to full version