mIRC Home    About    Download    Register    News    Help

Print Thread
#228039 04/12/10 03:15 AM
Joined: Aug 2010
Posts: 4
S
Self-satisified door
OP Offline
Self-satisified door
S
Joined: Aug 2010
Posts: 4
if $exists($scriptdiredit.key) {
DO this
}

The above doesnt work, despite the fact the file edit.key is located in the script directory, even tho its an empty file.

Suggestions?

Spartanis #228041 04/12/10 03:41 AM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
$exists() works in a clean install of mIRC, so it's one of the following:

* The file isn't where the script is looking. To test this, above that IF section, put:

run $scriptdir

That will open the folder that the script is looking in. Verify that the edit.key file is there.

* You have another script that is conflicting or part of the same script is conflicting. You'll have to test each part of the script to find where the conflict is located.

* You are using a hacked copy of mIRC that has bugs that prevent $exists from working properly. If that's the case, install mIRC from this site and try again.

* You have a comma in the path. I haven't tested this, but typically, a comma is used to separate items in an identifier and if you have it as part of the path, it may cause a problem.


Invision Support
#Invision on irc.irchighway.net
Spartanis #228042 04/12/10 03:46 AM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Another option is that you have one or more spaces in the $scriptdir path.
Using $exists($qt($scriptdiredit.key)) will resolve the issue.

I like to use the $qt in my scripts that have to access the files in any directory as it returns properly whether there are spaces in the path or not.

RusselB #228044 04/12/10 03:55 AM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Try using $isfile() instead of $exists() and see if you have the same problem.

Originally Posted By: Riamus2
$exists() works in a clean install of mIRC, so it's one of the following:

* The file isn't where the script is looking. To test this, above that IF section, put:

run $scriptdir

That will open the folder that the script is looking in. Verify that the edit.key file is there.

* You have another script that is conflicting or part of the same script is conflicting. You'll have to test each part of the script to find where the conflict is located.

* You are using a hacked copy of mIRC that has bugs that prevent $exists from working properly. If that's the case, install mIRC from this site and try again.

* You have a comma in the path. I haven't tested this, but typically, a comma is used to separate items in an identifier and if you have it as part of the path, it may cause a problem.


Your comment about the comma would only be an issue if you used evaluation brackets ([ ]) to evaluate the contents.

Having a hacked version of mIRC is very unlikely.

Originally Posted By: RusselB
Another option is that you have one or more spaces in the $scriptdir path.
Using $exists($qt($scriptdiredit.key)) will resolve the issue.

I like to use the $qt in my scripts that have to access the files in any directory as it returns properly whether there are spaces in the path or not.


You don't need to use quotes for paths with identifiers, only commands. There's no ambiguity as to where the path begins and ends with an identifier as the arguments are comma delimited, not space delimited like commands are.

hixxy #228055 04/12/10 03:04 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Originally Posted By: hixxy
Your comment about the comma would only be an issue if you used evaluation brackets ([ ]) to evaluate the contents.

Having a hacked version of mIRC is very unlikely.


Yeah, like I said, I didn't test it to see if it might cause a problem. And it being a hacked version is usually not the case, but worth mentioning before spending a long time trying to track down the problem only to find out that's the reason. smile


Invision Support
#Invision on irc.irchighway.net
Spartanis #243006 03/10/13 11:56 AM
Joined: Oct 2013
Posts: 1
R
Mostly harmless
Offline
Mostly harmless
R
Joined: Oct 2013
Posts: 1
I realize that this subject is now very old, however I have noticed no good answer. Answer should be that you have formatted your file name incorrectly.

should be:

if $exists($+($scriptdir,edit.key)) {
DO this
}

Revol #243007 03/10/13 12:34 PM
Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
That's not correct. You can use $scriptdiredit.key without issue.

Revol #243014 04/10/13 07:46 PM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
There are a number of identifiers where you can add text directly onto the end.

Code:
alias test {
  echo -a $scriptdirtest.txt
  echo -a $mircdirtest.txt
  echo -a $logdirtest.txt
  tokenize 32 hello world
  echo -a $1world
  echo -a $2hello
}


This is not an exhaustive list.


Link Copied to Clipboard