Formulas

Discussion related to "Everything" 1.5 Alpha.
Post Reply
void
Developer
Posts: 16745
Joined: Fri Oct 16, 2009 11:31 pm

Formulas

Post by void »

Everything 1.5.0.1322a adds formulas.



With formulas you can:
Customize the formatting of properties with custom columns.
Search for files and folders when using $property-name: and the formula evaluates to true.
See the result when using the /= search command.
Change setting values from the search box.



Formulas support C style expressions.

For example, show the size in bits in column 1:
column1:=$size:*8 add-column:column1



Custom columns

There are 16 assignable custom columns.
Column values can be accessed with the Column 0 - Column 9 or Column A - Column F properties.


To set a custom column, include the following in your search:
column1:=formula

where 1 is the column number (0-9) and formula is the column formula.

For example:
column1:=1+1
<foo column1:=1> | <bar column1:=0>



Properties can be referenced with $property-name:
Use - for spaces in the property name.

For example:
column1:=$size:*8
column1:=day($date-modified:)
column1:=len($regular-expression-match-1:)



Searching with formulas

Examples:

$date-modified:==$date-created: (date-modified is equal to date-created)
UPPER($name:)>="N" UPPER($name:)<="S" (Name starts with N to S)
$name:[1]=='o' (Second letter of name is o)
len($stem:)%3==0 (Stem length is a multiple of 3)
*.lnk !exists($shortcut-target:) (find lnk files where the shortcut target doesn't exist in your index)



View the result of the expression

Type in your expression with the /= prefix and press ENTER.

For example:

/=now()
/=year(now()).."-"..month(now()).."-"..day(now())



Change setting values

Type in your expression with the / prefix and press ENTER.

For example:

/window_x=rand()%1000;window_y=rand()%1000
/window_x=window_y
/alternate_row_color=!alternate_row_color



Functions

Most Excel text functions, Integer functions and logical functions are supported.

Most preprocessor search functions are supported.

The following functions are supported:
  • ABS(x) - Absolute value of x.
  • ACOS(x) - Inverse cosine of x in radians.
  • ACOSH(x) - Inverse hyperbolic cosine of x.
  • ADD_TRAILING_PATH_SEPARATOR(path) - add a trailing path separator to path.
  • AND(x,y,z,...) - logical AND of all parameters.
  • ASIN(x) - Inverse sine of x in radians.
  • ASINH(x) - Inverse hyperbolic sine of x.
  • ATAN(x) - Inverse tangent of x in radians.
  • ATAN2(x,y) - Angle between the line segment 0,0 -> x,y in radians.
  • ATANH(x) - Inverse hyperbolic tangent of x.
  • BASENAME(path) - Name part of path.
  • CEILING(x,[factor]) - Round up x to the nearest integer multiple of specified significance.
  • CHARACTER_COUNT(text) - Returns the number of characters in text.
  • CHAR(x) - Character from Unicode point x.
  • CLEAN(string) - Remove non-printable characters from string.
  • CODE(ch) - Unicode point from character ch.
  • CONCAT(x,y,z,...) - Concatenate all parameters into one string.
  • CONCATENATE(x,y,z,...) - Concatenate all parameters into one string.
  • COS(x) - Cosine of x in radians.
  • COSH(x) - Hyperbolic cosine of x in radians.
  • CRC32(text) - Compute the crc32 sum of text.
  • CRC64(text) - Compute the crc64 sum of text.
  • DAY(date-or-filetime) - Day value from a date or filetime.
  • DATE(year,month,day) - Returns the specified date as a FILETIME serial number.
  • DATEVALUE(date-or-filetime) - Local date part from the specified filetime as a filetime.
  • DEC2HEX(num,zero-padding) - Convert decimal num to hexidecimal
  • DEGREES(x) - Convert x in radians to degrees.
  • EDATE(filetime/date,month-offset) - Get the filetime with a month offset from the specified filetime/date.
  • ELEMENT(list,separator-characters,index) - Get the list item from the specified 1 base index.
  • ELEMENT_COUNT(list,separator-characters) - Returns the number of items in a list.
  • EVAL(expression) - Evaluate the expression and return the result.
  • EXACT(a,b) - Text compare a with b.
  • EVEN(x) - Round up x to the nearest even integer.
  • EXISTS(filename,[match-case]) - Returns true if the file or folder with the specified name exists in your index. Otherwise, returns false.
  • EXP(x) - Euler's number to the power of x.
  • EXTENSION(path) - Extension part of path with dot (.)
  • FILE_EXISTS(filename,[match-case]) - Returns true if the file with the specified name exists in your index. Otherwise, returns false.
  • FILENAME(path) - Name part of path.
  • FILETIME(date) - Convert a date to a filetime.
  • FILETIME_TO_LOCAL_FILETIME(utcfiletime) - Converts a filetime in UTC to a local filetime.
  • FIND(search,text,[start-index]) - Case sensitive find search inside text.
  • FLOOR(x,[factor]) - Round x down to the nearest integer multiple of specified significance.
  • FOLDER_EXISTS(filename,[match-case]) - Returns true if the folder with the specified name exists in your index. Otherwise, returns false.
  • FORMAT_DURATION(time,[format]) - Format 100-nanosecond time duration.
  • FORMAT_FILE_ATTRIBUTES(windows-file-attributes) - Format file attributes
  • FORMAT_FILETIME(filetime,[format]) - Format a windows filetime.
  • FORMAT_FILETIME_UTC(filetime,[format]) - Format a windows filetime in UTC.
  • FORMAT_NUMBER(num) - Add commas to large numbers.
  • FORMAT_SIZE(size,[format]) - Format size
  • GET_PROPERTY(filename,property-name) - Returns the indexed property value from the specified filename and property.
  • HAS_BASENAME(path) - Returns 1 if path has a basename. Otherwise, returns 0.
  • HAS_EXTENSION(path) - Returns 1 if path has an extension. Otherwise, returns 0.
  • HAS_FILENAME(path) - Returns 1 if path has a filename. Otherwise, returns 0.
  • HAS_PARENT_PATH(path) - Returns 1 if path has a parent path. Otherwise, returns 0.
  • HAS_RELATIVE_PATH(path) - Returns 1 if path has a relative path. Otherwise, returns 0.
  • HAS_ROOT_DIRECTORY(path) - Returns 1 if path has a root directory. Otherwise, returns 0.
  • HAS_ROOT_NAME(path) - Returns 1 if path has a root name. Otherwise, returns 0.
  • HAS_ROOT_PATH(path) - Returns 1 if path has a root path. Otherwise, returns 0.
  • HAS_STEM(path) - Returns 1 if path has a stem. Otherwise, returns 0.
  • HEX2DEC(hex-value) - Returns a hexidecimal value as a decimal value.
  • HOUR(date-or-filetime) - Hour of the specified date or filetime.
  • IF(x,y,z) - If x is TRUE (or non-zero), return y. Otherwise, return z.
  • IFLEN(x,y,z) - If the length of x is larger than 0, return y. Otherwise, return z.
  • IFS(condition1,result1,condition2,result2,...) - If condition1 is true return result1, if condition2 is true return result2, ...
  • INT(text) - Convert text to an integer.
  • IS_ABSOLUTE(path) - Returns 1 if path is absolute. Otherwise, returns 0.
  • IS_BLANK(text) - Returns 1 if the text is blank/empty. Otherwise, returns 0.
  • IS_ERROR(x) - Quirk returns 1 if x is NULL. Otherwise, returns 0.
  • IS_RELATIVE(path) - Returns 1 if path is relative. Otherwise, returns 0.
  • LEFT(text,[count]) - Returns the left part of the text.
  • LEN(text) - Returns the length of the string in UTF-16 characters.
  • LINE_COUNT(text) - Returns the number of lines in text.
  • LOCAL_FILETIME_TO_FILETIME(localfiletime) - Converts a local filetime to a filetime in UTC.
  • LOG(x,[base]) - Returns the logarithm of x given a base (10 by default).
  • LOG10(x) - Returns the logarithm of x with base 10.
  • LOWER(text) - Returns the text as lowercase.
  • LOWERCASE(text) - Returns the text as lowercase.
  • LPAD(text,pad-char) - Left pad text with the specified pad-char.
  • LTRIM(text) - Remove spaces from the left of text.
  • MAKE_PREFERRED(path) - Fix path separators.
  • MAX(x,y,z,...) - Return the maximum value.
  • MD5(text) - Compute the md5 sum of text.
  • MID(text,start,length) - Return a substring.
  • MIN(x,y,z,...) - Return the minimum value.
  • MINUTE(date-or-filetime) - Minute value from a date or filetime.
  • MOD(x,y) - Returns the modulo of x and y.
  • MONTH(date-or-filetime) - Month value from a date or filetime.
  • N(x) - Return x if x is a number. Otherwise, returns 0.
  • NOT(x) - Return logical NOT of x.
  • NOW() - Return the current filetime.
  • OR(x,y,z,...) - Return the logical OR of all parameters.
  • PARAGRAPH_COUNT(text) - Returns the number of paragraphs in text.
  • PATH_CANONICALIZE(path) - Return the canonicalized path.
  • PATH_COMBINE(path-part,name-part) - Combine path and name with the correct path separator.
  • PATH_PART(path) - Return the path part from the specified path.
  • PI(x,y) - Returns 3.14159265358979323846
  • POWER(base,exp) - Return the power from the specified base and exponent.
  • PRINTF(format,...) - C style printf
  • PRODUCT(x,y,z,...) - Multiple all numbers together.
  • PROPER(text) - Convert text to titlecase.
  • RADIANS(x) - Convert x in degrees to radians.
  • RAND() - Return a random number.
  • RANDBETWEEN(x,y) - Return a random number between x and y (inclusive)
  • REGEX_ESCAPE(text) - Return text with special regex characters escaped.
  • REGEX_EXTRACT(text,pattern) - Return the regex match.
  • REGEX_FIND(pattern,text) - Return the 1-based index of the first case sensitive regex match.
  • REGEX_MATCH(text,pattern) - Returns 1 if the specified pattern is found. Otherwise, returns 0.
  • REGEX_REPLACE(text,pattern,replacement-text) - Replace pattern in text with replacement-text.
  • REGEX_SEARCH(pattern,text) - Return the 1-based index of the first case insensitive regex match.
  • REGEX_UNESCAPE(text) - Return text with special regex characters unescaped.
  • RELATIVE_PATH(path) - Returns the relative path of the specified path.
  • REMOVE_BASENAME(path) - Removes the basename from path.
  • REMOVE_DIACRITICS(text) - Removes diacritics from text.
  • REMOVE_EXTENSION(path) - Removes the extension from path.
  • REMOVE_FILENAME(path) - Removes the basename from path.
  • REMOVE_TRAILING_PATH_SEPARATOR(path) - Removes the trailing path separator from path.
  • REPEAT(text,count) - Repeat text, count times.
  • REPLACE(old,start,len,new) - Replace part of old with new.
  • REPLACE_BASENAME(path,new-basename) - Return path with a new basename.
  • REPLACE_EXTENSION(path,new-extension) - Return path with a new extension.
  • REPLACE_FILENAME(path,new-basename) - Return path with a new basename.
  • REPT(text,count) - Repeat text, count times.
  • RIGHT(text,[count]) - Returns the right part of the text.
  • ROMAN(x) - Convert x to roman numerals.
  • ROOT_DIRECTORY(path) - Return the root directory from the specified path.
  • ROOT_NAME(path) - Return the root name from the specified path.
  • ROOT_PATH(path) - Return the root path from the specified path.
  • ROUND(x,[places]) - Round x to the specified number of decimal place.
  • ROUNDDOWN(x,[places]) - Round x down to the specified number of decimal place.
  • ROUNDUP(x,[places]) - Round x up to the specified number of decimal place.
  • RPAD(text,pad-char) - Left pad text with the specified pad-char.
  • RTRIM(text) - Remove spaces from the right of text.
  • SEARCH(search,text,[start-index]) - Case insensitive find search inside text.
  • SECOND(date-or-filetime) - Second value from a date or filetime.
  • SHA1(text) - Compute the sha1 sum of text.
  • SHA256(text) - Compute the sha256 sum of text.
  • SHA384(text) - Compute the sha384 sum of text.
  • SHA512(text) - Compute the sha512 sum of text.
  • SIGN(x) - Returns -1 if x is negative, 1 if x is positive and 0 if x is 0.
  • SIN(x) - Sine of x in radians.
  • SINH(x) - Hyperbolic sine of x in radians.
  • SQRT(x) - Returns the square root of x.
  • STEM(path) - Return the stem part of the specified path.
  • STRCMP(a,b) - Case sensitive string compare.
  • STRICMP(a,b) - Case insensitive string compare.
  • STRINGCOUNT(text,search) - Returns the number of occurrences of search inside text.
  • STRLEN(text) - Returns the length of the string in UTF-16 characters.
  • STRLWR(text) - Returns the text as lowercase.
  • STRUPR(text) - Returns the text as uppercase.
  • STUFF(text,start,len,text-to-insert) - Return text with text-to-insert inserted.
  • SUBSTITUTE(text,old,new) - Replace old with new in text.
  • SUBSTR(text,start,[length]) - Return a substring.
  • SUBSTRING(text,start,[length]) - Return a substring.
  • SUM(x,y,z,....) - Return the sum of all parameters.
  • SWITCH(value,case1,value1,case2,value2,....,default-value) - Return a value from a matching case.
  • T(x) - Returns x if x is text. Otherwise, returns empty text.
  • TAN(x) - Tangent of x in radians.
  • TANH(x) - Hyperbolic tangent of x in radians.
  • TEXT(text,format) - Format text.
  • TEXTJOIN(separator-character,ignore-empty,x,y,z,....) - Concatenate parameters with a separator character.
  • TIME(hour,minute,second) - Returns the specified time as a FILETIME serial number.
  • TIMEVALUE(date-or-filetime) - Local time part from the specified filetime as a filetime.
  • TITLECASE(text) - Convert text to titlecase.
  • TODAY() - Returns the current date.
  • TRIM(text) - Remove spaces from the start and end of text.
  • TRUNC(x,[places]) - Truncate x to the specified number of significant digits.
  • UNICHAR(num) - Returns the Unicode character from the specified Unicode point.
  • UNICODE(ch) - Returns the Unicode point from the specified Unicode character.
  • UPPER(text) - Returns the text as uppercase.
  • UPPERCASE(text) - Returns the text as uppercase.
  • UTF82HEX(text) - Returns text as hex data.
  • UTF8LEN(text) - Returns the length of text in UTF-8 bytes.
  • VERSION() - Returns the current version of Everything.
  • WEEKDAY(date-or-filetime) - Weekday value from a date or filetime.
  • WORD_COUNT(text) - Returns the number of words in text.
  • XOR(x,y,z,...) - Returns the XOR result of all parameters.
  • YEAR(date-or-filetime) - Year value from a date or filetime.


Underscores (_) in function names can be omitted.



To show column 1:
  • Right click the result list column header and click Add columns....
  • Select Column 1 and click OK.
-or-

Include the following in your search:
addcolumn:column1



Columns values are updated in real-time.



Excel Quirks

Everything uses FILETIMEs for date/time serial numbers.
Everything uses NULL for errors and invalid values.
void
Developer
Posts: 16745
Joined: Fri Oct 16, 2009 11:31 pm

Re: Assignable Columns

Post by void »

Everything 1.5.0.1319a fixes an issue with column2:= (to column9:=) not matching anything.
void
Developer
Posts: 16745
Joined: Fri Oct 16, 2009 11:31 pm

Re: Column Formulas

Post by void »

Everything 1.5.0.1322a adds support for Excel formulas.

Properties can be referenced with <property name> + ':'
Use - for spaces in the property name.

For example:

column1:=size:*8 add-column:column1
column1:=1+1 add-column:column1
column1:=TEXTJOIN(";",TRUE,size:,formatfiletime(dm:,"YYYY-MM-DD\THH:mm:ss")) add-column:column1



Renamed "Assignable Columns" to "Column Formulas".



Column Formulas are now updated in real-time.
void
Developer
Posts: 16745
Joined: Fri Oct 16, 2009 11:31 pm

Re: Column Formulas

Post by void »

Everything 1.5.0.1327a adds the following column formula functions:

crc32(text) - compute the crc32 sum of text
crc64(text) - compute the crc64 sum of text
md5(text) - compute the md5 sum of text
sha1(text) - compute the sha1 sum of text
sha256(text) - compute the sha256 sum of text
sha384(text) - compute the sha384 sum of text
sha512(text) - compute the sha512 sum of text
void
Developer
Posts: 16745
Joined: Fri Oct 16, 2009 11:31 pm

Re: Column Formulas

Post by void »

Everything 1.5.0.1331a adds the following column formula functions:

INT(text) - convert text to a number
FORMAT_FILETIME_UTC(filetime,[format]) - format a windows filetime in UTC.
void
Developer
Posts: 16745
Joined: Fri Oct 16, 2009 11:31 pm

Re: Column Formulas

Post by void »

Everything 1.5.0.1332a fixes an issue with ?: conditionals eating the : as literal.

Everything 1.5.0.1332a adds support for $property-name:
void
Developer
Posts: 16745
Joined: Fri Oct 16, 2009 11:31 pm

Re: Column Formulas

Post by void »

Possible use of column formulas to rank results:

foo bar column1:=regexmatch($fullpath:,"^C:\\Users\\My User Name\\")?1:0 sort:column1-descending;dm

Files under C:\Users\My User Name\ are listed first.
Files are then sorted by date modified descending.
void
Developer
Posts: 16745
Joined: Fri Oct 16, 2009 11:31 pm

Re: Column Formulas

Post by void »

Everything 1.5.0.1336a adds the following formula functions:

utf8len() - calculate the length of string in UTF-8 bytes.

Added Column A - Column F
void
Developer
Posts: 16745
Joined: Fri Oct 16, 2009 11:31 pm

Re: Column Formulas

Post by void »

Everything 1.5.0.1338a fixed a crash when using Column A - Column F
void
Developer
Posts: 16745
Joined: Fri Oct 16, 2009 11:31 pm

Re: Column Formulas

Post by void »

Everything 1.5.0.1339a adds the following functions:

formatfiletime(edate("2023-03-02",-1)) => 2023-02-02
datevalue("2023-03-02") => 133221510000000000
timevalue("2023-03-02t16:57:23") => 610430000000
dec2hex(15,2) => 0f
void
Developer
Posts: 16745
Joined: Fri Oct 16, 2009 11:31 pm

Re: Column Formulas

Post by void »

Everything 1.5.0.1340a adds the following functions:

power(10,7) => 10000000
DerekZiemba
Posts: 42
Joined: Thu Sep 27, 2018 4:46 pm

Re: Column Formulas

Post by DerekZiemba »

Do the regex functions work?
I thought the following would fill the column with the matched text. And if this were to work, how would you select named groups?
column1:=REGEX_EXTRACT($Name:, ".+") add-column:column1

Also how do you use the RegularExpressionMatch columns? I tried:
  • Thought maybe the match groups were perhaps populated when REGEX_EXTRACT is run:
    REGEX_EXTRACT($Name:, "\W*(\w+)") add-column:RegularExpressionMatch0 add-column:REgularExpressionMatch1
  • Tried setting the variable:
    <$regular-expression-match-1:=REGEX_EXTRACT($Name:, ".+")> add-column:Column0 add-column:RegularExpressionMatch0 add-column:RegularExpressionMatch1
  • Various combination of earlier attempts like:
    Column0:=REGEX_EXTRACT($Name:, ".+") add-column:Column0 add-column:RegularExpressionMatch0 add-column:REgularExpressionMatch1
The following is a very rough expression (gets me ~<90% there) of what I eventually want to run. The goal is to pick out poorly formatted usernames & names of people from file names, the names could be Snake (_|.|\s delimited), Pascal, Kebab, or Camel case. After I verified the basics worked, the next step was to figure out how to select the 'name' group and fill the column with it - not sure if that's possible though? Flavor is PCRE2(PHP>=7.3), I think that's the implementation in Everything...

Code: Select all

(?|
 (?:^(?!(?:\#[A-Za-z]+\s)+))(?|
  (?:(?:(?:(?<name>[A-Z][a-zA-Z]{3,}(?:[\s_]?[A-Z][a-zA-Z]{2,}){1,2}[0-9]{0,3})(?=\s*?\-|,\s+|\s+\&|\_\W|\W+[0-9]{2,}|\W+?(?:(?:[\s\.\-]+|^|\b)(?i:a|at|as|are|and|after|&|\+|have|how|I[tsn]?|me|my|or|of|on|the|that|to|do|for|final|when|with)(?:[\s\.\-]+|$|\b))))(?=.+$)))
   |(?:(?:[0-9]?(?<name>[a-zA-Z]{3,}[0-9]{0,3}_?(?:[a-zA-Z]{3,}[0-9]{0,3}_?)))(?=(?:\_[a-zA-Z]|[\-\s]\b)))
   |(?:(?<name>[A-Z][a-z]{2,}\s[A-Z][a-z]{2,}_?[0-9]{0,3}))
   |(?:(?:^|(?<!\d)\s-\s?)(?<name>[a-z_]{3,}[_\-\s]?(?!(?:(?:[\s\.\-]+|^|\b)(?i:a|at|as|are|and|after|&|\+|have|how|I[tsn]?|me|my|or|of|on|the|that|to|do|for|final|when|with)(?:[\s\.\-]+|$|\b)))[a-z]{2,}\d{0,3}_?)(?=_|,|\s[&\d]|\s?[\-\#]))
   |(?:(?<name>[a-z]{3,}\s[a-z]{2,})(?=\s?(?:[\-\&\[\#•]|[\(\[]?\d{3,}|(?:(?:[\s\.\-]+|^|\b)(?i:a|at|as|are|and|after|&|\+|have|how|I[tsn]?|me|my|or|of|on|the|that|to|do|for|final|when|with)(?:[\s\.\-]+|$|\b)))))
   |(?:(?<name>[a-zA-Z]{3,}_?[a-zA-Z]{3,}_?[0-9]{0,3}))
   |(?:(?<name>[a-z]{3,}[_\s]?[a-z]{2,}_?[0-9]{0,3}))
  )
  |(?<name>[A-Z][a-zA-Z]{3,}[\s\_][A-Z][a-zA-Z]{3,}(?=[,-]))
  |(?:\#[A-Za-z]+\s)+(?<name>\b[A-Z][a-zA-Z]{3,}[\s\_][A-Z][a-zA-Z]{3,}(?=\s))
)
void
Developer
Posts: 16745
Joined: Fri Oct 16, 2009 11:31 pm

Re: Column Formulas

Post by void »

There's a space after the ,

Please try the following:

Code: Select all

column1:=REGEX_EXTRACT($Name:,".+") add-column:column1
DerekZiemba
Posts: 42
Joined: Thu Sep 27, 2018 4:46 pm

Re: Column Formulas

Post by DerekZiemba »

Thank You!
In case someone else ends up finding this via google, I went with the following (but with all spacing removed). I was pleasantly surprised I could nest the functions!:

Code: Select all

#define<:extracted-user-name=#{: 
add-column:Column0   
column0:=REGEX_EXTRACT(
             REGEX_EXTRACT($Name:,
             "(?|
               (?:(?>\#[A-Za-z]+[\s0-9]*\s)?(?>(?i:\&|\+|[ai][tnms]?|are|and|by|have|how|m[ey]|o[rfn]|the|that|[dt]o|for)(?:[\s\.\-]+|\b))?
               (?<name>(?:[A-Za-z]{2,}[\sA-Z\_][a-zA-Z0-9_]+)|(?:[a-zA-Z]{3,}\.?[a-zA-Z0-9_]+)|(?:[a-zA-Z0-9]{10,}))
               (?=[,\s\-]+(?:(?i:\&|\+|[ai][tnms]?|are|and|by|have|how|m[ey]|o[rfn]|the|that|[dt]o|for)(?:[\s\.\-]+|\b))?))
              )"
             ),
         "^(?:\#[A-Za-z]+[\s0-9]*\s)?(.+)"
         ) 
#}:#>: 
Then added that function to my list of defines filter.

Code: Select all

#define<:extracted-user-name=#{: add-column:Column0   column0:=REGEX_EXTRACT(REGEX_EXTRACT($Name:,"(?|(?:(?>\#[A-Za-z]+[\s0-9]*\s)?(?>(?i:\&|\+|[ai][tnms]?|are|and|by|have|how|m[ey]|o[rfn]|the|that|[dt]o|for)(?:[\s\.\-]+|\b))?(?<name>(?:[A-Za-z]{2,}[\sA-Z\_][a-zA-Z0-9_]+)|(?:[a-zA-Z]{3,}\.?[a-zA-Z0-9_]+)|(?:[a-zA-Z0-9]{10,}))(?=[,\s\-]+(?:(?i:\&|\+|[ai][tnms]?|are|and|by|have|how|m[ey]|o[rfn]|the|that|[dt]o|for)(?:[\s\.\-]+|\b))?)))"),"^(?:\#[A-Za-z]+[\s0-9]*\s)?(.+)") #}:#>: 
#define<:corrupt-office=#{:  <ext:<docx;xlsx;doc;xls> <size:"<1kb"|!file-signature:<"application/zip";"application/x-ole-storage">|hex:startwith:binarycontent:0000|hex:endwith:binarycontent:0000>>  #}:#>: 
#define<:corrupt=#{:  #corrupt-office:|<<content-type:|perceived-type:|ext:<doc;docx;dotx;xltx;xls;xlsx;xlsb;pps;ppt;pptx;pub;rtf;md;pdf;jpg;jpeg;png;heic;avi;mp4;mkv;3g2;3gp;3gp2;3gpp;flv;m4v;mpg;mpeg;mov;ogv;webm;wmv;exe;dll;msi;cab;jar>> <hex:startwith:binarycontent:00000000|hex:endwith:binarycontent:00000000>>  #}:#>:
#define<:filtered=#{: #only-progs:"Applied\" #no-protected: #no-temp: #no-modules: #no-blockchain: #no-progfiles: #no-appdata-junk:  #}:#>: 
#define<:only-progs<x>=#{: <!<<#x:> !ext:<exe;lnk;cmd>> !end-with:".ni.exe" > #}:#>: 
#define<:no-sys=#{: #only-progs:attrib:S #only-progs:owner:<SYSTEM;"TrustedInstaller">  #only-progs:"C:\Windows\" !"C:\Windows\Assembly\" !regex:"(LOCK|CURRENT)$"  #}:#>:  
#define<:no-ignored=#{: #only-progs:attrib:I !ext:<file;index;wdseml;pdb;odlsent;ri> !"AppData.Roaming.Thunderbird-profile\" !ads-names:"com.dropbox.ignored"    #}:#>:  
#define<:no-hidden=#{: #only-progs:attrib:H #only-progs:path:regex:"\\\..+($|\\)"  #}:#>:  
#define<:no-protected=#{: #no-sys: #no-ignored: #no-hidden: #}:#>:  
#define<:no-temp=#{: #only-progs:<"\TEMP\"|"\tmp\"|"\Spotify\">  #}:#>:  
#define<:no-modules=#{: !"\Packages\" !"\Package Cache\" !"site-packages\"   #only-progs:<"\go\pkg\mod\"|"\.nuget\"|"\node_modules\"|"\ruby\gems\"|"\python*\lib\">  #}:#>:   
#define<:no-blockchain=#{: !"\Raven\chainstate\" !"\Raven\blocks\" !"\Daedalus Mainnet\chain\"  #}:#>:  
#define<:no-progfiles=#{: #only-progs:<"C:\ProgramData\"|"C:\Program Files\"|"C:\Program Files (x86)\"|"msys64\"|"mingw32\"|"steamapps\">   #}:#>: 
#define<:no-appdata-junk=#{: !<"C:\Users\*\AppData\" <"\SourceServer\"|"\*Cache*\"|"\User Data\"|"\TypeScript\"|"\resources\"|"\workspaceStorage\"> > #}:#>:  
#define<:exe=#{: ext:<exe;msi;cpl;vsix;jar> #}:#>:  
#define<:bin-lnk=#{: <ext:lnk regex:ShortcutTarget:"\.(exe|msi|msm|msp|mst|rll|dll|cpl|cab|sys|ocx|vsix|bin|jar|scr)$"> #}:#>:  
#define<:bin=#{: <#bin-lnk:|ext:<exe;msi;msm;msp;mst;rll;dll;cpl;cab;sys;ocx;vsix;bin;jar;scr>>  #}:#>: 
#define<:book=#{: ext:<pdf;epub;mobi>  #}:#>:  
#define<:audio=#{: ext:<aac;ac3;amr;flac;m4a;mp3;wav;wma>  #}:#>:  
#define<:sound=#{: ext:<aif;aifc;aiff;au;cda;dts;fla;m1a;m2a;m3u;mid;midi;mka;mod;mp2;mpa;ogg;opus;ra;rmi;snd;umx;voc;weba;xm>  #}:#>:  
#define<:icon=#{: ext:<ani;cur;ico;svg;tga;tif;tiff;wmf;wmp>  #}:#>:  
#define<:movie=#{: ext:<avi;mp4;mkv>  #}:#>:  
#define<:film=#{: #movie: length:>15m height:>500 dimensions:   #}:#>:   
#define<:video=#{: <#movie:|ext:<3g2;3gp;3gp2;3gpp;flv;m4v;mpg;mpeg;mov;ogv;webm;wmv>>  #}:#>:    
#define<:photo=#{: ext:<dng;heic;jpg;jpeg;png>  #}:#>:  
#define<:image=#{: <#photo:|ext:<bmp;heif;svg;tif;tiff;tga;webp>>  #}:#>:      
#define<:gif=#{: ext:<apng;gif;gifv>  #}:#>:   
#define<:photoshop=#{: <ext:<psb;psd> > #}:#>:     
#define<:picture=#{: <#photo:|#image:|#gif:|#photoshop:> #}:#>:    
#define<:note=#{: ext:<one;note;md;rtf;nfo> #}:#>:  
#define<:excel=#{: ext:<xl;xlsx;xlsm;xlsb;xlam;xltx;xltm;xls;xla;xlt;xlm;xlw;sldm;sldx>  #}:#>:    
#define<:word=#{:  ext:<doc;docm;docx;dot;dotm;dotx;thmx;odt;wpd;wps;tex;pdf> #}:#>:    
#define<:powerpoint=#{: ext:<potx;potm;ppam;ppsm;ppsx;pps;ppt;pptm;pptx;sldm;sldx> #}:#>:    
#define<:office=#{: <#word:|#powerpoint:|#excel:|ext:one>  #}:#>:  
#define<:logs=#{: <ext:<log;etl;dmp>| file:regex:"log\.?\d*$" | <regex:file:name:"(?<!Dia|cata)log(?!o|in)" <ext:<"">|perceived-type:text> valid-utf8:>>  #}:#>:    
#define<:config=#{:  <ext:xml;yml;json;ini>|<ext:settings;manifest;vsixmanifest>|<ext:config;jsconfig;tsconfig;editorconfig;dotsettings>|<ext:gitconfig;gitmodules;gitignore;gitattributes>|<ext:profile;bash_profile>|<regex:"\.[a-z]{2,12}rc$">  #}:#>:  
#define<:plaintext=#{:  <<perceived-type:text>|<content-type:"text"|wildcards:content-type:<"*script*";"*xml*";"*json*">>|<ext:txt;md;rtf>|<ext:nfo !hex-contents:000000>|<regex:"CHANGELOG|README|CONTRIBUTING">|<case:regex:"(^[[:upper:]]+$)">|<case:endwith:<INSTALL|BUGS>>>  #}:#>: 
BTW, off topic for here, but is there a better way or place to define my macros & have them available everywhere? Currently I place the block of text above into a filter that's assigned `_` then reference that filter in all the other filters with `_:` like so:
Capture.PNG
Capture.PNG (60.88 KiB) Viewed 50911 times
bit
Posts: 38
Joined: Fri Feb 17, 2023 8:57 am

Re: Column Formulas

Post by bit »

void wrote: Mon Jan 02, 2023 9:04 am foo bar column1:=regexmatch($fullpath:,"^C:\\Users\\My User Name\\")?1:0 sort:column1-descending;dm
There is only "REGEX_MATCH" listed as functions.
Is this a special case, or, all other column functions can be used without underscore in their names?

ANd the "?" operator are not listed/explained in this post.
void
Developer
Posts: 16745
Joined: Fri Oct 16, 2009 11:31 pm

Re: Column Formulas

Post by void »

There is only "REGEX_MATCH" listed as functions.
Is this a special case, or, all other column functions can be used without underscore in their names?
The underscore (_) can be omitted in function names.
I'll leave them in the descriptions for readability.
I've added this note to the main post.


ANd the "?" operator are not listed/explained in this post.
Column Formulas support C style expressions.
This includes the ternary conditional operator.

Ternary conditional operator:
expression '?' true-value ':' false-value

if expression is true, the true-value is returned.
if expression is false, the false-value is returned.

For example:

len($name:)>5?"long name":"short name"

if length of the name is longer than 5, return "long name" else return "short name"
void
Developer
Posts: 16745
Joined: Fri Oct 16, 2009 11:31 pm

Re: Column Formulas

Post by void »

Everything 1.5.0.1360a adds the following functions:

exists(filename,[match-case]) - Returns true if the file or folder with the specified name exists. Otherwise, returns false.
file-exists(filename,[match-case]) - Returns true if the file with the specified name exists. Otherwise, returns false.
filetime-to-local-filetime(utcfiletime) - Converts a filetime in UTC to a local filetime.
folder-exists(filename,[match-case]) - Returns true if the folder with the specified name exists. Otherwise, returns false.
get-property(filename,property-name) - Returns the indexed property value from the specified filename and property.
local-filetime-to-filetime(localfiletime) - Converts a local filetime to a filetime in UTC.



The following functions will now return null when a non-number-parameter is passed:
dec2hex()
abs()
format-number()
format-size()
anmac1789
Posts: 669
Joined: Mon Aug 24, 2020 1:16 pm

Re: Column Formulas

Post by anmac1789 »

void wrote: Thu Nov 16, 2023 5:22 am Everything 1.5.0.1360a adds the following functions:

exists(filename,[match-case]) - Returns true if the file or folder with the specified name exists. Otherwise, returns false.
file-exists(filename,[match-case]) - Returns true if the file with the specified name exists. Otherwise, returns false.
filetime-to-local-filetime(utcfiletime) - Converts a filetime in UTC to a local filetime.
folder-exists(filename,[match-case]) - Returns true if the folder with the specified name exists. Otherwise, returns false.
get-property(filename,property-name) - Returns the property value from the specified filename and property.
local-filetime-to-filetime(localfiletime) - Converts a local filetime to a filetime in UTC.



The following functions will now return null when a non-number-parameter is passed:
dec2hex()
abs()
format-number()
format-size()
is this used by itself or with column1:= any of the commands above..
NotNull
Posts: 5461
Joined: Wed May 24, 2017 9:22 pm

Re: Column Formulas

Post by NotNull »

These are Column Formulas (hence the topic title ;) ) and are used to build what is shown in custom columns.
anmac1789
Posts: 669
Joined: Mon Aug 24, 2020 1:16 pm

Re: Column Formulas

Post by anmac1789 »

NotNull wrote: Thu Nov 16, 2023 5:58 pm These are Column Formulas (hence the topic title ;) ) and are used to build what is shown in custom columns.
so I should use them in column1:= ... ???
NotNull
Posts: 5461
Joined: Wed May 24, 2017 9:22 pm

Re: Column Formulas

Post by NotNull »

Yes.
void
Developer
Posts: 16745
Joined: Fri Oct 16, 2009 11:31 pm

Re: Search Formulas

Post by void »

I've renamed "Column Formulas" to "Formulas".

Everything will now use Formulas when no search function is specified and $property-name: is used.

The file or folder matches if the formula evaluates to true.

Examples:

$date-modified:==$date-created: (date-modified is equal to date-created)
UPPER($name:)>="N" UPPER($name:)<="S" (Name starts with N to S)
$name:[1]=='o' (Second letter of name is o)
len($stem:)%3==0 (Stem length is a multiple of 3)
*.lnk !exists($shortcut-target:) (find lnk files where the shortcut target doesn't exist)
DerekZiemba
Posts: 42
Joined: Thu Sep 27, 2018 4:46 pm

Re: Search Formulas

Post by DerekZiemba »

void wrote: Thu Nov 16, 2023 9:24 pm *.lnk !exists($shortcut-target:) (find lnk files where the shortcut target doesn't exist)
This is super cool. But it doesn't seem to work?
Attempted to find all the broken links I may have, but everything it found works.
BrokenLinksDontWork.gif
BrokenLinksDontWork.gif (1.72 MiB) Viewed 38979 times
EDIT: Just realized those were stupid examples with targets:
com.snapchat.android
This PC
{6D809377-6AF0-444B-8957-A3773F02200E}\Registry Finder\RegistryFinder.exe

But I can assure you there are a few with actual targets to FS paths that do work. Most of them don't though.
Two targets that it says don't exist, but do and the shortcuts work are (I thought maybe they were symlinks or something, but they aren't):
C:\Users\Derek\AppData\Local\Postman\Postman.exe
C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x64\oleview.exe
Attachments
MostAreBrokeButSomeArent.gif
MostAreBrokeButSomeArent.gif (1.27 MiB) Viewed 38966 times
void
Developer
Posts: 16745
Joined: Fri Oct 16, 2009 11:31 pm

Re: Formulas

Post by void »

exists() checks the filename from your index (not from disk)

Please check the value from the shortcut target column (right click the result list column header and click Add columns)
Please make sure it matches the filename in your index.

Environment variables in shortcut targets are expanded.

For example:
%windir%
%appdata%



There are some limitations.

::{GUID} shell parse paths are not expanded.



Opening a shortcut can sometimes fix the shortcut target as Windows tracks the file by ObjectID.



Does Everything find postman.exe if you search for:
"C:\Users\Derek\AppData\Local\Postman\Postman.exe"
NotNull
Posts: 5461
Joined: Wed May 24, 2017 9:22 pm

Re: Formulas

Post by NotNull »

void wrote: Sat Nov 18, 2023 6:56 am Opening a shortcut can sometimes fix the shortcut target as Windows tracks the file by ObjectID.
That is called Link Tracking and is a NTFS feature (that Windows can use).
The "sometimes" part comes from Windows as it uses link tracking for -- IIRC -- shellfolders only, like desktop or startmenu.

(This same mechanism is being used for embedded documnents, like a spreadsheet graph in a powerpoint presentation; move the spreadsheet and the presentation knows about the new location))
void
Developer
Posts: 16745
Joined: Fri Oct 16, 2009 11:31 pm

Re: Formulas

Post by void »

Everything 1.5.0.1366a will now only assign custom columns when they are visible, you perform a search on a custom column or sort by a custom column.

Previously, Everything would assign custom column values on search.
bit
Posts: 38
Joined: Fri Feb 17, 2023 8:57 am

Re: Formulas

Post by bit »

void wrote: Tue Jan 09, 2024 4:36 am Everything 1.5.0.1366a will now only assign custom columns when they are visible, you perform a search on a custom column or sort by a custom column.

Previously, Everything would assign custom column values on search.
This change invalids many of my old bookmarks, such as
regex:"(item|id)(\d+)" addcolumns:col1;col2; column1:=regmatch1: column2:=regmatch2:
Now show empty col1 and col2 for dirs;
Need to append " col1: col2: " to make them calulated.

What's the motivation for such change?
Is it possible to provide an option to turn this feature off?
void
Developer
Posts: 16745
Joined: Fri Oct 16, 2009 11:31 pm

Re: Formulas

Post by void »

Thank you for the issue report bit,


Now show empty col1 and col2 for dirs;
This is a bug.
The values should be shown for folders.
I am working on a fix.


What's the motivation for such change?
You'll see results immediately.
Instead of having to wait for Everything to assign the values for results offscreen.


Is it possible to provide an option to turn this feature off?
Instead of using column1 and column2, please try:
regex:"(item|id)(\d+)" addcolumns:regmatch1;regmatch2
bit
Posts: 38
Joined: Fri Feb 17, 2023 8:57 am

Re: Formulas

Post by bit »

void wrote: Wed Jan 10, 2024 11:30 am
Now show empty col1 and col2 for dirs;
This is a bug.
The values should be shown for folders.
I am working on a fix.
Good to know it's not intented for dirs.

And about the conditions for calculation of cols:
only assign custom columns when they are visible, you perform a search on a custom column or sort by a custom column
should I undertand above as
1) only assign custom columns when ( "they are visible" AND ("you perform a search on a custom column or sort by a custom column"))
or
2) only assign custom columns when ( "they are visible" OR "you perform a search on a custom column" OR "sort by a custom column")
Finally, I wonder if

Code: Select all

dupe:co1 
will be seen as "search on a custom column", or not?
void
Developer
Posts: 16745
Joined: Fri Oct 16, 2009 11:31 pm

Re: Formulas

Post by void »

Everything-1.5.0.1366a-mod1 fixes an issue with assigning custom columns for folders.

The custom column value should be shown correctly in this version.

Everything-1.5.0.1366a.x64-Setup-mod1.exe
Everything-1.5.0.1366a.x86-Setup-mod1.exe
Everything-1.5.0.1366a.x64-mod1.zip
Everything-1.5.0.1366a.x86-mod1.zip

Everything should behave exactly the same as before.
Please let me know if the issue persist with this version.


only assign custom columns when they are visible, you perform a search on a custom column or sort by a custom column
should I undertand above as
2) only assign custom columns when ( "they are visible" OR "you perform a search on a custom column" OR "sort by a custom column")

Basically, the first time the custom column value is referenced it is assigned.


Finally, I wonder if

dupe:co1

will be seen as "search on a custom column", or not?
Yes, dupe: will sort your results by column 1.
Your column1 values will be assigned during this sort.
void
Developer
Posts: 16745
Joined: Fri Oct 16, 2009 11:31 pm

Re: Formulas

Post by void »

Everything 1.5.0.1367a fixes an issue with calculating formulas on folders.

Also fixed an issue with multiple assignment, for example:
addcol:a a:=2 a:=1
will set a to 1 (previously was kept as 2)



Also fixed a crash when referencing $property-name: without access privileges.



Added the following Excel functions:

ACOS
ACOSH
ASIN
ASINH
ATAN
ATAN2
ATANH
CEILING
COS
COSH
DEGREES
EVEN
EXP
FLOOR
LOG
LOG10
MOD
PI
PRODUCT
RADIANS
ROMAN
ROUND
ROUNDDOWN
ROUNDUP
SIGN
SIN
SINH
SQRT
T
TAN
TANH
TRUNC
ISERROR
dougbenham
Posts: 24
Joined: Wed Mar 15, 2023 8:19 pm

Re: Formulas

Post by dougbenham »

Can formulas be assigned to a custom column and then have that custom column be indexed?
void
Developer
Posts: 16745
Joined: Fri Oct 16, 2009 11:31 pm

Re: Formulas

Post by void »

No.

Custom columns are designed to format properties.
The properties should be indexed.
meteorquake
Posts: 501
Joined: Thu Dec 15, 2016 9:44 pm

Re: Formulas

Post by meteorquake »

Interesting - I would think the trig functions could be used on GPS properties or for files with coords in the actual name.
If not already there, it might be useful to have a "distance from function" (lat, long) so you could find photos near to a certain location based on the embedded GPS data.
Perhaps a function to catch the coords in a string based on some prefix, e.g. GetLng('Geo ', (filename or string formula) ) would catch the longitude from ...Geo 123.456,123.456 ... -- when I save interesting photos from iNaturalist I put the geographic coords in the filename. GetLng('', string) could look at the start of the string. Similarly a GetLat().
Actually I think GetLat GetLng could be done with a generalised function which I make as a separate post.
d
meteorquake
Posts: 501
Joined: Thu Dec 15, 2016 9:44 pm

Re: Formulas

Post by meteorquake »

OK so this would be my idea if it's not already there, a general substring extractor based on string markers.

If I look at my filenames they often contain markers with information. For example this is a file saved from iNaturalist -

Limodorum abortivum - OBS 55734247 - USR frank375 - NME Frank Walther - DTE 2016-03-29 - ATT allreserved - GEO 36.534603,30.556682,100m Phaselis RG 2

I generate the names by pasting some JS into the command window and it gathers up all the info into a single string which I then use when saving the file.

What would be needed would be a substring extractor that looks for case sensitive markers, thus for example -
SubstrByMark( string , 'GEO ', ',', ',' )
would find the marker GEO then move 4 characters (the len of 'GEO ') then find the marker ',' then move 1 character (the len of ',') then find the marker ',' and because that's the last parameter it would take all the characters between that point and the prior marker-plus-length i.e. it would return 30.556682 (the longitude).
SubstrByMark( string , 'GEO ', ',', ',', ' ' ) (with an extra space param) would return 100m (the geo accuracy)
Something like SubstrByMark( string , ' - ' ) because it only has the final marker would return Limodorum abortivum
it could decode longer CSV stretches in file names just by finding any CSV start marker and then using the appropriate number of comma parameters to get to the column position.

d
NotNull
Posts: 5461
Joined: Wed May 24, 2017 9:22 pm

Re: Formulas

Post by NotNull »

meteorquake wrote: Sat Feb 17, 2024 9:42 am a general substring extractor
meteorquake wrote: Sat Feb 17, 2024 9:42 am What would be needed would be a substring extractor that looks for case sensitive markers, thus for example -
SubstrByMark( string , 'GEO ', ',', ',' )
would find the marker GEO then move 4 characters (the len of 'GEO ') then find the marker ',' then move 1 character (the len of ',') then find the marker ',' and because that's the last parameter it would take all the characters between that point and the prior marker-plus-length i.e. it would return 30.556682 (the longitude).
:shock: It doesn't get much more specific than that ;)


Formulas are building blocks. Use them in the right combination and order to get the information you are looking for.
For example, to find the longitude:

Code: Select all

addcolumn:B  B-label:=Long  column1:=SUBSTR($name:,EVAL(LEN("- GEO ")+FIND("- GEO ",$name:)),255)    B:=ELEMENT(column1:,",",2)

BTW:
A regular expression might be easier in these cases; when (part of) the filename can be described as a pattern -- the structure of these filenames definitely follow a strict pattern -- a regular expression most likely will be able to describe them and extract the needed information.

Another option could possibly be to use the file properties of these files).




@void:
the ELEMENT() formula behaves unexpected with multiple separator chars. See the following:

Code: Select all

count:1   addcolumn:column1,A   column1:="some,text,with,a space character.extension"   A:=ELEMENT(column1:," ,",4)
Should extract the fourth field, separated by either a comma or a space. It does not.
Furthermore: the order of the separator chars makes a difference:
ELEMENT(column1:," ,",4) and ELEMENT(column1:,", ",4) yield different results.
( ELEMENTCOUNT() differs too in these cases)


Also: A suggestion to change the behaviour of SUBSTR(text,start,length) and SUBSTRING(...) to:
SUBSTR(text,start[,length])

So SUBSTR("123456789",2) will extract text from position 2 to the end of the text, without the need to use an extra LEN() or specifying a very large number.

Or is SUBSTR() an alias for MID()? In that case, please ignore ...
void
Developer
Posts: 16745
Joined: Fri Oct 16, 2009 11:31 pm

Re: Formulas

Post by void »

The documentation does say [delimiter-characters]

However, I have only implemented support for a single delimiter (this first one specified)

I'll add support for multiple delimiters.


Also: A suggestion to change the behaviour of SUBSTR(text,start,length) and SUBSTRING(...) to:
SUBSTR(text,start[,length])
Everything tries to implement SQL SUBSTR:
https://www.w3schools.com/sql/func_mysql_substr.asp

I'm currently ignoring this:
length Optional. The number of characters to extract. If omitted, the whole string will be returned (from the start position)
I'll add support for optional length.

Thank you for the suggestions.
void
Developer
Posts: 16745
Joined: Fri Oct 16, 2009 11:31 pm

Re: Formulas

Post by void »

Everything 1.5.0.1368a improves formulas.



Everything 1368a fixes an issue with precedence for some operations.
Previous versions was using the wrong precedence for / * and %
10000/60/60 will now evaluate to 2 (instead of 10000)



The length in SUBSTR and SUBSTRING is now optional.
The remaining length is used if not specified.



ELEMENT() will now support multiple delimiters.



Added DATE(), TIME() and TIMEVALUE()
I explored using Excels day = 1.0 date/time serial numbers.
However, Everything will use FILETIMEs as the date/time serial number since Everything primarily works with FILETIMEs.
I will note this as a formula Excel quirk.
Everything uses day = 864000000000 as the date/time serial number.



Added N()
Post Reply