Posts Tagged ‘Command Line Utility’


ENScript – Scripting Evernote in Windows


This post has now been migrated to

Follow this link to go directly to the article.


Command Line Utility to Create Test Files

Using the utility on the command line

Using the utility on the command line

In the past I’ve used FSUTIL to create large test files of data to process.  Unfortunately you need administrator permissions to use this utility.  I decided to write a command line utility (called “Make Test File” but abbreviated to MTF.EXE) to allow non-administrators to do the same.  It’s written in VB.NET so it isn’t as quick as FSUTIL, but as they say “it does the job”, and it fulfilled my immediate needs.

It takes two parameters – the size of the file (in bytes) and the file path to write the file to.  To see an example of how to use it and the output click on the thumbnail image on the right.  The resulting file just contains zeros.

If there’s any demand I may look into additional features such as being able to specify what the file is filled with or creation of multiple files using some sort of incremental naming convention.


Grab Web Page into NoteTab Text Editor


NoteTab is a favoured text editor of mine and for a number of years I’ve used it for working with web pages and coding up HTML, PHP, Javascript and the like.  One of the best features of NoteTab (beyond the light version being free to download) is its powerful scripting language – creating what is known as NoteTab Clips.

Grab Web Page clip inputs

Grab Web Page clip inputs

One of my favourite clips is one that provides a basic integration with a command line utility to download a web page without having to go into your web browser and view it.

So if you don’t already have them download the following free pieces of software:

  • NoteTab Light – text editor with scripting capabilities.
  • wGet – command line utility for downloading files from the Internet.

The two clips below should be copied and pasted into an appropriate clip library in NoteTab (see the NoteTab help file on how to do this – it’s very straight forward).  Run the “Grab Web Page” clip and after specifying what URL to download, where to download it to, how to display it (open the downloaded file, copy the file content into a new file or insert the file content at the current cursor position) and what log file to log the activity to.

H="Grab Web Page"
;Initialise variables
^!Set %FETCH_URL%=^?[URL of web page to retrieve=]
^!Set %OUTPUT_PATH%=^?[(T=D)Directory to download file to=c:wGet Output]
^!Set %INSERTION_TYPE%=^?[(T=C)Downloaded file==_Open|Copy into new file|Insert at cursor]
^!Set %LOG_PATH%=^?[(T=S;F="Log Files (*.log)|*.log")File to log download progress to=c:wGet Outputoutput.log]
^!Set %WGET_PATH%=^?[Path to wGet.exe=C:Program FilesCommand line Utilitieswget.exe]

;Remove trailing backslash if it exists - wGet doesn't like these
^!If "^$StrCopyRight("^%OUTPUT_PATH%";1)$"="" NEXT Else SKIP
^!Set %OUTPUT_PATH%=^$StrDeleteRight("^%OUTPUT_PATH%";1)$

;Create the output directory
;(If it exists it won't do any harm)

;Fetch page
^!Set %FETCH_OUTPUT%=^$GetOutput("^%WGET_PATH%" -P"^%OUTPUT_PATH%" -nv -o"^%LOG_PATH%" "^%FETCH_URL%")$

;Get the name the retrieved file was named as
^!Set %OUTPUT_FILE_PATH%=^$GetFileText(^%LOG_PATH%)$
^!Set %OUTPUT_FILE_PATH%=^$StrDeleteLeft("^%OUTPUT_FILE_PATH%";^$Calc(^$StrPos("-> ";"^%OUTPUT_FILE_PATH%";TRUE)$+3)$)$
^!Set %OUTPUT_FILE_PATH%=^$StrCopyLeft("^%OUTPUT_FILE_PATH%";^$Calc(^$StrPos(""";"^%OUTPUT_FILE_PATH%";TRUE)$-1)$)$
^!Set %OUTPUT_FILE_PATH%=^$StrReplace("/";"";"^%OUTPUT_FILE_PATH%";TRUE;TRUE)$

;Output the contents of the downloaded file
^!If "^%INSERTION_TYPE%"="Copy into new file" NEXT Else SKIP
^!Clip "New From Text" ^$GetFileText(^%OUTPUT_FILE_PATH%)$
^!If "^%INSERTION_TYPE%"="Insert at cursor" NEXT Else SKIP
^!InsertFile ^%OUTPUT_FILE_PATH%

H="_New From Text"
^!Menu File/New
^!InsertCode ^&