mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jan 2012
Posts: 370
Epic Offline OP
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
Joined: Jan 2012
Posts: 370

I propose to add a new switch -p for the command /write, which should help to automatically create a directory from the specified path to the file, before a new line of text is written to it. If the directory already exists, then a normal write is performed as if this switch had not been specified.

At the moment, if the directory is missing it returns the error "* /write: unable to open file", after which it is necessary to create the directory manually or with the command /mkdir, which is not always convenient and understandable for a beginner. My idea should help simplify this problem, so that you can simply add a switch to the command /write -p.


Syntax: /write [-p] <filename> [text]

Example: /write -p newdir\folder\file.txt New line text 1


🌐 https://forum.epicnet.ru 📜 irc.epicnet.ru 6667 #Code | mIRC scripts, help, discuss, examples
Joined: Jan 2012
Posts: 370
Epic Offline OP
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
Joined: Jan 2012
Posts: 370

My own temporary solution to implement this idea:
Code
alias write {
  if (-*p* iswmcs $1 && $nofile($2) && !$exists($nofile($2))) { mkdir $nofile($2) } | write $1-
}


🌐 https://forum.epicnet.ru 📜 irc.epicnet.ru 6667 #Code | mIRC scripts, help, discuss, examples

Link Copied to Clipboard