Sign in to follow this  
Followers 0
mangatodd

Looking for help with If's and ClipGet...

2 posts in this topic

#1 ·  Posted (edited)

I'm running a script that copies values from Excel cells and usually just pastes them into a GUI. But for one specific cell, I wish to analyze the information I've copied and output different text for 4 different cases. I'm trying to use ClipGet, but don't think I'm using it correctly. It's also been a while since I've messed with If Then statements. Any help/advice would be great. Here's what I've got:

WinActivate("Microsoft Excel")

Send("{TAB}")

Sleep($delay)

Send("^c")

If ClipGet() = "WordA"

Then ControlSend("GUI", "", "CLASS:Edit; INSTANCE:1", "OutputA")

ElseIf ClipGet() = "WordB"

Then ControlSend("GUI", "", "CLASS:Edit; INSTANCE:1", "OutputB")

ElseIf ClipGet() = "WordC"

Then ControlSend("GUI", "", "CLASS:Edit; INSTANCE:1", "OutputC")

Else ControlSend("GUI", "", "CLASS:Edit; INSTANCE:1", "OutputD")

EndIf

Edited by mangatodd

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

here's what I would suggest:

you create the excel process

you read the specific cell (search for locodarwin's excelCOM UDF).

(_excelreadcel(I'm not sure, didn't look it up but to give you the idea)

once you read that cell, normally the value that you need to evaluate is allready in a variable

$variable = _excelreadcel(somecell)

then you can begin your conditional statement:

since you have 4 values a better choice for you is a select case

select
    case $variable = "One"
        ;statements
    case $variable = "Two"
        ;statements
    case $variable = "Three"
        ;statements
    case $variable = "Four"
        ;Statements
EndSelect

hope this already helps you in the right direction.

it's quite unbelievable you haven't played with if then else statements lately.. Everybody uses these in real life all the time..

(if hungry then buy hamburger, if angry then take happypil, if walk through red then car runs over me)

Edited by lordofthestrings

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