String subtraction

Questions and answers on how to get the most out of FFAStrans
User avatar
FranceBB
Posts: 46
Joined: Sat Jun 25, 2016 3:43 pm
Location: Chelsea
Contact:

String subtraction

Post by FranceBB » Thu May 21, 2020 9:29 am

Hi there,
I wanted to make something as simple as a string subtraction.
I made a new variable with populate variable that is supposed to be initialized to the difference between two strings.
Let's assume that
String 1 = abc
String 2 = ab

what I'd like is: String3 = c

Code: Select all

"%s_string1%-%s_string2%"
doesn't work as expected and produces:
abc-ab

Code: Select all

%s_string1%-%s_string2%
doesn't work as expected and produces

abc-ab

what I thought was going to do was to output "c" instead.

emcodem
Posts: 586
Joined: Wed Sep 19, 2018 8:11 am

Re: String subtraction

Post by emcodem » Fri May 22, 2020 11:02 pm

Hey @FranceBB
long time not seen, i would find it great if we read from you more often here :-)

+-/* are arithmetic/mathematic functions, for string we have different ones.
I belive you can just use $replace ("%s_string1%","%s_string2%","")

Did you see that we created some documentation now? (thanks to @momocampo)?
http://ffastrans.com/wiki/doku.php?id=f ... _functions

User avatar
FranceBB
Posts: 46
Joined: Sat Jun 25, 2016 3:43 pm
Location: Chelsea
Contact:

Re: String subtraction

Post by FranceBB » Tue May 26, 2020 11:30 am

emcodem wrote:
Fri May 22, 2020 11:02 pm
Hey @FranceBB
long time not seen, i would find it great if we read from you more often here :-)

+-/* are arithmetic/mathematic functions, for string we have different ones.
I belive you can just use $replace ("%s_string1%","%s_string2%","")

Did you see that we created some documentation now? (thanks to @momocampo)?
http://ffastrans.com/wiki/doku.php?id=f ... _functions
Got it!
Well, definitely well done for writing a wiki about FFAST as well.
I still remember when the Avisynth Wiki was first introduced, it was a huge step forward for the project, so the same is for FFAST.
I generally post on Doom9 when I help people out writing code in their Avisynth script and I help developers developing Avisynth+ (like Ferenc - namely pinterf) and other with a lot of testing and reports and other things, so sorry if I rarely come here.
Perhaps I should add a few topics I made in my signature as they can be useful.
Since I've been effectively using FFAST for quite some time now, I'm also gonna share my pre-loaded version with all my workflows since they can be useful for other people I think.

momocampo
Posts: 467
Joined: Thu Jun 08, 2017 12:36 pm
Location: France-Paris

Re: String subtraction

Post by momocampo » Tue May 26, 2020 12:58 pm

Hello FranceBB,
It's always a good thing to share workflows, it can give a good start for a new one :)
About wiki, I really hope it will be useful for learning FFASTrans, that's the goal :)
Cheers.

;)

emcodem
Posts: 586
Joined: Wed Sep 19, 2018 8:11 am

Re: String subtraction

Post by emcodem » Tue May 26, 2020 9:32 pm

@FranceBB how nice of you to link some interesting stuff in your footer, thats a brilliant idea!
Sure i am well aware about you in Doom9, i spent some time there as well a few years ago working on some smart avisynth plugin :-) But i started off long time after the first wiki did exist so it looks like you are a little longer on this ball than i am.

Now me and momocampo turned to help out steinar here because his software was such a nice thing and he worked alone on it. The way how steinar connected avisynth and ffmpeg on the fly and how he does the avisynth filter chains was just impressing for me.
I was just hoping to hear from time to time from you as you are a very experienced user and we definitely need feedback, only this way we can get better...

Anyway, thanks for using ffastrans! :-)

algia
Posts: 2
Joined: Thu May 28, 2020 10:18 am

Re: String subtraction

Post by algia » Thu May 28, 2020 10:58 am

Hi France

i tried this workaround
1) I created new variable: s_monitor_path

2) I prepared this bat called arg.bat: (put the bat in same path)

@echo off
setLocal EnableDelayedExpansion
set "var1=%~1"
set "var2=%~2"
set wfp=!var1:%var2%=!
echo !wfp!


3) with a command executor I call it with two arguments

%comspec% /C "call "C:\Users\algia\Desktop\OUT_FF\arg.bat" "%s_original_path%" "%s_recursed_path%""

in command executor I set STDOUT TO VARIABLE s_monitor_path
at least the variable is populated with the correct value

It can help you?

User avatar
FranceBB
Posts: 46
Joined: Sat Jun 25, 2016 3:43 pm
Location: Chelsea
Contact:

Re: String subtraction

Post by FranceBB » Thu May 28, 2020 11:07 am

algia wrote:
Thu May 28, 2020 10:58 am
Hi France

i tried this workaround
1) I created new variable: s_monitor_path

2) I prepared this bat called arg.bat: (put the bat in same path)

@echo off
setLocal EnableDelayedExpansion
set "var1=%~1"
set "var2=%~2"
set wfp=!var1:%var2%=!
echo !wfp!


3) with a command executor I call it with two arguments

%comspec% /C "call "C:\Users\algia\Desktop\OUT_FF\arg.bat" "%s_original_path%" "%s_recursed_path%""

in command executor I set STDOUT TO VARIABLE s_monitor_path
at least the variable is populated with the correct value

It can help you?
Well this is way more concise than the way I did it the first time with the 4 inserts in populate variable as I had to modify all the other workflows.
I had no doubts you would come up with a better solution. :D
For those who don't know algia, we both work in the very same company as encoders. :)

algia
Posts: 2
Joined: Thu May 28, 2020 10:18 am

Re: String subtraction

Post by algia » Thu May 28, 2020 11:21 am

Yes the same company and he is my master in the avisynth's and FFASTrans's world.
thank you FranceBB

emcodem
Posts: 586
Joined: Wed Sep 19, 2018 8:11 am

Re: String subtraction

Post by emcodem » Thu May 28, 2020 6:51 pm

@algia
welcome to the forum and thank you for using ffastrans too!
Thats some crazy batching skills ^^ i never came across the enabledelayedexpansion border except in copy/paste batches from stackoverflow ;-)

@FranceBB
thanks for dragging algia in ;-) i hope we hear from you both from time to time, concerns or good things, whatever you need.
I'd like to know more about your usecase, is it possible for you to share your workflow maybe?

User avatar
FranceBB
Posts: 46
Joined: Sat Jun 25, 2016 3:43 pm
Location: Chelsea
Contact:

Re: String subtraction

Post by FranceBB » Thu May 28, 2020 9:48 pm

Sure, I'll share my workflows tomorrow as it's late in the night now, but I warn you, although it looks perfectly tidy and ordered to us, it may look a bit messy to other people, especially 'cause some comments are not in English.
Perhaps I should translate everything to English once and for all.

Post Reply