Functions lets you manipulate strings and/or numbers to fit your needs.

Usage description:

$function(input-1 ="string", input-2 = integer[, optional input-3 ="string"/integer])

ALL string inputs containing alphabetic characters (a-z, A-Z) must be encapsulated with single or double quotes: "my string", '123abc', "%s_variable%", '%i_variable%'.

  • Functions that accept numbers do not need to be encapsulated with quotes.
  • If numeric character(s) (0-9) are used in functions that accept strings then the number will be treated as a string: 123 ="123"
  • All functions can be nested (functions within functions):$replace($left("my strings", 6), "my","your") = "your str"
  • Functions

    $replace

    Replace string in string. If "type" is set to 1 then the string to replace are split into characters. The function will then replace all instance of each character with the "replace with string".

    Usage:

    $replace(input string ="string/%variable%", string to replace ="string/%variable%" [, replace with string ="string/%variable%", type = 0])

    Example:

    $replace("D:\Replace spaces in filename", "", "_") =

    D:\Replace_spaces_in_filename

    Example:

    $replace("D:\Replace spaces in filename","eip", "_", 1) =

    D:\R__lac_ s_ac_s _n f_l_nam_

    $regreplace

    Replace string in string by regex pattern.

    Usage:

    $regreplace(input string ="string/%variable%", string to replace ="string/%variable%" [, replace with string ="string/%variable%")

    Example:

    $regreplace("D:\Replace spaces in filename", "\s+", "_") =

    D:\Replace_spaces_in_filename

    Example:

    $regreplace("D:\Replace spaces in filename","[eip]", "_") =

    D:\R__lac_ s_ac_s _n f_l_nam_

    $left

    Get string n-characters from the left side.

    Usage:

    $left(input string ="string/%variable%", number of characters to extract =integer/%i_variable%)

    Example:

    $left("D:\Replace spaces in filename", 15) =

    D:\Replace spac

    $middle

    Get string n-characters from n-position.

    Usage:

    $middle(input string ="string/%variable%", start position = integer/%i_variable%, number of characters to extract from start position = integer/%i_variable%)

    Example:

    $middle("D:\Replace spaces in filename", 5, 8) =

    eplace s

    $right

    Get string n-characters from the right side.

    Usage:

    $right(input string ="string/%variable%", number of characters to extract =integer/%i_variable%)

    Example:

    $right("D:\Replace spaces in filename", 7) =

    ilename

    $upper

    Force string to upper case.

    Usage:

    $upper(input string = "string/%variable%")

    Example:

    $upper("D:\Replace spaces in filename") =

    D:\REPLACE SPACES IN FILENAME

    $lower

    Force string to lower case.

    Usage:

    $lower(input string ="string/%variable%")

    Example:

    $lower("D:\Replace spaces in filename") =

    d:\replace spaces in filename

    $stripws

    Removes leading and trailing white spaces.

    Usage:

    $stripws(input string ="string/%variable%")

    Example:

    $stripws("  D:\Replace spaces in filename   ") =

    D:\Replace spaces in filename

    $stripcrlf

    Removes carriage returns and line feeds from string.

    Usage:

    $stripcrlf(input string ="string/%variable%")

    Example:

    $stripcrlf("  D:\Replace spaces

    in filename   ") =

                    D:\Replace spaces in filename  

    $length

    Usage:

    $length(input string ="string/%variable%")

    Example:

    $length("D:\Replace spaces in filename") =

    29

    $isdigit

    Check if string is only numbers. Success returns 1, failure returns 0.

    Usage:

    $isdigit(input string ="string/%variable%")

    Example 1:

    $isdigit("D:\Replace spaces in 123filename") =

    0

    Example 2:

    $isdigit("650375372") =

    1

    $isalpha

    Check if string is only alphabetic letters. Success returns1, failure returns 0.

    Usage:

    $isalpha(input string ="string/%variable%")

    Example 1:

    $isalpha("D:\Replace spaces in filename") =

    0

    Example 2:

    $isalpha("VeryCoolVideo") =

    1

    $reverse

    Reverse a string.

    Usage:

    $reverse(input string ="string/%variable%")

    Example:

    $reverse("D:\Replace spaces in filename") =

    emanelif ni secaps ecalpeR\:D

    $triml

    Trim string n-characters from the left side.

    Usage:

    $triml(input string ="string/%variable%", number of characters to trim =integer/%i_variable%)

    Example:

    $triml("D:\Replace spaces in filename", 9) =

    e spaces in filename

    $trimr

    Trim string n-characters from the right side.

    Usage:

    $trimr(input string ="string/%variable%", number of characters to trim =integer/%i_variable%)

    Example:

    $trimr("D:\Replace spaces in filename", 5) =

    D:\Replace spaces in fil

    $round

    Round number to nearest decimal. If number of output decimals is omitted then the function will return an integer.

    Usage:

    $roundd(number to round =number/%f_variable%[, number of output decimals = integer/%i_variable%])

    Example 1:

    $round(29.87, 1) =

    29.9

    Example 2:

    $round(29.97) =

    30

    Example 3:

    $round(29.37) =

    29

    $roundd

    Round number down to nearest integer.

    Usage:

    $roundd(number to round =number/%f_variable%)

    Example 1:

    $roundd(29.97) =

    29

    $roundu

    Round number up to nearest integer.

    Usage:

    $roundu(number to round =number/%f_variable%)

    Example:

    $roundu(29.97) =

    30

    $leads

    Add leading character(s) to a string. If string to fill is omitted a zero (0) will be used.

    Usage:

    $leads(input string ="string/%variable%", total number of output characters =integer/%i_variable%[, string to fill = "string/%variable%"])

    Example 1:

    $leads("25", 4) =

    0025

    Example 2:

    $leads("8", 4) =

    0008

    Example 3:

    $leads("Oscar", 9, "-") =

    --Oscar

    $trails

    Add trailing character(s) to a string. If fill-string is omitted a zero (0) will be used .

    Usage:

    $trails(input string ="string/%variable%", total number of output characters =integer/%i_variable% [, string to fill = "string/%variable%"])

    Example 1:

    $trails("25", 4) =

    2500

    Example 2:

    $trails("8", 4) =

    8000

    Example 3:

    $trails("Oscar", 9, "-") =

    Oscar----

    $between

    Get string between two strings. If instance is specified then the function will return the instance of string between strings found. This is very handy for extracting data in xml-strings.

    Usage:

    $between(input string ="string/%variable%", from string = "string/%variable%", to string = "string/%variable%"[, instance found= integer/%i_variable%])

    Example:

    $between("D:\Replace spaces in filename","Replace ", " filename") =

    spaces in

    Example:

    $between("<string>123</string><string>abc</string><string>xyz</string>","<string>", "</string>", 3) =

    xyz

    $proper

    Capitalizes every first letter following a non-alphanumeric character.

    Usage:

    $proper(input string ="string/%variable%")

    Example:

    $proper("D:\replace spaces in filename") =

    D:\Replace Spaces In Filename

    $alrep

    Replace all non-alphanumeric characters and add optional exceptions.

    Usage:

    $alrep(input string ="string/%variable%"[, replace with string ="string/%variable%"][, except characters = "string/%variable%"])

    Example 1:

    $alrep("D:\replace + spaces - in file_name@com")=

    "Dreplacespacesinfilenamecom"

    Example 2:

    $alrep("D:\replace + spaces in file_name@com","_", "+@:") =

    D:_replace_+_spaces_in_file_name@com

    $exists

    This is function will locate file(s) and return the number of matches. If the second argument is 1 then the function will return the first match as a complete path. If second argument is 2 then the function will return a string formated array of complete file paths. The 3'rd argument turns recursive search on (1) or off (0, default)

    Usage:

    $exists(input string ="string/%variable%"[, input integer = integer/%variable%, input integer = integer/%variable%])

    Example 1:

    $exists("C:\Windows\explorer.exe") =

    1

    Example 2:

    $exists("C:\Windows\system32\win*") =

    98

    Example 3:

    $exists("C:\Windows\system32\winsa*", 1) =

    C:\Windows\system32\WinSAT.exe

    Example 4:

    $exists("C:\Windows\system32\winsa*", 2) =

    ["C:\\Windows\\system32\\WinSAT.exe", "C:\\Windows\\system32\\WinSATAPI.dll"]

    $read

    Reads the contents of a any text file. The function will automatically try to determine correct encoding. If storing as a variable thestring length is limited to approximately 80. 000 characters.

    Usage:

    $read(input string ="string/%variable%")

    $inttotc

    Converts an integer to a TC time code.

    Usage:

    $inttotc(input integer = integer/%variable%, frames per second, float =float/%i_variable%)

    Example 1:

    $inttotc(1647, 29.97) =

    00:00:54;27

    Example 2:

    $inttotc(1647, 25) =

    00:01:05:22

    $tctosec

    Converts a TC time code to seconds.

    Usage:

    $tctosec(input time code, string = "string/%variable%", frames persecond, float = float/%i_variable%)

    Example 1:

    $tctosec("00:00:54;29", 29.97) =

    54.96

    Example 2:

    $tctosec("00:01:05:22", 25) =

    65.88

    $regext

    This is regular expression function. It extracts text based on recognition patterns. It uses the Perl Compatible Regular Expressions (PCRE) engine: http://www.pcre.org/. If the last optional argument is set to 1 then the function will return a complete array of global matches.

    Usage:

    $regext(input string ="string/%variable%", pattern = "string/%variable%"[, input integer = integer/%variable%])

    Example 1:

    $regext('<Duration value="1214"/>','<Duration value="(\d+)"/>') =

    1214

    Example 2:

    $regext("TVShow_EP0013.mxf", "(EP\d{4})")=

    EP0013

    $abs

    Returns the absolute value of a number.

    Usage:

    $abs(input number=number/%variable%)

    Example 1:

    $abs(-10)=

    10

    Example 2:

    $abs(10)=

    10

    $log

    Returns the natural logarithm of a number.

    Usage:

    $log(input number=number/%variable%)

    Example 1:

    $log(10)=

    2.3024...

    $random

    Returns a random integer number between two integers.

    Usage:

    $random(input integer =integer/%variable%, input integer = integer/%variable%)

    Example 1:

    $random(10, 20)=

    13

    Example 2:

    $random(10, 20)=

    18

    $hex

    Converts a decimal integer to hexadecimal number.

    Usage:

    $hex(input integer =integer/%variable%)

    Example 1:

    $hex(8)=

    8

    Example 2:

    $hex(15)=

    f

    $dec

    Converts a hexadecimal number to decimal integer. Function accepts both quoted and unquoted input but it's a good habit to use quoted.

    Usage:

    $dec(input string/integer ="string"/integer/%variable%)

    Example 1:

    $dec(8)=

    8

    Example 2:

    $dec("f")=

    15

    $guid

    Returns a random GUID/UUID.

    Usage:

    $guid()

    Example 1:

    $guid()=

    bc067580-f7de-4e12-9f84-7e905bd60378

    $base64

    Encodes the input UTF-8 string as terminated base64 string.

    Usage:

    $base64(input string ="string/%variable%")

    Example 1:

    $base64("FFAStrans")=

    RkZBU3RyYW5z

    $base64dec

    Decodes the input base 64 encoded string to a UTF-8 string.

    Usage:

    $base64dec(input string ="string/%variable%")

    Example 1:

    $base64dec("RkZBU3RyYW5z")=

    FFAStrans

    $urlencode

    Converts the input string to an URL friendly string.

    Usage:

    $urlencode(input string ="string/%variable%")

    Example 1:

    $urlencode("FFAStrans is #supercool!")=

    FFAStrans%20is%20%23supercool!

    $jsonencode

    Converts the input string to an JSON friendly string.

    Usage:

    $jsonencode(input string ="string/%variable%")

    Example 1:

    $jsonencode("D:\My\Media\folder")=

    D:\\My\\Media\\folder

    Example 2:

    $jsonencode('Hello "World"')=

    Hello \"World\"

    $readarray

    Returns an instance from a valid array which must be in the form of "["data", data, etc...]". All JSON formated data is valid. By default the function will return the first instance. By default the search index starts at one (1) but if the last optional argument is 1 the search index will be zero (0) based.

    Usage:

    $readarray(input string ="string/%variable%"[, input integer = integer/%variable%, input integer = integer/%variable%])

    Example 1:

    $readarray("[23, 55.5, 19]", 2)=

    55.5

    Example 2:

    $readarray('["make", "my","day"]', 3)=

    day

    $xxhash

    Returns an 8 character hash for any file. Must include full path. The hash is created using Yann Collet's xxHash which is very fast and suits large video files.

    Usage:

    $xxhash(input string ="string/%variable%")

    Example 1:

    $xxhash("x:\path\to\file.mxf")=

    61abf926

    $xxhash64

    Returns an 16 character hash for any file. Must include full path. The hash is created using Yann Collet's xxHash which is very fast and suits large video files.

    Usage:

    $xxhash64(input string ="string/%variable%")

    Example 1:

    $xxhash64("x:\path\to\file.mxf")=

    61aabf9266e8f7de

    $jsonget

    Retrieves the value from a JSON object key. The first arguments accept a string or a variable representing a valid JSON string. in the second parameter you refer to the object/key/array you want to get.

    Usage:

    $jsonget(input string ="string/%variable%", input string = "string/%variable%")

    Example 1:

    $jsonget('{"things":{"myStuff":"some other stuff"}}', "things.myStuff")=

    some other stuff

    Example 2:

    $jsonget('%s_info_ffprobe%', '[1].format_name')=

    mov,mp4,m4a,3gp,3g2,mj2

    $jsonput

    Puts a value to a JSON object. The first arguments accept a string or a variable representing a valid JSON string. If and empty string is used FFAStrans will create a new json object. The second argument refer to the object/key/array you want put the value. Third argument is the value to put in the json object. Note that this function will return the new updated or created json string object.

    Usage:

    $jsonput(input string ="string/%variable%", input string = "string/%variable%", input string = "string/%variable%")

    Example 1:

    $jsonput("", "oldStuff", "some old stuff")=

    {"oldStuff": "some old stuff"}

    Example 2:

    $jsonput("%s_json_string%", "myNewStuff", "some cool new stuff")=

    {"oldStuff": "some old stuff","myNewStuff": "some cool new stuff"}

    $week

    Returns the week number from the date specified in the parameters. If no date is specified, the function retuns the current week number.

    Usage:

    $week([input number=YEAR/"%variable%", input number=MONTH/"%variable%", input number=MONTH DAY/"%variable%"])

    Example 1:

    $week(2020, 10, 15)=

    42

    $weekday

    Returns the week day number from the date specified in the parameters. If no date is specified, the function retuns the current week number number.

    Usage:

    $weekday([input number=YEAR/"%variable%", input number=MONTH/"%variable%", input number=MONTH DAY/"%variable%"])

    Example 1:

    $weekday(2020, 10, 15)=

    5

    $loopup

    Loopup table for mapping data to other data. The function will only operate on array formated strings.

    Usage:

    $lookup(input array ="REFERENCE/%variable%", inputarray ="TABLE/%variable%", input string ="SEARCH/%variable%")

    Example 1:

    $lookup('["joe", "bill", "greg"]', '["lucy", "evy", "jane"]', "evy")=

    bill

    $loopuprep

    Loopup table for replacing strings with strings from lookup tables.

    Usage:

    $lookuprep(input array ="REFERENCE/%variable%", input array ="TABLE/%variable%", input string ="SEARCH/%variable%")

    Example 1:

    $lookuprep('["joe", "bill", "greg"]', '["lucy", "evy", "jane"]', "lucylindajane")=

    joelindagreg

    $sort

    Sorts an array formated string or a regular string. String sorting use crlf as base separator but a custom separator can be specified.

    Usage:

    $sort(input string/array ="string/%variable%"[, input string ="SEPARATOR/%variable%"])

    Example 1:

    $sort("[6,2,4,3,5]")=

    [2,3,4,5,6]

    Example 2:

    $sort('["jack", "joe", "jill", "jane", "james", "jules"]')=

    ["jack", "james", "jane", "jill", "joe", "jules"]

    $count

    Counts the occurrences of any string in a string.

    Usage:

    $count(input string ="string/%variable%", input string ="SEARCH/%variable%")

    Example 1:

    $count('jack, joe, jill, jane, james, jules', 'ja')=

    3

    $foreach

    This function will iterate and perform the desired operation on each data value. The result of each iteration will be put back into the array and presented as the new resulting array. Please note that the special keyword "%$%" represents unique data value of each iteration. The special keyword "%i%" represents each iteration number.

    Usage:

    $foreach(input string ="string/%variable%", input string ="OPERATION/%variable%")

    Example 1:

    $foreach('["jack", "joe", "jill", "jane", "james", "jules"]', '$triml("%$%", 2)')=

    ["ck", "e", "ll", "ne", "mes", "les"]

    Example 2:

    $foreach('["jack", "joe", "jill", "jane", "james", "jules"]', '%i% - %$%')=

    ["1 - jack", "2 - joe", "3 - jill", "4 - jane", "5 - james", "6 - jules"]

    Example 3:

    $foreach('[10, 11, 12, 10, 20, -6]', '%$%-%i%')=

    [9, 9, 9, 6, 15, -12]

    $stringf

    This function works very much like the printf() function in C. It shares the same notation. The difference is that if you have multiple arguments you need to put them in an array.

    Usage:

    $stringf(input string ="string/%variable%", input data/array ="ARGUMENTS/%variable%")

    Example 1:

    $stringf('%05d', 12)=

    00012

    Example 2:

    $stringf('%02i\%02i\%04i', '[1,8,2021]')=

    01\08\2021

    $fsize

    Get file size in bytes.

    Usage:

    $fsize(input string ="string/%variable%")

    Example:

    $fsize("D:\Replace spaces in filename") =

    57162

    $fext

    Get file extension.

    Usage:

    $fext(input string ="string/%variable%")

    Example:

    $fext("D:\Replace spaces in filename.mp4") =

    mp4

    $fname

    Get file name.

    Usage:

    $fname(input string ="string/%variable%")

    Example:

    $fname("D:\my_file.mxf") =

    my_file

    $fpath

    Get file path.

    Usage:

    $fpath(input string ="string/%variable%")

    Example:

    $fpath("D:\cool folder\right_here\my_file.mxf") =

    D:\cool folder\right_here

    $fdrive

    Get file path.

    Usage:

    $fdrive(input string ="string/%variable%")

    Example:

    $fdrive("D:\cool folder\right_here\my_file.mxf") =

    D:

    $asplit

    Splits an array string into a delimited string using the optional separator. Default separator is \r\n (carriage return and line feed)

    Usage:

    $asplit(input string/array ="string/%variable%"[, input string ="SEPARATOR/%variable%"])

    Example 1:

    $asplit("[6,2,4,3,5]", "|")=

    6|2|3|4|5

    Example 2:

    $asplit('["jack", "joe", "jill", "jane", "james", "jules"]')=

    jack

    joe

    jill

    jane

    james

    jules

    $ffconcat

    Creates a ffconcat version 1.0 compatible string for use with encoder input.

    Usage:

    $ffconcat(input string/array ="string/%variable%")

    Example:

    $ffconcat('["c:\myClips\video1.mov", "c:\myClips\video1.mov", "c:\myClips\video3.mov"]')=

    ffconcat version 1.0

    file 'c:\myClips\video1.mov'

    file 'c:\myClips\video2.mov'

    file 'c:\myClips\video3.mov'

    $owner

    Find the domain owner of a file.

    Usage:

    $owner(input string ="string/%variable%")

    Example:

    $owner("D:\cool folder\right_here\my_file.mxf") =

    domain/ElonMusk

    $waccess

    Check if user running the ffastrans system has write access to the specified folder.

    Usage:

    $waccess(input string ="string/%variable%")

    Example:

    $waccess("D:\cool folder\right_here") =

    1

    $dateweek

    Finds the date (year_month_mday) of any given year, week number, week day number and week start day.

    Usage:

    $dateweek(input integer = integer/%variable%[, input integer = integer/%variable%, input integer = integer/%variable%, input string ="string/%variable%"])

    Example: (find date of week no. 35, the second day of the week starting on monday)

    $dateweek(1973, 35, 2, 'mon')=

    1973_08_28

    $timecalc

    Calculates a new date/time by adding/subtracting a specified number of time intervals from an initial date/time. y = year, M = month, d = day, w = week, h = hour, m = minute, s = second

    Usage:

    $timecalc(input integer = integer/%variable%[, input integer = integer/%variable%, input integer = integer/%variable%, input string ="string/%variable%"])

    Example 1: (add 60 days)

    $timecalc('d', 60, '2019/11/24')=

    2020_01_23

    Example 2: (add 3 hours)

    $timecalc('h', 3, '2019/11/24 22:35:00')=

    2019_11_25 01:35:00

    $shortcut

    Parse the shortcut (Windows) or alias (MAC) and return the actual file path.

    Usage:

    $shortcut(input string ="string/%variable%")

    Example:

    $shortcut("c:\users\myname\desktop\cool video.mkv - Shortcut.lnk") =

    \\server\some_share\projects\REALITY_SHOW\my video files\cool video.mkv