Sign in to follow this  
Followers 0
cougarelite

Can't think of a topic title

3 posts in this topic

#1 ·  Posted (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 by cougarelite

Share this post


Link to post
Share on other sites



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.

Share this post


Link to post
Share on other sites

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.

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