Jump to content

A question about FileExists and a string


huldu
 Share

Recommended Posts

Is there any way to check a string for a certain word?

Ive made a small input window where you drag and drop a file, the path to the file then starts a specific program. The problem is that i cant check if its the right file being started (so anything could be started). Usually wildcards (*) are great for stuff like this hehe, but they dont seem to work very well.

For example lets say i want the script to start a game found at c:\game\game.exe, but the user drags wrong file to input. The user dropped d:\program\program.exe... now the problem in my script will think its the c:\game\game.exe and start the d:\program\program.exe instead.

Now if wildcards would have been used i could do a check like this, but obviously it doesnt work hehe... :P

$var = "d:\program\program.exe"

If $var = "*game.exe*" Then .. <do stuff>

Else <wrong file, do again>

EndIf

"I'm paper, rock is fine, nerf scissors!!!"

Link to comment
Share on other sites

Is there any way to check a string for a certain word?

Ive made a small input window where you drag and drop a file, the path to the file then starts a specific program. The problem is that i cant check if its the right file being started (so anything could be started). Usually wildcards (*) are great for stuff like this hehe, but they dont seem to work very well.

For example lets say i want the script to start a game found at c:\game\game.exe, but the user drags wrong file to input. The user dropped d:\program\program.exe... now the problem in my script will think its the c:\game\game.exe and start the d:\program\program.exe instead.

Now if wildcards would have been used i could do a check like this, but obviously it doesnt work hehe... :P

how about; If StringInStr($var,"game.exe") <> 0 Then

Who needs puzzles when we have AutoIt!!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...