Alterego Posted January 9, 2005 Share Posted January 9, 2005 I'm using the most recent version and trying to get either ControlClick, ControlFocus, ControlSend, or ControlSetText to work...I could make this go with any of them. I don't get any compile or run errors or anything, it just takes the focus off of both windows, so maybe I am interacting with a hidden element? The little piece of code in question is ControlSetText ( "", "C:\blah\blah.txt", "", $search ). I've tried a zillion different variations of these commands, leaving blank quotes in every space or inputing various data given to me by the Spy. I figured if any of them would work it would be the one above since it is a very specific bit of text that the window is opening with, it should be easy to identify it and replace it. I also tried skipping my file search operation and just using the "test" instead of $search..I tried everything i can think of basically The full code looks like: Dim $TomeRaider = "C:\Program Files\TomeRaider3\TomeRaider.exe" Run( $TomeRaider, "C:\Program Files\TomeRaider3\", @SW_MAXIMIZE ) WinWait( "TomeRaider", "Categories" ) If not WinActive( "TomeRaider", "Categories" ) Then WinActivate( "TomeRaider", "Categories" ) WinWaitActive ( "TomeRaider", "Categories" ) Send( "{ALTDOWN}{ALTUP}{DOWN}{DOWN}{DOWN}{ENTER}" ) FileChangeDir ( "I:\blah\" ) $search = FileFindFirstFile ( "WP_" * ".txt" ) If $search = -1 Then MsgBox(0, "Error", "No files/directories matched the search pattern") Exit EndIf ControlSetText ( "", "Automatic", "Button2", $search )The window I am working with is the TomeRaider 3 file > import menu (it's free to install and import stuff). It seems to be very sensitive, as a pixel more or less and you are in another control ID. Anyway, none of them seem to work! Here's the information its giving me. I've been working on this spot for 3 hours trying to find a way, which isn't so bad considering i'm a newb...i've learned a lot. If anyone could peek at this and give me a hint that would be great. >>>>>>>>>>>> Window Details <<<<<<<<<<<<<Title: File ImportClass: #32770Size: X: 153 Y: 29 W: 494 H: 488>>>>>>>>>>> Mouse Position <<<<<<<<<<<Screen: X: 194 Y: 112>>>>>>>>>>> Pixel Color Under Mouse <<<<<<<<<<<RGB: Hex: 0xFFFFFF Dec: 16777215>>>>>>>>>>> Control Under Mouse <<<<<<<<<<<Control ID: 1057ClassNameNN: Button2Text: Automatic(Control is hidden)>>>>>>>>>>> Status Bar Text <<<<<<<<<<<>>>>>>>>>>> Visible Window Text <<<<<<<<<<<Tab1C:\blah...Source FileProgress1Progress--OutputOpenImportCancel>>>>>>>>>>> Hidden Window Text <<<<<<<<<<<SegmentationAutomaticFixed ( Value below )1024Log FileProduce Log File...Create In The Following DirectoryPicturesSkip PicturesSaveSortingAutomatically Sort Unsorted FilesLeave The Subject Order As It IsAsk Me Before SortOr maybe it's>>>>>>>>>>>> Window Details <<<<<<<<<<<<<Title: File ImportClass: #32770Size: X: 153 Y: 29 W: 494 H: 488>>>>>>>>>>> Mouse Position <<<<<<<<<<<Screen: X: 189 Y: 112>>>>>>>>>>> Pixel Color Under Mouse <<<<<<<<<<<RGB: Hex: 0x000000 Dec: 0>>>>>>>>>>> Control Under Mouse <<<<<<<<<<<Control ID: 1035ClassNameNN: Edit3Text: >>>>>>>>>>> Status Bar Text <<<<<<<<<<<>>>>>>>>>>> Visible Window Text <<<<<<<<<<<Tab1C:\Blah...Source FileProgress1Progress--OutputOpenImportCancel>>>>>>>>>>> Hidden Window Text <<<<<<<<<<<SegmentationAutomaticFixed ( Value below )1024Log FileProduce Log File...Create In The Following DirectoryPicturesSkip PicturesSaveSortingAutomatically Sort Unsorted FilesLeave The Subject Order As It IsAsk Me Before Sort This dynamic web page is powered by AutoIt 3. Link to comment Share on other sites More sharing options...
this-is-me Posted January 9, 2005 Share Posted January 9, 2005 ControlSetText("File Import", "", "Edit3", $search) Who else would I be? Link to comment Share on other sites More sharing options...
Alterego Posted January 9, 2005 Author Share Posted January 9, 2005 ControlSetText("File Import", "", "Edit3", $search)<{POST_SNAPBACK}>Hey it's working. That's pretty slick. Thanks you This dynamic web page is powered by AutoIt 3. Link to comment Share on other sites More sharing options...
Alterego Posted January 9, 2005 Author Share Posted January 9, 2005 I've got it automagically compiling now! My next trick is to get it to recognize when it's done compiling. The ONLY difference is that the aforementioned control gets greyed out during processing, and is reactivated afterwards.. Is there any way to check for this? WinGetState doesn't seem to check for that, I don't think there is a way to make ControlEnable simply detect it. I guess what I'd be looking for is ControlWaitActive This dynamic web page is powered by AutoIt 3. Link to comment Share on other sites More sharing options...
Alterego Posted January 9, 2005 Author Share Posted January 9, 2005 I got it! haha Do Sleep (5000) $litmusLoop = ControlEnable("File Import","", "Edit3") Sleep (1000) ControlDisable("File Import","", "Edit3") Until $litmusLoop = 0 This dynamic web page is powered by AutoIt 3. Link to comment Share on other sites More sharing options...
this-is-me Posted January 9, 2005 Share Posted January 9, 2005 ControlCommand can also check if a control is enabled. Who else would I be? Link to comment Share on other sites More sharing options...
Alterego Posted January 10, 2005 Author Share Posted January 10, 2005 (edited) Thanks for that. I can't quite get it to do what i'm asking yet. What happens is that before compiling Button19's text is Import. After pushing Import, Button19's text is Stop. After it's done importing Button19's text is Compile. I'd like to detect when it turns from stop to compile and then close TomeRaider. Any advice on how to get this? I took a screenshot. Button19 is bottom middle Edited January 10, 2005 by Alterego This dynamic web page is powered by AutoIt 3. Link to comment Share on other sites More sharing options...
MHz Posted January 10, 2005 Share Posted January 10, 2005 You could try something like thisAdlibEnable('CheckControl', 250); Top of Script. While 1 Sleep(1000) WEnd; Bottom of Script. To keep it alive. Func CheckControl() $a = ControlGetText('TomeRaider', '', 'Button19') If $a = 'Stop' Then Do Sleep(1000) $a = ControlGetText('TomeRaider', '', 'Button19') Until $a = 'Compile' ; ControlClick exit button Exit EndIf EndFunc; Check control change.This would check for the button change of stop to compile. Not tested, but what I would try. Link to comment Share on other sites More sharing options...
Alterego Posted January 10, 2005 Author Share Posted January 10, 2005 (edited) That's a really neat bit of code. I really like that Adlib function This works as-is. Thanks! edit: well i did change it a little it turns out i didnt have to use that adlib function. Func CheckControl() If not WinActive( "File Import", "" ) Then WinActivate( "File Import", "" ) WinWaitActive( "File Import", "" ) $a = ControlGetText('File Import', '', 'Button19') If $a = 'Stop' Then Do Sleep(1000) $a = ControlGetText('File Import', '', 'Button19') Until $a = 'Compile' ProcessClose ( "TomeRaider.exe" ) EndIf EndFunc Edited January 10, 2005 by Alterego This dynamic web page is powered by AutoIt 3. 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