Sajesh Posted March 14, 2008 Share Posted March 14, 2008 Hi, I am a beginner in Auto IT. I need to click a link in GUI window. Can anyone guide me with the functions needed to click a link in GUI. Thanks! Link to comment Share on other sites More sharing options...
rasim Posted March 14, 2008 Share Posted March 14, 2008 Welcome! Example: #include <GuiConstants.au3> Global $Flag = 1 $hGui = GUICreate(":-)", 240, 120) $URL_Label = GUICtrlCreateLabel("Welcome to AutoIT forum", 60, 40, 130, 16) GUICtrlSetCursor(-1, 0) ;GUICtrlSetBkColor(-1, 0xFF0000) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop Case $GUI_EVENT_MOUSEMOVE $aCurPos = GUIGetCursorInfo() If $aCurPos[4] = $URL_Label And $Flag = 1 Then GUICtrlSetColor($URL_Label, 0xFF0000) GUICtrlSetFont($URL_Label, Default, Default, 2) $Flag = 0 ElseIf $aCurPos[4] <> $URL_Label And $Flag = 0 Then GUICtrlSetColor($URL_Label, 0x000000) GUICtrlSetFont($URL_Label, Default) $Flag = 1 EndIf Case $URL_Label ShellExecute("http://www.autoitscript.com/forum") EndSwitch WEnd Link to comment Share on other sites More sharing options...
DjDeep00 Posted March 14, 2008 Share Posted March 14, 2008 I need to click a link in GUI window.Not really sure but I think he wanted to know how to click on a link, not create a GUI with a link.@Sajesh...is it a IE window that has the link?...If so look in the helpfile for IE functions. Link to comment Share on other sites More sharing options...
Sajesh Posted March 14, 2008 Author Share Posted March 14, 2008 Not really sure but I think he wanted to know how to click on a link, not create a GUI with a link.@Sajesh...is it a IE window that has the link?...If so look in the helpfile for IE functions.Sorry for not explaining my question well.Actually I am testing a window that has a link.My objective is to click that link in the GUI window without using mouse and I dont have the URL of that link.How can I recognize that link in the window and click it with the keyboard.Please explain. Link to comment Share on other sites More sharing options...
DjDeep00 Posted March 14, 2008 Share Posted March 14, 2008 @Sajesh..You can try getting the control name of the link by using the Autoit Window Spy ("C:\Program Files\AutoIt3\Au3Info.exe"). Link to comment Share on other sites More sharing options...
Sajesh Posted March 14, 2008 Author Share Posted March 14, 2008 @Sajesh..You can try getting the control name of the link by using the Autoit Window Spy ("C:\Program Files\AutoIt3\Au3Info.exe").But spy is not recognizing the link. Is there any other way? Link to comment Share on other sites More sharing options...
Sajesh Posted March 14, 2008 Author Share Posted March 14, 2008 Welcome! Example: #include <GuiConstants.au3> Global $Flag = 1 $hGui = GUICreate(":-)", 240, 120) $URL_Label = GUICtrlCreateLabel("Welcome to AutoIT forum", 60, 40, 130, 16) GUICtrlSetCursor(-1, 0) ;GUICtrlSetBkColor(-1, 0xFF0000) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop Case $GUI_EVENT_MOUSEMOVE $aCurPos = GUIGetCursorInfo() If $aCurPos[4] = $URL_Label And $Flag = 1 Then GUICtrlSetColor($URL_Label, 0xFF0000) GUICtrlSetFont($URL_Label, Default, Default, 2) $Flag = 0 ElseIf $aCurPos[4] <> $URL_Label And $Flag = 0 Then GUICtrlSetColor($URL_Label, 0x000000) GUICtrlSetFont($URL_Label, Default) $Flag = 1 EndIf Case $URL_Label ShellExecute("http://www.autoitscript.com/forum") EndSwitch WEnd Thanks Rasim! I gained a lot of knowledge from ur code. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 14, 2008 Moderators Share Posted March 14, 2008 But spy is not recognizing the link. Is there any other way?Can we have the app name... maybe someone can show you easily rather than guessing what it would be. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Sajesh Posted March 14, 2008 Author Share Posted March 14, 2008 Can we have the app name... maybe someone can show you easily rather than guessing what it would be.It is an XML based application. Link to comment Share on other sites More sharing options...
Sajesh Posted March 14, 2008 Author Share Posted March 14, 2008 Can we have the app name... maybe someone can show you easily rather than guessing what it would be.It is an XML based application. Link to comment Share on other sites More sharing options...
Sajesh Posted March 14, 2008 Author Share Posted March 14, 2008 It is an XML based application.Please consider this example:Open IE 7Click Help--> About.In the about window there is a link '2006 Microsoft Corporation'.Auto IT spy is not recognizing this link. Link to comment Share on other sites More sharing options...
duckling78 Posted April 15, 2008 Share Posted April 15, 2008 Is the link in a dedicated position? Maybe you can just click it using coordinates? Opt("MouseCoordMode", 2) ;2 = relative coords to the client area of the active window WinActivate("About Internet Explorer") MouseClick("primary", 148, 288) 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