huldu Posted December 31, 2005 Share Posted December 31, 2005 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... $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 More sharing options...
Rick Posted December 31, 2005 Share Posted December 31, 2005 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... how about; If StringInStr($var,"game.exe") <> 0 Then Who needs puzzles when we have AutoIt!! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now