String subtraction

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

String subtraction

Post by FranceBB »

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: 1811
Joined: Wed Sep 19, 2018 8:11 am

Re: String subtraction

Post by emcodem »

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
emcodem, wrapping since 2009 you got the rhyme?
User avatar
FranceBB
Posts: 264
Joined: Sat Jun 25, 2016 3:43 pm
Contact:

Re: String subtraction

Post by FranceBB »

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: 595
Joined: Thu Jun 08, 2017 12:36 pm
Location: France-Paris

Re: String subtraction

Post by momocampo »

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: 1811
Joined: Wed Sep 19, 2018 8:11 am

Re: String subtraction

Post by emcodem »

@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! :-)
emcodem, wrapping since 2009 you got the rhyme?
algia
Posts: 2
Joined: Thu May 28, 2020 10:18 am

Re: String subtraction

Post by algia »

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: 264
Joined: Sat Jun 25, 2016 3:43 pm
Contact:

Re: String subtraction

Post by FranceBB »

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 »

Yes the same company and he is my master in the avisynth's and FFASTrans's world.
thank you FranceBB
emcodem
Posts: 1811
Joined: Wed Sep 19, 2018 8:11 am

Re: String subtraction

Post by emcodem »

@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?
emcodem, wrapping since 2009 you got the rhyme?
User avatar
FranceBB
Posts: 264
Joined: Sat Jun 25, 2016 3:43 pm
Contact:

Re: String subtraction

Post by FranceBB »

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