Sign in to follow this  
Followers 0
huldu

A question about FileExists and a string

2 posts in this topic

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!!!"

Share this post


Link to post
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!!

Share this post


Link to post
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
Sign in to follow this  
Followers 0