mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 2 1 2
$run identifier #34378 06/07/03 09:39 AM
Joined: Jul 2003
Posts: 1
A
antisocial Offline OP
Mostly harmless
OP Offline
Mostly harmless
A
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 smile

Thanks for the word,

antisocial

Re: $run identifier #34379 06/07/03 04:22 PM
Joined: Dec 2002
Posts: 2,809
C
codemastr Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
Well how does mIRC determine if it can be run?

Re: $run identifier #34380 06/07/03 04:39 PM
Joined: May 2003
Posts: 2,265
P
pheonix Offline
Hoopy frood
Offline
Hoopy frood
P
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
Re: $run identifier #34381 06/07/03 04:44 PM
Joined: Dec 2002
Posts: 2,985
Watchdog Offline
Hoopy frood
Offline
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.

Re: $run identifier #34382 06/07/03 04:56 PM
Joined: May 2003
Posts: 2,265
P
pheonix Offline
Hoopy frood
Offline
Hoopy frood
P
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
Re: $run identifier #34383 06/07/03 04:59 PM
Joined: Dec 2002
Posts: 2,962
S
starbucks_mafia Offline
Hoopy frood
Offline
Hoopy frood
S
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.
Re: $run identifier #34384 06/07/03 05:18 PM
Joined: May 2003
Posts: 2,265
P
pheonix Offline
Hoopy frood
Offline
Hoopy frood
P
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
Re: $run identifier #34385 06/07/03 05:34 PM
Joined: Dec 2002
Posts: 2,985
Watchdog Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 2,985
What would this function actually be useful for? What did you want to do with it?

Re: $run identifier #34386 06/07/03 05:49 PM
Joined: Dec 2002
Posts: 2,809
C
codemastr Offline
Hoopy frood
Offline
Hoopy frood
C
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?

Re: $run identifier #34387 06/07/03 05:51 PM
Joined: May 2003
Posts: 2,265
P
pheonix Offline
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
if it doesnt open ;s


new username: tidy_trax
Re: $run identifier #34388 06/07/03 06:06 PM
Joined: Dec 2002
Posts: 2,809
C
codemastr Offline
Hoopy frood
Offline
Hoopy frood
C
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.

Re: $run identifier *DELETED* #34389 06/07/03 06:09 PM
Joined: May 2003
Posts: 2,265
P
pheonix Offline
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
Post deleted by pheonix


new username: tidy_trax
Re: $run identifier #34390 06/07/03 06:19 PM
Joined: Dec 2002
Posts: 2,809
C
codemastr Offline
Hoopy frood
Offline
Hoopy frood
C
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.

Re: $run identifier *DELETED* #34391 06/07/03 06:25 PM
Joined: May 2003
Posts: 2,265
P
pheonix Offline
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
Post deleted by pheonix


new username: tidy_trax
Re: $run identifier #34392 06/07/03 06:27 PM
Joined: Apr 2003
Posts: 210
S
saxon Offline
Fjord artisan
Offline
Fjord artisan
S
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).

Re: $run identifier #34393 06/07/03 06:42 PM
Joined: Dec 2002
Posts: 2,809
C
codemastr Offline
Hoopy frood
Offline
Hoopy frood
C
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.

Re: $run identifier *DELETED* #34394 06/07/03 06:51 PM
Joined: May 2003
Posts: 2,265
P
pheonix Offline
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
Post deleted by pheonix


new username: tidy_trax
Re: $run identifier #34395 06/07/03 06:53 PM
Joined: Dec 2002
Posts: 2,809
C
codemastr Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
*sigh* whatever, you're wrong, you just don't want to admit it.

Re: $run identifier *DELETED* #34396 06/07/03 06:57 PM
Joined: May 2003
Posts: 2,265
P
pheonix Offline
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
Post deleted by pheonix


new username: tidy_trax
Re: $run identifier #34397 06/07/03 06:59 PM
Joined: Dec 2002
Posts: 2,809
C
codemastr Offline
Hoopy frood
Offline
Hoopy frood
C
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.

Page 1 of 2 1 2