Ozi Posted November 4, 2007 Share Posted November 4, 2007 can i use ubound to count how many words i have in a key in an INI (ill use StringSplit and commas as the delimiters) and then lets say it returns 10 words, could i some how add 1 to each dimension name like Send($var[1])+1 then it'll do Send($var[2])+1 and so on? I might be saying it wrong but I hope someone gets the idea... Link to comment Share on other sites More sharing options...
Achilles Posted November 4, 2007 Share Posted November 4, 2007 I think what you're saying would be possible... However I don't quite get it. Do you have example code you could post? My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
Ozi Posted November 4, 2007 Author Share Posted November 4, 2007 $var = INIRead("C:\test.ini", "Section", "Key", "Unable to read INI.") Case $msg = $Button1 If WinExists("Test Window", "" ) Then WinActivate("Test Window", "") Send("{CTRLDOWN}{f}") Send("{CTRLUP}") $Search = StringSplit($var, ",") For $i = 1 To Ubound($Search) - 1 Send($Search[$i] + 1) Next Send("{Enter}") I was hoping this would search the INI for how many words (each word separted by a comma) there were in the INI ($var) and then if let's say 10 words it would keep incrementing the $Search[$i] so it would be able to send all the words in the INI to the active window, whether there be ten words or 20. Link to comment Share on other sites More sharing options...
Bowmore Posted November 4, 2007 Share Posted November 4, 2007 (edited) $var = INIRead("C:\test.ini", "Section", "Key", "Unable to read INI.") Case $msg = $Button1 If WinExists("Test Window", "" ) Then WinActivate("Test Window", "") Send("{CTRLDOWN}{f}") Send("{CTRLUP}") $Search = StringSplit($var, ",") For $i = 1 To Ubound($Search) - 1 Send($Search[$i] + 1) Next Send("{Enter}") I was hoping this would search the INI for how many words (each word separted by a comma) there were in the INI ($var) and then if let's say 10 words it would keep incrementing the $Search[$i] so it would be able to send all the words in the INI to the active window, whether there be ten words or 20. Element [0] returned of the array contains the number of words so you can rewrite your code like this $var = INIRead("C:\test.ini", "Section", "Key", "Unable to read INI.") Case $msg = $Button1 If WinExists("Test Window", "" ) Then WinActivate("Test Window", "") Send("{CTRLDOWN}{f}") Send("{CTRLUP}") $Search = StringSplit($var, ",") ;Check if any words found If IsArray($Search) Then For $i = 1 To $Search[0] Send($Search[$i]) Next Send("{Enter}") EndIf Edited November 4, 2007 by Bowmore "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook Link to comment Share on other sites More sharing options...
Ozi Posted November 4, 2007 Author Share Posted November 4, 2007 @Bowmore, that types the words in the INI all at once. I want them typed one at a time. Like use the commas as delimiters so when it gets to the first word it will type it, then press enter then go on to the next word, type it, press enter and so on. Link to comment Share on other sites More sharing options...
Bowmore Posted November 5, 2007 Share Posted November 5, 2007 @Bowmore, that types the words in the INI all at once. I want them typed one at a time. Like use the commas as delimiters so when it gets to the first word it will type it, then press enter then go on to the next word, type it, press enter and so on. This should achive the desired effect var = INIRead("C:\test.ini", "Section", "Key", "Unable to read INI.") Case $msg = $Button1 If WinExists("Test Window", "" ) Then WinActivate("Test Window", "") Send("{CTRLDOWN}{f}") Send("{CTRLUP}") $Search = StringSplit($var, ",") ;Check if any words found If IsArray($Search) Then For $i = 1 To $Search[0] Send($Search[$i] & "{Enter}") Next EndIf "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook Link to comment Share on other sites More sharing options...
Ozi Posted November 5, 2007 Author Share Posted November 5, 2007 Ok, it's working somewhat now, but I have Key=word1,word2 and then when the window thats it looking for becomes active it only sends word1 but not word2. 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