Replace Number in TextEdit with 1/3 of that number

Hi!

I have a TextEdit document that has allot of numbers, and I would like to highlight each number I need to change and replace it with a calculation of 1/3 of that number.

I read the Wiki on variables and tried to do the same thing, but can't get it to work?

Thanks!

@NRKorsakov -

I'll jump in. There are many ways to accomplish this. You were close to solving this on your own. It appears your didn't ask the clipboard for the value. Try this and see if it gets you where you need to be. You can use whatever trigger you'd like though. Also, you can use regular variable. In my example, I used a Local variable.

Take care,
KC

1 Like

Hey thank you!!!!!!!!!!!!!!!!!!!!!!!!!

1 Like

Sorry!, but one more question...with the above script, I'm able to highlight each number and divide it.

The document I'm trying to modify has hundred of lines and numbers. All the numbers are between two parentheses.

I'm trying to modify this script so I could just set it running at the start of the document and it would find each number, do the division, and then go on to the next number, automatically do the division, etc., etc.

A small portion of the document looks like the following.

Many thanks!!!!!!!!!!!!!!!

I don't see any parentheses in your document. Did you mean double-quotes?

IAC, your new question is related, but materially different from your original quesiton.
Please repost your new question in a new Topic as follows:

  1. Clarify how the numbers you want to use are located
  2. Post real-world example of your source text using the forum Code Block
  3. Post example of the results of the changes you want to make, also in a Code Block.