wwwkostas Posted September 2, 2009 Share Posted September 2, 2009 Hi guys.. Please, could someone help me.. Have a window with nonconstant title. Can get handle of this window just one time. Writed this handle in .ini file for use it when it will be need. But it not working if I read it from file and not from window directly. Maybe I can't understand something.. This is example that not working too: $get_win_han = WinGetHandle ("D:\MM2.txt - Notepad2") IniWrite (@ScriptDir&"\test.ini", "test", "key", $get_win_han) $get_temp_win_handle = IniRead (@ScriptDir&"\test.ini", "test", "key", "") $get_win_pos = WinGetPos ($get_temp_win_handle) If @error Then Exit MsgBox (4096, "Info", $get_win_pos[0], 5) Link to comment Share on other sites More sharing options...
PsaltyDS Posted September 2, 2009 Share Posted September 2, 2009 Hi guys.. Please, could someone help me.. Have a window with nonconstant title. Can get handle of this window just one time. Writed this handle in .ini file for use it when it will be need. But it not working if I read it from file and not from window directly. Maybe I can't understand something.. This is example that not working too:$get_win_han = WinGetHandle ("D:\MM2.txt - Notepad2") IniWrite (@ScriptDir&"\test.ini", "test", "key", $get_win_han) $get_temp_win_handle = IniRead (@ScriptDir&"\test.ini", "test", "key", "") $get_win_pos = WinGetPos ($get_temp_win_handle) If @error Then Exit MsgBox (4096, "Info", $get_win_pos[0], 5) The handle will be different every time Notepad gets launched, so the value you stored will only work until that instance of Notepad get closed. With that limitation in mind, the handle was saved as a string conversion of an integer value, you just convert the string-int back to a handle with Hwnd(): Run("Notepad.exe") WinWait("Untitled - Notepad") $get_win_han = WinGetHandle("Untitled - Notepad") IniWrite(@ScriptDir & "\test.ini", "Test", "Key", $get_win_han) $get_temp_win_handle = IniRead(@ScriptDir & "\test.ini", "test", "key", "") $hNotepad = HWnd($get_temp_win_handle) $get_win_title = WinGetTitle($hNotepad) If @error Then MsgBox(16, "Error", "Error on WinGetTitle(" & $hNotepad & ")") Else MsgBox(4096, "Title", $get_win_title) EndIf Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
wwwkostas Posted September 2, 2009 Author Share Posted September 2, 2009 The handle will be different every time Notepad gets launched, so the value you stored will only work until that instance of Notepad get closed. With that limitation in mind, the handle was saved as a string conversion of an integer value, you just convert the string-int back to a handle with Hwnd(): Thank's..You gave me great idea..Thank's a lot.. 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