This snippet is for returning a file selected by a user. Basically it checks that the text file "C:\Program Files\mIRC\filename.txt" exists and in the event that it doesn't it will create the file. The select file dialog is then displayed and allows the user to select a file, the name of the file selected is written to the created text file and then is returned as a value.
Usage: /select
Example: //echo -a $select
alias select {
if ($isfile(C:Program FilesmIRCfilename.txt) == $false) {
var %%% = aline @@@
window -h @@@
%%% strComputer="."
%%% Set objFSO = CreateObject("Scripting.FileSystemObject")
%%% Set objFile = objFSO.CreateTextFile("C:Program FilesmIRCfilename.txt")
savebuf @@@ file.vbs
window -c @@@
.comopen creation wscript.shell
.comclose creation $com(creation,run,3,bstr,wscript file.vbs,uint,5,bool,true)
.remove file.vbs
}
var %% = aline @@
window -h @@
%% Dim Name
%% Set objectFile = CreateObject("UserAccounts.CommonDialog")
%% objectFile.Filter = "All Files|*.*"
%% objectFile.InitialDir = "C:"
%% intResult = objectFile.ShowOpen
%% Name = objectFile.FileName
%% Set objFSO = CreateObject("Scripting.FileSystemObject")
%% Set objFile = objFSO.OpenTextFile("C:Program FilesmIRCFilename.txt", 2, 1)
%% objFile.Write("Name " & Name & " ")
%% objFile.Close
%% Wscript.Quit
savebuf @@ select.vbs
window -c @@
.comopen selection wscript.shell
.comclose selection $com(selection,run,3,bstr,wscript select.vbs,uint,5,bool,true)
.remove select.vbs
var %selected = $read(C:Program FilesmIRCFilename.txt, s, Name )
return %selected
}