sandin Posted May 15, 2008 Share Posted May 15, 2008 I have this script #include <GUIConstants.au3> #include <IE.au3> Opt("GUIOnEventMode", 1) HotKeySet("{F11}", "_get_controlfocus") $sHTML = "<HTML>" & @CR $sHTML &= "<HEAD>" & @CR $sHTML &= '<style type="text/css"><!-- body { margin: 4px; line-height: 16px;} --></style>' $sHTML &= "</HEAD>" & @CR $sHTML &= "<BODY BGCOLOR=""#292929"">" $sHTML &= "</BODY>" $sHTML &= "</HTML>" $oIE = _IECreateEmbedded() $Form1 = GUICreate("AForm1", 625, 445, 193, 115) $Edit1 = GUICtrlCreateObj($oIE, 16, 16, 593, 369) $Input1 = GUICtrlCreateInput("", 116, 408, 100, 20) $Label1 = GUICtrlCreateLabel("Press F11", 16, 408, 83, 17) GUISetOnEvent($GUI_EVENT_CLOSE, "_GUI_Close") _IENavigate($oIE, "about:blank") _IEDocWriteHTML($oIE, $sHTML) $oBody = _IETagNameGetCollection($oIE, "body", 0) GUISetState(@SW_SHOW) While 1 if ControlGetFocus($Form1) = "Internet Explorer_Server1" then GUICtrlSetState($Input1, $GUI_FOCUS) Sleep(10) WEnd func _GUI_Close() Exit EndFunc func _get_controlfocus() MsgBox(0, "Get controlfocus", ControlGetFocus($Form1)) EndFunc and I can't get focus to guiInput when I click on Edit1's obj? Actualy, I can get focus but only if I hold down mouse click on Edit1's obj. ;/ p.s. I tried GUICtrlSetOnEvent($Edit1, "_focus") and setting _focus func: GUICtrlSetState($Input1, $GUI_FOCUS) and that's not working ;/ Some cool glass and image menu | WinLIRC remote controler | Happy Holidays to all... | Bounce the sun, a game in which you must save the sun from falling by bouncing it back into the sky | Hook Leadtek WinFast TV Card Remote Control Msges | GDI+ sliding toolbar | MIDI Keyboard (early alpha stage, with lots of bugs to fix) | Alt+Tab replacement | CPU Benchmark with pretty GUI | Ini Editor - Edit/Create your ini files with great ease | Window Manager (take total control of your windows) Pretty GUI! | Pop-Up window from a button | Box slider for toolbar | Display sound volume on desktop | Switch hotkeys with mouse scroll Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 15, 2008 Share Posted May 15, 2008 I have this script #include <GUIConstants.au3> #include <IE.au3> Opt("GUIOnEventMode", 1) HotKeySet("{F11}", "_get_controlfocus") $sHTML = "<HTML>" & @CR $sHTML &= "<HEAD>" & @CR $sHTML &= '<style type="text/css"><!-- body { margin: 4px; line-height: 16px;} --></style>' $sHTML &= "</HEAD>" & @CR $sHTML &= "<BODY BGCOLOR=""#292929"">" $sHTML &= "</BODY>" $sHTML &= "</HTML>" $oIE = _IECreateEmbedded() $Form1 = GUICreate("AForm1", 625, 445, 193, 115) $Edit1 = GUICtrlCreateObj($oIE, 16, 16, 593, 369) $Input1 = GUICtrlCreateInput("", 116, 408, 100, 20) $Label1 = GUICtrlCreateLabel("Press F11", 16, 408, 83, 17) GUISetOnEvent($GUI_EVENT_CLOSE, "_GUI_Close") _IENavigate($oIE, "about:blank") _IEDocWriteHTML($oIE, $sHTML) $oBody = _IETagNameGetCollection($oIE, "body", 0) GUISetState(@SW_SHOW) While 1 if ControlGetFocus($Form1) = "Internet Explorer_Server1" then GUICtrlSetState($Input1, $GUI_FOCUS) Sleep(10) WEnd func _GUI_Close() Exit EndFunc func _get_controlfocus() MsgBox(0, "Get controlfocus", ControlGetFocus($Form1)) EndFunc and I can't get focus to guiInput when I click on Edit1's obj? Actualy, I can get focus but only if I hold down mouse click on Edit1's obj. ;/ p.s. I tried GUICtrlSetOnEvent($Edit1, "_focus") and setting _focus func: GUICtrlSetState($Input1, $GUI_FOCUS) and that's not working ;/ ControlGetFocus() returns the ClassNameNN of the control, it does not change the focus. To set the focus use ControlFocus() not GuiCtrlSetState(). Simplified demo: #include <GUIConstants.au3> #include <IE.au3> Opt("GUIOnEventMode", 1) HotKeySet("{F11}", "_SetControlFocus") $Form1 = GUICreate("AForm1", 625, 445, 193, 115) GUISetOnEvent($GUI_EVENT_CLOSE, "_GUI_Close") $oIE = _IECreateEmbedded() $Edit1 = GUICtrlCreateObj($oIE, 16, 16, 593, 369) _IENavigate($oIE, "about:blank") $Input1 = GUICtrlCreateInput("", 116, 408, 100, 20) $Label1 = GUICtrlCreateLabel("Press F11", 16, 408, 83, 17) GUISetState(@SW_SHOW) While 1 $sClassNameNN = ControlGetFocus($Form1) TrayTip("Focus", "ClassNameNN = " & $sClassNameNN, 5) Sleep(100) WEnd Func _GUI_Close() Exit EndFunc Func _SetControlFocus() ControlFocus($Form1, "", $Input1) EndFunc 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...
sandin Posted May 16, 2008 Author Share Posted May 16, 2008 Tnx for reply. I know I get classnameNN with ControlGetFocus, but shouldn't this line set focus on my input: if ControlGetFocus($Form1) = "Internet Explorer_Server1" then GUICtrlSetState($Input1, $GUI_FOCUS)oÝ÷ صúºÊ',!zr7öhhاj.±æî¶Ú'¢s%©Ýr¶¬jëh×6#include <GUIConstants.au3> #include <IE.au3> Opt("GUIOnEventMode", 1) HotKeySet("{F11}", "_get_controlfocus") $sHTML = "<HTML>" & @CR $sHTML &= "<HEAD>" & @CR $sHTML &= '<style type="text/css"><!-- body { margin: 4px; line-height: 16px;} --></style>' $sHTML &= "</HEAD>" & @CR $sHTML &= "<BODY BGCOLOR=""#292929"">" $sHTML &= "</BODY>" $sHTML &= "</HTML>" $oIE = _IECreateEmbedded() $Form1 = GUICreate("AForm1", 625, 445, 193, 115) $Edit1 = GUICtrlCreateObj($oIE, 16, 16, 593, 369) $Input1 = GUICtrlCreateInput("", 116, 408, 100, 20) $Label1 = GUICtrlCreateLabel("Press F11", 16, 408, 83, 17) GUISetOnEvent($GUI_EVENT_CLOSE, "_GUI_Close") _IENavigate($oIE, "about:blank") _IEDocWriteHTML($oIE, $sHTML) $oBody = _IETagNameGetCollection($oIE, "body", 0) GUISetState(@SW_SHOW) While 1 if ControlGetFocus($Form1) = "Internet Explorer_Server1" then MsgBox(0, "ok", "ok") GUICtrlSetState($Input1, $GUI_FOCUS) EndIf Sleep(10) WEnd func _GUI_Close() Exit EndFunc func _get_controlfocus() MsgBox(0, "Get controlfocus", ControlGetFocus($Form1)) EndFunc it's the same code as I posted above, but only msgbox change in the WHILE1 part, and with msgbox it works, how come? I want the SAME effect like in this last example script but without msgbox. Some cool glass and image menu | WinLIRC remote controler | Happy Holidays to all... | Bounce the sun, a game in which you must save the sun from falling by bouncing it back into the sky | Hook Leadtek WinFast TV Card Remote Control Msges | GDI+ sliding toolbar | MIDI Keyboard (early alpha stage, with lots of bugs to fix) | Alt+Tab replacement | CPU Benchmark with pretty GUI | Ini Editor - Edit/Create your ini files with great ease | Window Manager (take total control of your windows) Pretty GUI! | Pop-Up window from a button | Box slider for toolbar | Display sound volume on desktop | Switch hotkeys with mouse scroll Link to comment Share on other sites More sharing options...
sandin Posted May 16, 2008 Author Share Posted May 16, 2008 any suggestion? Why is it working with msgbox, and not working without msgbox? Some cool glass and image menu | WinLIRC remote controler | Happy Holidays to all... | Bounce the sun, a game in which you must save the sun from falling by bouncing it back into the sky | Hook Leadtek WinFast TV Card Remote Control Msges | GDI+ sliding toolbar | MIDI Keyboard (early alpha stage, with lots of bugs to fix) | Alt+Tab replacement | CPU Benchmark with pretty GUI | Ini Editor - Edit/Create your ini files with great ease | Window Manager (take total control of your windows) Pretty GUI! | Pop-Up window from a button | Box slider for toolbar | Display sound volume on desktop | Switch hotkeys with mouse scroll Link to comment Share on other sites More sharing options...
sandin Posted May 16, 2008 Author Share Posted May 16, 2008 (edited) I've done it: #include <GUIConstants.au3> #include <IE.au3> #Include <Misc.au3> Opt("GUIOnEventMode", 1) HotKeySet("{F11}", "_get_controlfocus") $dll = DllOpen("user32.dll") $oIE = _IECreateEmbedded() $Form1 = GUICreate("AForm1", 625, 445, 193, 115) $Edit1 = GUICtrlCreateObj($oIE, 16, 16, 593, 369) $Input1 = GUICtrlCreateInput("", 116, 408, 100, 20) $Label1 = GUICtrlCreateLabel("Press F11", 16, 408, 83, 17) GUISetOnEvent($GUI_EVENT_CLOSE, "_GUI_Close") _IENavigate($oIE, "about:blank") $oBody = _IETagNameGetCollection($oIE, "body", 0) GUISetState(@SW_SHOW) While 1 if ControlGetFocus($Form1) = "Internet Explorer_Server1" then if _IsPressed("01", $dll) Then Do Until NOT _IsPressed("01", $dll) GUICtrlSetState($Input1, $GUI_FOCUS) EndIf EndIf Sleep(10) WEnd func _GUI_Close() DllClose($dll) Exit EndFunc func _get_controlfocus() MsgBox(0, "Get controlfocus", ControlGetFocus($Form1)) EndFunc Edited May 16, 2008 by sandin Some cool glass and image menu | WinLIRC remote controler | Happy Holidays to all... | Bounce the sun, a game in which you must save the sun from falling by bouncing it back into the sky | Hook Leadtek WinFast TV Card Remote Control Msges | GDI+ sliding toolbar | MIDI Keyboard (early alpha stage, with lots of bugs to fix) | Alt+Tab replacement | CPU Benchmark with pretty GUI | Ini Editor - Edit/Create your ini files with great ease | Window Manager (take total control of your windows) Pretty GUI! | Pop-Up window from a button | Box slider for toolbar | Display sound volume on desktop | Switch hotkeys with mouse scroll 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