Page 1 of 1

Numerical Text Script

Posted: Mon Feb 17, 2020 1:51 am
by DK
Hi.
Is it possible to write a script that increases a numerical text value by 1 each time it is pasted from the clip board?
Trying to create several dot to dot puzzles for my nephew and it is extremely time consuming typing the numbers
each time. I thought someone on the forum might know a quicker way to do this via a script?

Cheers
D.K

Re: Numerical Text Script

Posted: Mon Feb 17, 2020 10:37 am
by hayasidist
I'm assuming you're creating a still image? there's a function "InsertText" http://mohoscripting.com/methods/85 -- what you might consider is to use that in a loop along with CreateNewLayer(layerType) and param.Text:Set(n) where n is (text) number incremented each loop to create as many text layers as you need …

getting even more cute - if you draw just the path of the target dot to dot, adding control points in the right order, that same script could add "dots" at each control point and place the number ...

Re: Numerical Text Script

Posted: Mon Feb 17, 2020 9:05 pm
by DK
Great ideas there Hayasidist. I ended up writing an external html5 app that increments a variable by pressing a button and copies it to clipboard for pasting into Moho. Wish I knew a bit more about Moho Scripting to be able to pull off what you suggest though.
Cheers
D.K

Re: Numerical Text Script

Posted: Mon Feb 17, 2020 10:31 pm
by slowtiger
In TVPaint, I'd import any counter GIF, make it a brush, and just click through ...

Re: Numerical Text Script

Posted: Mon Feb 17, 2020 10:46 pm
by DK
Wow slow! I would never had put those together in a million years. Nice thinking outside the box there :D !
Cheers
D.K

Re: Numerical Text Script

Posted: Tue Feb 18, 2020 9:44 am
by slowtiger
Comes from decade-long working in Flash (and Director before that), I must admit. I was so used to program a little thing like this. And TVPaint has this custom brush thing which has it in-built to step through a sequence of images. Much like one of those numbering stamps which increase the numbers with each punch, does anyone remember those?

(And I grew up with these connect-the-numbers-books by Hans Jürgen Press, one of my favourite illustrators.)

Re: Numerical Text Script

Posted: Sat Feb 22, 2020 2:20 pm
by hayasidist
too late for this time, but as I had a couple of hours free …

a tool that will put one number, in sequence at each mouse click (or generate the whole sequence) …

https://www.mediafire.com/file/leo0kiyp ... s.zip/file

that .zip has s folder for the script installation tool and a readme.


A word of warning: generating a whole sequence or more than (say) 50 can take what feels like a very LONG time so be patient if you do choose that option.

This tool runs on Moho 12 or later.
There are no known issues, but please let me know of errors or if there are enhancements you'd like ...

Re: Numerical Text Script

Posted: Sat Feb 22, 2020 11:20 pm
by Penny
hayasidist wrote:
Sat Feb 22, 2020 2:20 pm
too late for this time, but as I had a couple of hours free …

a tool that will put one number, in sequence at each mouse click (or generate the whole sequence) …

https://www.mediafire.com/file/leo0kiyp ... s.zip/file

that .zip has s folder for the script installation tool and a readme.


A word of warning: generating a whole sequence or more than (say) 50 can take what feels like a very LONG time so be patient if you do choose that option.

This tool runs on Moho 12 or later.
There are no known issues, but please let me know of errors or if there are enhancements you'd like ...
Wow! It's a really useful script! I tried it right now and I'm sure i'll be using it a lot! Thanks for developing!

Re: Numerical Text Script

Posted: Fri Feb 28, 2020 1:00 am
by DK
Hayasidist.
So sorry for the late reply. I never received a notification that there was a response.
I am about to look at your script now and report back.

Cheers
D.K

Re: Numerical Text Script

Posted: Fri Feb 28, 2020 1:10 am
by DK
Hayasidist! That script is amazing!
It would be even better if you could lick and drag a line then the number appears but as it is it's extremely useful.
Much faster than my "Copy number to clipboard" html5 app.

Many thanks
Cheers
D.K

Re: Numerical Text Script

Posted: Fri Feb 28, 2020 4:34 am
by DK
I created a SpotFont to go with the script using the numbers 1 -10 on the keyboard as spots. It works great till you get to 10 then it starts putting double dots down...LOL. I clearly didn't think this through :oops:

www.creativetvandmedia.com/Forum/DKSpotFont.ttf

Cheers
D.K

Re: Numerical Text Script

Posted: Fri Feb 28, 2020 9:09 am
by hayasidist
DK wrote:
Fri Feb 28, 2020 1:10 am
Hayasidist! That script is amazing!
It would be even better if you could lick and drag a line then the number appears ...
Thanks for the positive comment!!

I did think about adding the "path" and dots, but I got stuck in a brain loop thinking about placement wrt the number - in the "simple case" there's a choice of 4 relative orientations: number left / above / right / below the dot -- then, looking at the dot-to-dot's my son (he's 6!) has, there are the "lines that are pre-drawn" and .. and ...

in the end I decided that it was something that I couldn't reliably automate (possibly ever, but certainly not in the time I had to put the rest of it together) and so left it out ... BUT … given a path, it is feasible to add dots (on the path at control points where the segment is hidden) and numbers on the "outside" (i.e. on the imaginary vector that extends from shape centre through the control point) … if that's helpful, I'll stick on the list for "next time".

Re: Numerical Text Script

Posted: Mon Mar 02, 2020 12:13 am
by DK
Yes....I noticed that when I started placing the numbers around a line. It was something you couldn't really automate especially when you reach a sharp corner or a line that goes back on itself and you need to drag the number around so it's outside the line path. It's a great script anyhow hayasidist!!!
Cheers
D.K