|
Joined: Jul 2003
Posts: 1
Mostly harmless
|
OP
Mostly harmless
Joined: Jul 2003
Posts: 1 |
I think it would be quite useful to have a $run identifier, which would return $true/$false depending on if mirc can /run a file or url. For example: if ($run(notepad)) { run notepad } Rather than using $isfile or $exists (which wouldn't work on 'notepad' anyway) - this identifier would only see if $1 could be /run I hope my point is being made and maybe someone will agree with me Thanks for the word, antisocial
|
|
|
|
Joined: Dec 2002
Posts: 2,809
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,809 |
Well how does mIRC determine if it can be run?
|
|
|
|
Joined: May 2003
Posts: 2,265
Hoopy frood
|
Hoopy frood
Joined: May 2003
Posts: 2,265 |
if a file is locked for example. it cannot be run, mirc could then say blah is locked and cannot be run.
new username: tidy_trax
|
|
|
|
Joined: Dec 2002
Posts: 2,985
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,985 |
Quite right but that isn't the issue. mIRC can't know of the opposite being true until the application is running so you can't get a result until the programme starts.
Look at it in this light: You pick up the phone and ring me - you don't know I am going to answer the call until I actually pick up the handset.
|
|
|
|
Joined: May 2003
Posts: 2,265
Hoopy frood
|
Hoopy frood
Joined: May 2003
Posts: 2,265 |
maybe give it a timer then. say like, if its not open in 5 seconds, return $false
new username: tidy_trax
|
|
|
|
Joined: Dec 2002
Posts: 2,962
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,962 |
But then that means $run has to actually run the command to see if it works, which is almost cetainly not what the user wanted.
Spelling mistakes, grammatical errors, and stupid comments are intentional.
|
|
|
|
Joined: May 2003
Posts: 2,265
Hoopy frood
|
Hoopy frood
Joined: May 2003
Posts: 2,265 |
try to access the file, if it starts to load, then cancel the opening of it and return $true
new username: tidy_trax
|
|
|
|
Joined: Dec 2002
Posts: 2,985
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,985 |
What would this function actually be useful for? What did you want to do with it?
|
|
|
|
Joined: Dec 2002
Posts: 2,809
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,809 |
Thats not even what I meant, what happens if I specify a file that isn't executable?
$run(README) for example
How is mIRC to know that that file can't be run?
|
|
|
|
Joined: May 2003
Posts: 2,265
Hoopy frood
|
Hoopy frood
Joined: May 2003
Posts: 2,265 |
new username: tidy_trax
|
|
|
|
Joined: Dec 2002
Posts: 2,809
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,809 |
It will open, it's a file, any file can be opened. If it couldn't be opened, then there would be no way to view a README in notepad for example. There is no IsFileExecutable() function in Windows.
|
|
|
|
Joined: May 2003
Posts: 2,265
Hoopy frood
|
Hoopy frood
Joined: May 2003
Posts: 2,265 |
new username: tidy_trax
|
|
|
|
Joined: Dec 2002
Posts: 2,809
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,809 |
Umm apparently you have no idea what a locked file is, it has nothing to do with a password. A locked file is when you get the "can not open, this file is in use by another application" error.
From Microsoft: "The LockFile function locks a region in an open file. Locking a region prevents other processes from accessing the region."
I don't see any mention of a password there, do you?
And that doesn't have anything to do with what I said:
codemastr: phoenix, why is the sky blue? phoenix: some cars are blue.
You didn't address anything I stated, you simply wrote some gibberish.
|
|
|
|
Joined: May 2003
Posts: 2,265
Hoopy frood
|
Hoopy frood
Joined: May 2003
Posts: 2,265 |
new username: tidy_trax
|
|
|
|
Joined: Apr 2003
Posts: 210
Fjord artisan
|
Fjord artisan
Joined: Apr 2003
Posts: 210 |
That isn't what the poster wanted though. I think he wanted an alternative to $isfile and $exists. He gave the example of 'notepad'. If notepad doesn't exist on the users system they will get an error message:
* /run: unable to open 'notepad'
I believe this suggestion is aimed at avoiding error messages like that.
Ofcourse there is no API way of doing this. However, with a little thought, It is possible that mIRC could check the registry and see if 'notepad' is registered, in the case of no filepath being specified. And then return $true or $false.
It's also possible that mIRC could perform the operation of $isfile internally and return $true or $false, when a filepath is specified.
There may also be a way to determine if a user has access to that file under NT, and return $true or $false.
-- A more general method of handling all mIRC error messages would be preferable to me though (ON MERROR).
|
|
|
|
Joined: Dec 2002
Posts: 2,809
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,809 |
Well if that doesn't make sense, yell at Microsoft, they are the ones who decided a "locked" file has nothing to do with a password. A file that needs a password to be opened (depending on some conditions) is either "password protected" or "encrypted" NOT locked. It's not my fault you don't understand FileSystem terminology.
|
|
|
|
Joined: May 2003
Posts: 2,265
Hoopy frood
|
Hoopy frood
Joined: May 2003
Posts: 2,265 |
new username: tidy_trax
|
|
|
|
Joined: Dec 2002
Posts: 2,809
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,809 |
*sigh* whatever, you're wrong, you just don't want to admit it.
|
|
|
|
Joined: May 2003
Posts: 2,265
Hoopy frood
|
Hoopy frood
Joined: May 2003
Posts: 2,265 |
new username: tidy_trax
|
|
|
|
Joined: Dec 2002
Posts: 2,809
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,809 |
But regardless, thats not what the original poster, or I were talking about. I said what happens if you want to determine if a file such as "README" is run-able? How can you determine if it is? The answer is, you really can't.
|
|
|
|
|