SilverSekai Posted July 2, 2012 Share Posted July 2, 2012 Hello there people. So I've made a script for a friend, it logs into two instances of yahoo messenger with two different id's and passwords. I wanna improve the script, I have noticed that if I click on another window the script waits for window to activate WinWaitActive, so I wanna make loop to check the state of the window, if it's active to continue the script else to activate it. I kinda have an idea how to do it, but I don't really know how loops work because I have no experience with programming... and I also wanna know how to activate a certain window, because they have the same ID, but I've seen they have different instances, so I wanna know how to take advantage of this to tell the two instances apart. PS: the window pulls out 4 lines from a text if you wanna change your two accounts and passwords, but that is not important. Here is the script expandcollapse popup#include #include #include #include #include Run("C:\Program Files (x86)\Yahoo!\Messenger\YahooMessenger.exe") Sleep(600) WinActivate("Yahoo! Messenger") Sleep(10) WinWaitActive("Yahoo! Messenger") Sleep(300) If ControlGetText("Yahoo! Messenger", "", 2) == "&Cancel" Then ControlClick("Yahoo! Messenger", "", 2) EndIf Sleep(300) $line1 = FileReadLine("EditLoginSettings.txt", 1) ;reads the controls into variables from txt file $line2 = FileReadLine("EditLoginSettings.txt", 2) $line3 = FileReadLine("EditLoginSettings.txt", 3) $line4 = FileReadLine("EditLoginSettings.txt", 4) ControlSetText("Yahoo! Messenger", "", 211, $line1) Sleep(50) ControlSetText("Yahoo! Messenger", "", 212, $line2) Sleep(400) ControlClick("Yahoo! Messenger", "", 1) Sleep(5000) Run("C:\Program Files (x86)\Yahoo!\Messenger\YahooMessenger.exe") ;second instance Sleep(600) WinWaitActive("Yahoo! Messenger") Sleep(500) If ControlGetText("Yahoo! Messenger", "", 2) == "&Cancel" Then ControlClick("Yahoo! Messenger", "", 2) EndIf Sleep(500) ControlSetText("Yahoo! Messenger", "", 211, $line3) Sleep(50) ControlSetText("Yahoo! Messenger", "", 212, $line4) Sleep(400) ControlClick("Yahoo! Messenger", "", 1) Sleep(10) Link to comment Share on other sites More sharing options...
Valik Posted July 2, 2012 Share Posted July 2, 2012 User is not welcome here for egregious disregard for the forum rules. Thread locked, user blocked. Link to comment Share on other sites More sharing options...
Recommended Posts