Question:
What's the difference between starting mirc.exe with a switch and having vanilla mIRC started and then typing in one-time:
/load -rs <path\to\scriptnamethatsetsupmyenvironment.mrc>
?
Feedback/thoughts:
If someone wants to distribute their script, they should invest some time into understanding how to do so, rather than dumping everything, including mirc.exe online...
I think - generally - there's a couple of ways how you can go about distributing your script. You can choose to include or don't include mirc.ini. And have it use standard mIRC app datadir or another datadir. From easiest to easy to learning-another-skill:
* Distribute your entire %appdata%\mIRC folder. mirc.ini is a part of it, as it contains all the references to aliases and scriptfiles that are contained therein. Tell the end-user to copy that mIRC folder back to %appdata% and just click on the mIRC shortcut on the desktop that mIRC placed there when it was installed. Least amount of hassle, but note the disadvantages down below.
or
* Only distribute your script folder and files. Don't include mirc.ini. Include setup instructions, such as what to do after you've copied/unpacked your folders and files to the right location. This would be my recommended advice. Your script will need to handle the setup&configuration process. [^1]
or
* Create a .msi or install.exe that: 1. checks for the existence of mIRC and if found 2. copies files and folders to the right destination and 3. create a shortcut on the desktop. [^2]. It may or may not include mirc.ini.
===
On including mirc.ini
Advantages: 1. No setup time wasted as all alias, script, popups, user and variable files are defined in mirc.ini. 2. Complete control over INI section [options] in mirc.ini. (even the options that you can't - easily - write to. 3. End-user doesn't need to follow any setup instructions, it's ready to go! 4. Less work?
Disadvantages: 1. Scrubbing sensitive information from mirc.ini and or other files. (usernames + passwords) 2. No control over the setup process.
On not including mirc.ini
Advantages: 1. Little risk exposing sensitive information as your script is built from the ground up to check and load all alias, script, user, popups and variable file(s). 2. More control over installation. (PnP has an installation wizard!)
Disadvantages: 1. mirc.ini is difficult to write to especially if you want to change certain [option] values that don't have inbuild commands/identifiers that control them. [^3] 2. More work?
===
[1]: PnP only distributes the script files and folders and requires the user to type in
/load -rs script\first.mrc
to set everything up. (Once)
https://github.com/peace-and-protection/Peace-and-Protection/wiki/Installation[2]: Deploying mIRC with custimzations (*.msi) -
https://forums.mirc.com/ubbthreads.php/topics/266287/deploying-mirc-with-custimzations-msi[3]: You CAN write to mirc.ini if you really want to. The following idea was lifted from PnP which roughly does: 1. mirc + load script\first.mrc 2. loads and finish setting up environment 3. restarts but uses script\dofirst.ini 4. writes to mirc.ini 5. restarts but now uses mirc.ini.
Change mirc.ini by proxy (dummy.ini):
https://gist.github.com/acvxqs/7b64de1c51d6f97fbc60017c76017ff5Demo; proof of concept.
on *:LOAD:{
%firsttime = 1
}
on *:START:{
var %ft $iif(%firsttime,1,0)
if (%ft) {
unsetall
if (!$isdir($+($mircdir,uvp))) mkdir $qt($+($mircdir,uvp))
if ($script($+($mircdir,scripts\remote.ini))) .unload -rs $qt($v1)
; basic file structure
write -c urls.ini
write -c perform.ini
write -c control.ini
write -c addrbk.ini
var %dummy $qt($+($mircdir,uvp\,dummy.ini))
var %users $qt($+($mircdir,uvp\,u.ini))
var %vars $qt($+($mircdir,uvp\,v.ini))
var %popups $qt($+($mircdir,uvp\,p.ini))
; create file dummy.ini
write -c %dummy
; create info section
writeini %dummy dinfo mircexe $mircexe
writeini %dummy dinfo mircini $mircini
; create script section in dummy.ini
writeini %dummy script n0 ; AUTO-GENERATED %dummy
writeini %dummy script n1 on *:START: $+ $({)
writeini %dummy script n2 var % $+ mircexe $!qt($readini($script,n,dinfo,mircexe))
writeini %dummy script n3 var % $+ mircini $!qt($readini($script,n,dinfo,mircini))
writeini %dummy script n4 if ($isfile(%mircini)) $({)
writeini %dummy script n5 while ($isfile(%mircini)) .remove % $+ mircini
writeini %dummy script n6 writeini % $+ mircini pfiles n0 %popups
writeini %dummy script n7 writeini % $+ mircini pfiles n1 %popups
writeini %dummy script n8 writeini % $+ mircini pfiles n2 %popups
writeini %dummy script n9 writeini % $+ mircini pfiles n3 %popups
writeini %dummy script n10 writeini % $+ mircini pfiles n4 %popups
writeini %dummy script n11 writeini % $+ mircini rfiles n0 %users
writeini %dummy script n12 writeini % $+ mircini rfiles n1 %vars
writeini %dummy script n13 writeini % $+ mircini rfiles n2 $qt($script)
writeini %dummy script n14 writeini % $+ mircini about show no
writeini %dummy script n15 writeini % $+ mircini installed ctime $!ctime
writeini %dummy script n16 writeini % $+ mircini warn cmd off
writeini %dummy script n17 flushini % $+ mircini
writeini %dummy script n18 saveini
writeini %dummy script n19 run % $+ mircexe $!+(-r,$qt($nofile(% $+ mircini)))
writeini %dummy script n20 exit -n
writeini %dummy script n21 $(})
writeini %dummy script n22 $(})
; create pfiles section and write popups.ini
write -c $qt(%popups)
writeini $qt(%popups) bpopup n0 SCRIPT
writeini %dummy pfiles n0 %popups
writeini %dummy pfiles n1 %popups
writeini %dummy pfiles n2 %popups
writeini %dummy pfiles n3 %popups
writeini %dummy pfiles n4 %popups
; create rfiles section and write users.ini and vars.ini
write -c %users
write -c %vars
writeini %dummy rfiles n0 %users
writeini %dummy rfiles n1 %vars
writeini %dummy rfiles n2 %dummy
writeini %dummy about show no
flushini %dummy
flushini %users
flushini %popups
flushini %vars
saveini
run " $+ $mircexe $+ " $+(-i,%dummy)
exit -n
}
elseif ($readini($mircini,n,installed,ctime) == $null) {
set %firsttime 1
exit -nr
}
}
On how to use the above:
1. Have mIRC installed in the standard way. ("C:\Program Files (x86)\mIRC\mIRC.exe")
2. Create directory %appdata%\testmirc
3. Create startup shortcut on desktop: "C:\Program Files (x86)\mIRC\mIRC.exe" -r"%appdata%\testmirc"
4. Start the shortcut in 3.
5. Save the above code as %appdata%\testmirc\scripts\first.mrc
6. Type: /load -rs scripts\first.mrc
Remarks:
Flow: Runs first.mrc file that creates dummy.ini and then restarts using dummy.ini. Dummy.ini has a [script] item that runs code to write changes to mirc.ini and then restarts using mirc.ini.
1. You can for instance change [options] this way, or inject another color and pallette config that mIRC uses under item [text] -> key
theme