Jump to content

Can't think of a topic title

Recommended Posts

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

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?



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

Would that work?

Edited by cougarelite
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.

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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...