Skip to content
mIRC tutorials

Mirc Accurate File Location

A TG007 community discussion started by Travis.

Discussion 15 posts
Page 1 of 1
Open
Topic #10559 · 15 published posts · 8,873 views

When mIRC changed to version 6.31 or 6.32 Khaled decided to support Windows Vista by making your default mirc directory in your Users\Application Data\Roaming folder ... Why? I haven't asked but I don't see any good reason for it.

 

Anyways, this can be a major pain in the butt when allowing others to use your scripts. I have seen other ideas in the past to deal with this but always ignored them until I had to deal with it. Now that I have to deal with it this is what I made.

 

alias dir { return $qt($+($nofile($mircexe),$1)) }

Ex: /run $dir(songs\file.mp3)

Using quotes ($qt) is up to you. I do that because some people like to runt heir mirc fromt he desktop.

 

I know other people had other ways of doing this ... Warrior ... Please add your solutions to this thread!

Edited Jul 26, 2008 5:23 PM by Travis

Thanks for the snippet, Travis. I've found it quite frustrating myself but never bothered to work around it.

 

Cheers.

You can use this code instead of $findfile to help you find files more easily, and faster...

 

alias ff {
  if (!%ff. [ $+ [ $1- ] ]) || (!$exists(%ff. [ $+ [ $1- ] ])) set %ff. [ $+ [ $1- ] ] $qt($longfn($findfile($nofile($mircexe),$1-,1)))
  return %ff. [ $+ [ $1- ] ]
}

 

To use type in something like...

 

echo -a $ff(mdx.dll)

[/code]

 

It will find mdx.dll, and echo its location.

 

Great work, Travis. :)

Edited Jul 29, 2008 6:58 AM by Warrior124

Thanks Warrior & likewise.

 

Well I was getting pretty pissed about how mIRC now handles it's settings files and found some answers that should help.

 

All of this code presented is unneeded.

 

$mircdir refers to where the mirc.ini file is. New mirc's default location is in your Application Data folder group. So if the mirc.ini for the mirc.exe you are using is in that folder group you will get that for your path.

 

But! If mirc.ini is in your script folder then mIRC will act like it always has.

 

Bottom line. As long as mirc.ini is in your script folder you dont have to worry about this "accurate file location" deal.

 

If mirc.ini isn't in your script folder and you would like it to be, follow the path to find the file and copy and paste it to the desired directory.

 

To find the file location use this. //echo -a $mircdir. This will point you there.

 

 

Great! I'm glad I read this thread. Thanks.

 

Bexy

Bex

basically, when you release scripts (if you don't want to include mIRC exe), release it all with the mIRC ini in the location mIRC would be.

Here is another code you can use...

 

on *:INPUT:*: {
  $eval($replace($1-,$chr(36) $+ mircdir,$nofile($mircexe)),2)
  haltdef
}

 

With this code you can still use $findfile($mircdir,mdx.dll,1) to reveal where mdx.dll in the correct mirc folder.

Edited Jul 30, 2008 12:24 AM by Warrior124

It's not a change to support vista, it's a change to become an application that's compliant with Windows. If you run mIRC from a non administrator account then you may find that it doesn't have permission to write to the Program Files folder, however it IS allowed to write to the Application Data folder or Roaming folder.

 

The only thing that has changed is the location of the directory, you can still use $mircdir as long as everything has been installed correctly. You don't need to use the location of the exe.

20.For Vista compatibility, new installations of mIRC now save all

settings in the User's "Application Data\mIRC" folder by default.

 

However, if the installer or mIRC find mirc.ini in the same folder

as mirc.exe they will use the mirc.exe folder for all settings.

Users installing over an old version of mIRC should therefore see

no change in behaviour.

 

The installer is now also aware of administrator and standard user

accounts and installs mIRC accordingly.

Perhaps vista is stricter then, but this is also the way things should've been done on XP and earlier OS's as well.

basically, when you release scripts (if you don't want to include mIRC exe), release it all with the mIRC ini in the location mIRC would be.

 

Or people could just use $scriptdir in most cases so that the whole issue is made irrelevant.

The alias dir { return $qt($+($nofile($mircexe),$1)) } code doesn't return the AppData folder; it returns c:\program files for those that didn't know.

 

$mircdir is where the scripts are stored :)

Edited Nov 2, 2008 1:03 PM by takaharu_

I don't get paid to know the answer, therefore I'm far more likely to give you a straight and honest answer.

It should return the path for the active mirc.exe.

as exo said $scriptdir works fine

i have mirc installed as normal and installed as standalone and it works in both

My code does NOT have bugs. It just develops random features.

Ok so? Nothing is wrong. Use $mircexe, use $scriptdir, make sure mirc.ini is in your mirc folder and use neither!

 

Using $scriptdir doesn't make it irrelevant. It's just another way of handling the issue of file paths in versions 6.2+. I like to use $mircexe if I have to because that is ONE SOLID LOCATION. $scriptdir refers to the path of the currently executing script. I don't know about you but I have scripts in the main folder and some in subdirectories. I wanted a path that pointed to the ROOT folder always. This is why I chose $mircexe.

 

In all actuality I personally just make sure mirc.ini is in my main folder and I have no issues. The code was to help others out.