mangatodd Posted August 2, 2007 Share Posted August 2, 2007 (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 August 2, 2007 by mangatodd Link to comment Share on other sites More sharing options...
lordofthestrings Posted August 2, 2007 Share Posted August 2, 2007 (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 August 2, 2007 by lordofthestrings 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