cougarelite Posted July 23, 2005 Share Posted July 23, 2005 (edited) Hey everyone, I'm designing an AutoIt script to interact with a Microsoft Excel document and I've run into some trouble. Just so you know, I have AutoIt 3. Well if I didn't, it wouldn't be in this folder so I guess the cow has antlers . ??? O Alright well I made the script copy one of the cells from my Excel document to the clipboard. The value of that cell varies and it can be from $1 - $70. I forget the way to make the script do something only if what I copied contains a certain string. I need to make it do a different amount of tasks for each dollar. Pretty much one click for every dollar. So would it be something like this? $text = ClipGet(); If StringInStr("$text", "$1") Then Do the thing for $1 ElseIf StringInStr("$text", "$2") Then Do the thing for $2 ... EndIf I think I have the right idea with that, but what happens when you get to double digit numbers. The script would be checking the clipboard for like $1 but $10 has a $1 so wouldn't it trigger the $1 part. Is there any way around this? Oh and in the script above, would StringInStr actually look for $1 literally or would it look for a variable called $1 because of the dollar sign? Thanks, Joey EDIT: I just got an idea. Couldn't I just do something like $text = ClipGet(); If $text = 1 Then Do stuff for 1 ElseIf $text = 2 Then Do stuff for 2 ... EndIf Would that work? Edited July 23, 2005 by cougarelite Link to comment Share on other sites More sharing options...
blindwig Posted July 23, 2005 Share Posted July 23, 2005 Yes, I think I can help you with your topic title. Based on your post, I would recommend "I need help checking the value of a string", or "How do I check the value of a string", or something along those lines. That seems to be what you're asking for. My UDF Threads:Pseudo-Hash: Binary Trees, Flat TablesFiles: Filter by Attribute, Tree List, Recursive Find, Recursive Folders Size, exported to XMLArrays: Nested, Pull Common Elements, Display 2dSystem: Expand Environment Strings, List Drives, List USB DrivesMisc: Multi-Layer Progress Bars, Binary FlagsStrings: Find Char(s) in String, Find String in SetOther UDF Threads I Participated:Base64 Conversions Link to comment Share on other sites More sharing options...
t0ddie Posted July 23, 2005 Share Posted July 23, 2005 stringinstr is the command you want use an if statement with that command for your desired results Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you. 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