Jump to content

Recommended Posts

edena

Hi!,

Please can anyone help me with my script, because i cannot close the GUI after clicking on the link.

#include <ButtonConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <IE.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 146, 80, 192, 124)
$Label1 = GUICtrlCreateLabel("Link that Opens Google", 16, 32, 116, 17)
GUICtrlSetFont(-1, 8, 400, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
GUICtrlSetCursor (-1, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Label1
$oIE = _IECreate ("[url="http://www.google.com"]www.google.com[/url]")
EndSwitch
WEnd

Thank You.

Share this post


Link to post
Share on other sites
ileandros

I can close it. Just tried and it closes.

I think you have posted only some part of you script and the problem is not in this part of it.


I feel nothing.It feels great.

Share this post


Link to post
Share on other sites
Gibbz

Its Worked With Me Too

And my advice is dont use koda cuz you will not know where the problem is ;)

Share this post


Link to post
Share on other sites
Danyfirex

So if you want to open a link I recomend you use ShellExecute, because it will open in defect broswer.

#include <ButtonConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 146, 80, 192, 124)
$Label1 = GUICtrlCreateLabel("Link that Opens Google", 16, 32, 116, 17)
GUICtrlSetFont(-1, 8, 400, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
GUICtrlSetCursor (-1, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Label1
$oIE = ShellExecute("http://www.google.com")
EndSwitch
WEnd

Share this post


Link to post
Share on other sites
edena

Okay! thank you

Please! i have another question,

When i click on the GUI link there's two browsers opening up. There's one with the Google webpage and the other one seem to be blank yet still loading.

Now if this is happening to me how can i just open only one website instead of two?

Thank You.

Share this post


Link to post
Share on other sites
ileandros

Could be an advertisment on the site you are opening.

Or check ur browser setting. With the code above this thing doesnt happen


I feel nothing.It feels great.

Share this post


Link to post
Share on other sites
JohnOne

If it were me, I'd be looking for problems on my computer.

Infections of some sort, it is supposed to, and does open only one browser

on a healthy computer.

EDIT: or what ileandros said.

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites
edena

Okay Thanks Danyfirex and Thanks to everyone, its working well!

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Similar Content

    • Elzie
      By Elzie
      Hi all and thank you for your help. I have been working on a log-out for a gui and some times this code will not work. How do I get past AM and PM?
      Edit 1 Ok i think I have it. Thanks Valuater https://www.autoitscript.com/wiki/Snippets_(_Time_%26_Date_)
      Edit 2 Still not there... Please help.
      #include <ButtonConstants.au3> #include <DateTimeConstants.au3> #include <date.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) $Form1 = GUICreate("Time Machine", 252, 117, 2421, 445) GUISetBkColor(0xA6CAF0) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") $Checkbox1 = GUICtrlCreateCheckbox("Exit GUI ", 24, 24, 105, 25) $Date1 = GUICtrlCreateDate(" ", 136, 24, 98, 24, $DTS_TIMEFORMAT) $Label1 = GUICtrlCreateLabel("00:00:00 ", 136, 72, 93, 20) GUIctrlSetData($Label1, _Time()) $Button1 = GUICtrlCreateButton("Start", 24, 72, 75, 25) GUICtrlSetOnEvent($Button1, "_Func_1") $Button2 = GUICtrlCreateButton("Stop", 24, 72, 75, 25) GUICtrlSetOnEvent($Button2, "_Func_2") GUICtrlSetState($Button2, $GUI_HIDE) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_COMMAND, "_COMMAND_STOP") Global $stop = 0; set exitloop flag While 1 Sleep(100) WEnd Func _Func_1() GUICtrlSetState($Button1, $GUI_HIDE); Hide and show start and stop GUICtrlSetState($Button2, $GUI_SHOW) While 1 Sleep(1000) If $stop <> 0 Then ; set exitloop Return EndIf If _IsChecked($Checkbox1) Then; check for checkbox to exit Local $set = GUICtrlRead($Date1) Local $tm = _Time() If $set < $tm Then Exit EndIf EndIf GUICtrlSetData($Label1, $tm ); set lable time WEnd EndFunc ;==>_Func_1 Func _Time() Local $hour = @HOUR, $AMPM = "AM" If $hour > 11 Then $AMPM = "PM" If $hour = 0 Then $hour = 12 If $hour > 12 Then $hour -= 12 Return $hour & ":" & @MIN & ":" & @SEC & " " & $AMPM EndFunc ;==>_Time Func _Func_2();====================================== Set button 1 to show and hide button 2 GUICtrlSetState($Button2, $GUI_HIDE) GUICtrlSetState($Button1, $GUI_SHOW) $stop = 0 EndFunc ;==>_Func_2 Func _IsChecked($idControlID);===================== Look for Checkbox ====================== Return BitAND(GUICtrlRead($idControlID), $GUI_CHECKED) = $GUI_CHECKED EndFunc ;==>_IsChecked Func _COMMAND_STOP($hWnd, $Msg, $wParam, $lParam); Set $Interrupt to stop loop If BitAND($wParam, 0x0000FFFF) = $Button2 Then $stop = 1 Return $GUI_RUNDEFMSG EndFunc ;==> _COMMAND_STOP Func _Exit() Exit EndFunc ;==>_Exit  
         
       
×