Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Interesting functions

Apr
1,794
15
As I mentioned Here, there are a lot of interesting, non-system specific aliases that power users have. Ane as this subforum is about functions - think it would be great to start a thread asking folks to post theirs - as text and not image please, to make it easier to copy off the forum....
 
Code:
@@alt-f4=^eexit
@@ctrl-f11=^e@c:\ %+ @cls %+ if plugin fortune fortune /q "%@path[%_cmdspec]\plugins\quotes.txt"
@@ctrl-f12=^e@option
@@f11=^e@cdd -
@@f12=^e@cls
@@f2=^e@echo Errorlevel: %?
addslash=%@if[isdir %1,%1\,%1]
checkaddr=%@regex["^[\w-]+(\.[\w-\+=]+)*@([a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*?\.[a-z]{2,6}|(\d{1,3}\.){3}\d{1,3})(:\d{4})?$",%1]
StrFormatByteSize=%@winapi[shlwapi.dll,StrFormatByteSize,%1,BUFFER,256]
timebias=%@eval[%@regquery[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation\ActiveTimeBias] / 60]
utcfileage=%@eval[%@fileage[%1] + (%@timebias[] * 36000000000)]
 
I have a set of calendar related functions that were posted in the alias thread as they used those aliases. There was also a function that used an alias to expand a set of args.

Here's some other functions.
Code:
:pad string with space (or other char)
:padX[string,length[,char]]
 padl=`%@if[%2 LE %@len[%1],%1,%@substr[%@repeat[%@if["%3"=="", ,%3],%@eval[%2-%@len[%1]]]%1,0,%2]]`
 padc=`%@if[%2 LE %@len[%1],%1,%@substr[%@repeat[%@if["%3"=="", ,%3],%@eval[(%2-%@len[%1])/2]]%1%@repeat[ ,%@eval[(%2-%@len[%1]/2)+1]],0,%2]]`
 padr=`%@if[%2 LE %@len[%1],%1,%@substr[%1%@repeat[%@if["%3"=="", ,%3],%@eval[%2-%@len[%1]]],0,%2]]`

:get a count of files matching a spec
 filecount=`%@word[" ",3,%@execstr[dir %1 /uk]]`
 
Back
Top