mike1212 Posted March 5, 2005 Share Posted March 5, 2005 -------------------------------------------------------------------------------- Hello I need some help here! What I have is an elseif statment within a while,continues loop, that needs to be modified. I need to Buy as many time as possible, then Sell. What is happening is when a Buy is no longer available the program still sees the option availabe. The reason for this is it is controled by x,y screen location of the buttons location and the button is still there. So it clicks the buy when infact it should click the sell seeing how the buy is no longer an option. How can the code be corrected? xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx elseif $action = 4 then ; Buy/Sell ; if we can Buy then Buy otherwise Sell if StringInStr(ControlGetText($optionname, "", $BuyButton), "Buy") = 1 then ControlClick($optionname, "", $BuyButton); else ControlClick($optionname, "", $sellButton); xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx I tried grouping 2 commands in one StringInStr and it would not allow me to do this. I think a code that first click buy followed up by a sell everytime should work seeing how it will buy first and at this point the sell would not be available so it would only false click sell option. On the other hand when a sell is available it will excecute it. hence correcting the problem. I am new to this group and my Knowledge is limited. Sorry if this question seem simple. Thank You Mike1212 Link to comment Share on other sites More sharing options...
ElSoloMar Posted March 5, 2005 Share Posted March 5, 2005 -------------------------------------------------------------------------------- Hello I need some help here! What I have is an elseif statment within a while,continues loop, that needs to be modified. I need to Buy as many time as possible, then Sell. What is happening is when a Buy is no longer available the program still sees the option availabe. The reason for this is it is controled by x,y screen location of the buttons location and the button is still there. So it clicks the buy when infact it should click the sell seeing how the buy is no longer an option. I would like to help you but , what are you talking about? I am running a box with borg technology! The distintiveness of your brand box will be added to the colective ... protection utilities are futile!cha, cha, chachaaaanm! Link to comment Share on other sites More sharing options...
steveR Posted March 5, 2005 Share Posted March 5, 2005 (edited) I think i understand, he has 2 buttons, buy and sell. he wants to click buy untill its no longer enabled, then click sell. is that right? then try looking at the ControlCommand() function ControlCommand ( "title", "text", controlID, "IsEnabled", "" ) "IsEnabled" Returns 1 if Control is enabled, 0 otherwise maybe like this : if ControlCommand($optionname,"",$BuyButton,"IsEnabled","") then ControlClick($optionname, "", $BuyButton); else ControlClick($optionname, "", $sellButton); Edited March 5, 2005 by steveR AutoIt3 online docs Use it... Know it... Live it...MSDN libraryglobal Help and SupportWindows: Just another pane in the glass. Link to comment Share on other sites More sharing options...
mike1212 Posted March 5, 2005 Author Share Posted March 5, 2005 (edited) Hi SteveR Yes you are correct, that is exactly what I need. Now if I can get it to work. I tried your conrtol command idea and it does the same as my elseif command no good I think both of these commands are acting as single command seeing how the program doesnt know if the button was enabled or not. I think I need maybe some type of "then command" See these 2 buttons have no way of telling the program which one of them is active. If I reverse the oder it sells but never buys the the other way it buys and never sells. Mike Edited March 5, 2005 by mike1212 Link to comment Share on other sites More sharing options...
steveR Posted March 5, 2005 Share Posted March 5, 2005 I never used these fucntions before so I could be wrong. In the help file, it says to use ControlFocus() before each ControlClick(). Maybe try that. AutoIt3 online docs Use it... Know it... Live it...MSDN libraryglobal Help and SupportWindows: Just another pane in the glass. 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