Sign in to follow this  
Followers 0
Donald8282

Creating new menu items

22 posts in this topic

Hello, I am trying to figure out a way to make a "favorites" for my web browser. I thought about using an .INI file to store the name + website but I'm not sure how to make it work. I'm not sure how to make it create a new item in the favorites menu and have it be able to be used. Right now I just have a set list of favorites. Here's the code to my web browser. It's pretty messy and I'm sure there are a few mistakes / things there are that could make it faster / better but I'd like to learn to do that on my own. I'm just asking for help on this subject. If you do see something that could be changed, please let me know and what to do to fix it. Don't just fix it for me =P. Thanks in adv. - Donald8282

Code:

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.6.1
 Author:         Donald Whitten

#ce ----------------------------------------------------------------------------

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <IE.au3>
#Include <WinAPI.au3>
#Include <GuiListView.au3>
#Include <String.au3>
#NoTrayIcon


$cURL2 = ""
$TitleGet1 = ""

_IEErrorHandlerRegister()

$E_Browser = _IECreateEmbedded()
$Home = "http://www.google.com/"
$Main = "C:\Users\Owner\Pictures\Logitech Webcam\Picture 28.jpg"

$Hour = @HOUR
$Minute = @MIN

$AM_PM = ""

If @HOUR >= 12 Then
    $AM_PM = "PM"
ElseIf @HOUR < 12 Then
    $AM_PM = "AM"
EndIf

If @HOUR > 12 Then
    $Hour -= 12
ElseIf @HOUR = 00 Then
    $Hour = 12
EndIf


$Mon = ""

If @MON = 1 Then
    $Mon = "January"
ElseIf @MON = 2 Then
    $Mon = "February"
ElseIf @MON = 3 Then
    $Mon = "March"
ElseIf @MON = 4 Then
    $Mon = "April"
ElseIf @MON = 5 Then
    $Mon = "May"
ElseIf @MON = 6 Then
    $Mon = "June"
ElseIf @MON = 7 Then
    $Mon = "July"
ElseIf @MON = 8 Then
    $Mon = "August"
ElseIf @MON = 9 Then
    $Mon = "September"
ElseIf @MON = 10 Then
    $Mon = "October"
ElseIf @MON = 11 Then
    $Mon = "November"
ElseIf @MON = 12 Then
    $Mon = "December"
EndIf



$Window = GUICreate("", 640, 580, (@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2, $GUI_SS_DEFAULT_GUI + $WS_MAXIMIZEBOX + $WS_SIZEBOX)
GUISetBkColor(0x00FF00)
GUISetState()
GUISetState(@SW_MAXIMIZE)

$Height_Width = WinGetPos($Window)
$Background = GUICtrlCreatePic($main, 0, 0, $Height_Width[2], $Height_Width[3], 0, $GUI_WS_EX_PARENTDRAG)

$M_File = GUICtrlCreateMenu("File")
$F_SavePage = GUICtrlCreateMenuItem("Save Page", $M_FILE)
GUICtrlCreateMenuItem("", $M_File)
$F_Exit = GUICtrlCreateMenuItem("Exit", $M_FILE)

$M_Tools = GUICtrlCreateMenu("Tools")
$T_Pass = GUICtrlCreateMenuItem("Password Creator", $M_Tools)
$T_His = GUICtrlCreateMenuItem("Clear History", $M_Tools)

$M_Fav = GUICtrlCreateMenu("Favorites")
$Fa_FB = GUICtrlCreateMenuItem("Facebook", $M_Fav)
$Fa_K = GUICtrlCreateMenuItem("Kongregate", $M_Fav)
$Fa_W = GUICtrlCreateMenuItem("Wikipedia", $M_Fav)
$Fa_Y = GUICtrlCreateMenuItem("Youtube", $M_Fav)

$M_Help = GUICtrlCreateMenu("Help")
$H_Info = GUICtrlCreateMenuItem("Info", $M_Help)

$B_Home = GUICtrlCreateButton ("Home", 10, 10, 70, 20)
$B_Back = GUICtrlCreateButton ("Back", 90, 10, 70, 20)
$B_Forward = GUICtrlCreateButton("Forward", 170, 10, 70, 20)
$I_URL = GUICtrlCreateInput("", 250, 10, 600, 20)
$B_Go = GUICtrlCreateButton("&Go", 860, 10, 70, 20, $BS_DEFPUSHBUTTON)
$B_Refresh = GUICtrlCreateButton("Refresh", 940, 10, 70, 20)
$I_Time = GUICtrlCreateInput("Time: " & $Hour & ":" & $Minute & " " & $AM_PM & " / " & $Mon & " " & @MDAY & ", " & @YEAR, 1010, 10, 190, 20, $ES_READONLY)
$B_Background = GUICtrlCreateButton ("Background", 1198, 10, 70, 20)
$Browser = GUICtrlCreateObj($E_Browser, 10, 40, $Height_Width[2] - 40, $Height_Width[3] - 120)
Global $P_Progress = GUICtrlCreateProgress(10, 710, 1245, 20)


GUICtrlSetResizing($Browser, 1)
GUICtrlSetResizing($Background, 1)
GUICtrlSetResizing($B_Home, 1)
GUICtrlSetResizing($B_Back, 1)
GUICtrlSetResizing($B_Forward, 1)
GUICtrlSetResizing($I_URL, 1)
GUICtrlSetResizing($B_Go, 1)
GUICtrlSetResizing($B_Refresh, 1)
GUICtrlSetResizing($I_Time, 1)
GUICtrlSetResizing($B_Background, 1)
GUICtrlSetResizing($P_Progress, 1)

GUICtrlSetBkColor($I_URL, 0x000000)
GUICtrlSetColor($I_URL, 0x00FF00)

GUICtrlSetBkColor($B_Home, 0x000000)
GUICtrlSetColor($B_Home, 0x00FF00)

GUICtrlSetBkColor($B_Back, 0x000000)
GUICtrlSetColor($B_Back, 0x00FF00)

GUICtrlSetBkColor($B_Forward, 0x000000)
GUICtrlSetColor($B_Forward, 0x00FF00)

GUICtrlSetBkColor($B_Go, 0x000000)
GUICtrlSetColor($B_Go, 0x00FF00)

GUICtrlSetBkColor($B_Refresh, 0x000000)
GUICtrlSetColor($B_Refresh, 0x00FF00)

GUICtrlSetBkColor($B_Background, 0x000000)
GUICtrlSetColor($B_Background, 0x00FF00)

GUICtrlSetBkColor($I_Time, 0x000000)
GUICtrlSetColor($I_Time, 0x00FF00)




$SinkObject = ObjEvent($E_Browser, "IEEvent_")

_IENavigate($E_Browser, $Home)

While 1
    Sleep(10)   
    $TitleGet = _IEPropertyGet($E_Browser, "Title")
    $Title = WinGetTitle($Window)
    
    ;///////////////////////////Date//////////////////////////////
    If @MON = 1 Then
        $Mon = "January"
    ElseIf @MON = 2 Then
        $Mon = "February"
    ElseIf @MON = 3 Then
        $Mon = "March"
    ElseIf @MON = 4 Then
        $Mon = "April"
    ElseIf @MON = 5 Then
        $Mon = "May"
    ElseIf @MON = 6 Then
        $Mon = "June"
    ElseIf @MON = 7 Then
        $Mon = "July"
    ElseIf @MON = 8 Then
        $Mon = "August"
    ElseIf @MON = 9 Then
        $Mon = "September"
    ElseIf @MON = 10 Then
        $Mon = "October"
    ElseIf @MON = 11 Then
        $Mon = "November"
    ElseIf @MON = 12 Then
        $Mon = "December"
    EndIf
    ;///////////////////////////EndDate///////////////////////////
    
    If @HOUR >= 12 Then
        $AM_PM = "PM"
    ElseIf @HOUR < 12 Then
        $AM_PM = "AM"
    EndIf
    
    If @HOUR = 00 Then
        $Hour = 12
    EndIf
    
    If $TitleGet1 <> $TitleGet Then
        _WinAPI_SetWindowText($Window, $TitleGet & " - Rocket Browser v1.0 by Donald Whitten.")
        $TitleGet1 = $TitleGet
    EndIf
    
    If $Minute <> @MIN Then
        $Minute = @MIN
    If @HOUR > 12 Then
        GUICtrlSetData($I_Time, "Time: " & @HOUR - 12 & ":" & @MIN & " " & $AM_PM & " / " & $Mon & " " & @MDAY & ", " & @YEAR)
    Else
        GUICtrlSetData($I_Time, "Time: " & @HOUR & ":" & @MIN & " " & $AM_PM & " / " & $Mon & " " & @MDAY & ", " & @YEAR)
    EndIf
EndIf
    
    $cURL = _IEPropertyGet($E_Browser, "locationurl")
    $cURL1 = GUICtrlRead($I_URL)
    
    If $cURL2 <> $cURL Then
        GUICtrlSetData($I_URL, $cURL)
        $cURL2 = $cURL
    EndIf

    HotKeySet("{F5}", "_Refresh")

    $msg = GUIGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        Exit
    Case $msg = $F_Exit
        Exit
    Case $msg = $F_SavePage
        _IEAction($E_Browser, "SaveAs")
    Case $msg = $T_His
        RunWait ( 'RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 2', @ScriptDir, @SW_HIDE )
        RunWait ( 'RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 1', @ScriptDir, @SW_HIDE )
    Case $msg = $Fa_FB
        _IENavigate($E_Browser, "Facebook.com")
    Case $msg = $Fa_K
        _IENavigate($E_Browser, "Kongregate.com")
    Case $msg = $Fa_W
        _IENavigate($E_Browser, "Wikipedia.org")
    Case $msg = $Fa_Y
        _IENavigate($E_Browser, "Youtube.com")
    Case $msg = $H_Info
        MsgBox(64, "Information", "Creator: Donald Whitten (Donald8274 and Donald8282)." & @CRLF & "This is a freeware product licensed to: " & @UserName & "." & @CRLF & "This product is not intended to be sold.")
    Case $msg = $GUI_EVENT_MAXIMIZE
        GUICtrlSetResizing($Browser, 1)
        GUICtrlSetResizing($Background, 1)
    Case $msg = $T_Pass
        $PassCreate = InputBox("Password Creator", "Insert a random word to make a random password" & @CRLF & "Password will be on your clipboard (It will be copied so you can just paste it)")
        $Encrypt = _StringEncrypt(1, $PassCreate, "Muff1nz", 1)
        ClipPut($Encrypt)
        MsgBox(0, "Password Creator", "Password created: " & $Encrypt)
    Case $msg = $B_Go
        $URL = GUICtrlRead($I_URL)
        _IENavigate($E_Browser, $URL)
    Case $msg = $B_Home
        _IENavigate($E_Browser, $Home)
    Case $msg = $B_Refresh
        _IEAction($E_Browser, "Refresh")
    Case $msg = $B_Back
        _IEAction($E_Browser, "Back")
    Case $msg = $B_Forward
        _IEAction($E_Browser, "Forward")
    Case $msg = $B_Background
        $Picture = FileOpenDialog("Select a picture...", "C:\Users\Owner\Pictures\Logitech Webcam", "Images (*.jpg;*.bmp)", 1)
        If $Picture <> "" Then
            GUICtrlSetImage($Background, $picture)
            GUICtrlSetState($Browser, $GUI_HIDE)
            GUICtrlSetState($Browser, $GUI_SHOW)
        Else
        EndIf
    EndSelect
WEnd


Func _Refresh()
    _IEAction($E_Browser, "Refresh")
EndFunc

Func IEEvent_ProgressChange($Progress, $ProgressMax)
    $percent = Int(($Progress * 100) / $ProgressMax)
    If $percent >= 0 And $percent <= 100 Then GUICtrlSetData($P_Progress, $percent)
EndFunc   ;==>IEEvent_ProgressChange

Share this post


Link to post
Share on other sites



Depending on your OS version, there is a Favourite folder in your user folder.

If you create a shortcut there for a website, it will be shown in your favourite list. To have a folder in your Favourite? simple, just create a new folder inside your Favourite folder .... damn so many "folders" in this sentence.

It's just a matter of creating files and folders at the right place.


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites

hi donald,

As for creating a favs menu by reading/writing to an ini, try this and adapt accordingly:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Array.au3>

$ini = @ScriptDir & "\myBrowserSettings.ini"
If Not FileExists($ini) Then
    IniWrite($ini, "favorites", "Google", "http://www.google.com")
    IniWrite($ini, "favorites", "Facebook", "http://www.facebook.com")
EndIf

Dim $myFavsMenu[1] ;Array to hold favorite controls
$myFavsMenu[0] = 0 ;This will hold a count

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Demo 1", 468, 234, 219, 150)
$MenuItem1 = GUICtrlCreateMenu("Favorites")
$var = IniReadSection($ini, "favorites")
If @error Then
    MsgBox(4096, "", "Error occurred, probably no INI file.")
Else
    For $i = 1 To $var[0][0]
        $thisFav = GUICtrlCreateMenuItem($var[$i][0], $MenuItem1)
        _ArrayAdd($myFavsMenu, $thisFav)
        $myFavsMenu[0] += 1
    Next
EndIf

GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
    For $i = 1 To $myFavsMenu[0]
        If $nMsg = $myFavsMenu[$i] Then
            ShellExecute($var[$i][1])
        EndIf
    Next
WEnd

As for advice, the random password isn't really random, perhaps you can implement the random function in your own function, for example

Func _randStr($len)
    $mypasschars = "abcdefghijklmnopqrstuvwxyz0123456789_"
    $charArr = StringSplit($mypasschars, "")
    Local $str = ""
    For $i = 1 To $len
        $str &= $charArr[(Random(1, $charArr[0], 1))]
    Next
    Return $str
EndFunc   ;==>_randStr

MsgBox(64, "Random string", _randStr(8))

Hope this helps.

-smartee

Share this post


Link to post
Share on other sites

Smartee, Thanks a lot for helping me out with that =D It works perfectly now! Also, thanks for the heads up about the random password creator =].

Share this post


Link to post
Share on other sites

I just tested a part that I thought would be vital to it and it's acting up a little. I added this to the end...

Code:

Func _Favorite()
    $FavName = InputBox("Favorite", "Create Favorite Name", $cURL)
    IniWrite($Favorites, "Favorites", $FavName, $cURL)
    
    $var = IniReadSection($Favorites, "favorites")
If @error Then
Else
    For $i = 1 To $var[0][0]
        $thisFav = GUICtrlCreateMenuItem($var[$i][0], $M_Fav)
        _ArrayAdd($myFavsMenu, $thisFav)
        $myFavsMenu[0] += 1
    Next
EndIf
EndFunc

I made this part just so it would update the list but it makes everything twice and one of the new one. Can you help me with this part? When I close out and come back everything is fine and they all work.

Share this post


Link to post
Share on other sites

Glad i could help, also i noticed at the top of your script, you used this piece of code to get the month names:

$Mon = ""

If @MON = 1 Then
    $Mon = "January"
ElseIf @MON = 2 Then
    $Mon = "February"
ElseIf @MON = 3 Then
    $Mon = "March"
ElseIf @MON = 4 Then
    $Mon = "April"
ElseIf @MON = 5 Then
    $Mon = "May"
ElseIf @MON = 6 Then
    $Mon = "June"
ElseIf @MON = 7 Then
    $Mon = "July"
ElseIf @MON = 8 Then
    $Mon = "August"
ElseIf @MON = 9 Then
    $Mon = "September"
ElseIf @MON = 10 Then
    $Mon = "October"
ElseIf @MON = 11 Then
    $Mon = "November"
ElseIf @MON = 12 Then
    $Mon = "December"
EndIf

You may want to take a look at the _DateToMonth() function in the helpfile, here is an example (from the helpfile):

#include <Date.au3>

; Retrieve the long name
$sLongMonthName = _DateToMonth(@MON)

; Retrieve the abbreviated name
$sShortMonthName = _DateToMonth(@MON, 1)

MsgBox(4096, "Month of Year", "The month is: " & $sLongMonthName & " (" & $sShortMonthName & ")")

As I look into your code in more detail, I will try to give you more tips :unsure: Good luck.

-smartee

Share this post


Link to post
Share on other sites

Glad i could help, also i noticed at the top of your script, you used this piece of code to get the month names:

$Mon = ""

If @MON = 1 Then
    $Mon = "January"
ElseIf @MON = 2 Then
    $Mon = "February"
ElseIf @MON = 3 Then
    $Mon = "March"
ElseIf @MON = 4 Then
    $Mon = "April"
ElseIf @MON = 5 Then
    $Mon = "May"
ElseIf @MON = 6 Then
    $Mon = "June"
ElseIf @MON = 7 Then
    $Mon = "July"
ElseIf @MON = 8 Then
    $Mon = "August"
ElseIf @MON = 9 Then
    $Mon = "September"
ElseIf @MON = 10 Then
    $Mon = "October"
ElseIf @MON = 11 Then
    $Mon = "November"
ElseIf @MON = 12 Then
    $Mon = "December"
EndIf

You may want to take a look at the _DateToMonth() function in the helpfile, here is an example (from the helpfile):

#include <Date.au3>

; Retrieve the long name
$sLongMonthName = _DateToMonth(@MON)

; Retrieve the abbreviated name
$sShortMonthName = _DateToMonth(@MON, 1)

MsgBox(4096, "Month of Year", "The month is: " & $sLongMonthName & " (" & $sShortMonthName & ")")

As I look into your code in more detail, I will try to give you more tips :unsure: Good luck.

-smartee

=D Thank you a lot =] I really need to clean up this code / make it more efficiant. I think it's pretty efficiant right now but still needs work.

Share this post


Link to post
Share on other sites

I just tested a part that I thought would be vital to it and it's acting up a little. I added this to the end...

Code:

Func _Favorite()
    $FavName = InputBox("Favorite", "Create Favorite Name", $cURL)
    IniWrite($Favorites, "Favorites", $FavName, $cURL)
    
    $var = IniReadSection($Favorites, "favorites")
If @error Then
Else
    For $i = 1 To $var[0][0]
        $thisFav = GUICtrlCreateMenuItem($var[$i][0], $M_Fav)
        _ArrayAdd($myFavsMenu, $thisFav)
        $myFavsMenu[0] += 1
    Next
EndIf
EndFunc

I made this part just so it would update the list but it makes everything twice and one of the new one. Can you help me with this part? When I close out and come back everything is fine and they all work.

Hi again donald, rather than repopulating the entire array then deleting all the menu items and creating them again, wont it be easier to just add/delete to the array and menu (on a per item basis) when your program adds/deletes from the ini?

-smartee

Share this post


Link to post
Share on other sites

It took me a minute to figure it out =P

Func _Favorite()
    $FavName = InputBox("Favorite", "Create Favorite Name", $cURL)
    If @error = 1 Then
    Else
    IniWrite($Favorites, "Favorites", $FavName, $cURL)
    
    $var = IniReadSection($Favorites, "favorites")
    If @error Then
    Else
            $thisFav = GUICtrlCreateMenuItem($FavName, $M_Fav)
            _ArrayAdd($myFavsMenu, $thisFav)
            $myFavsMenu[0] += 1
    EndIf
EndIf
EndFunc

Share this post


Link to post
Share on other sites

hi again again donald :unsure:,

Was just thinking about the array searching etc involved and realized that it may actually be simpler to just repopulate the array indeed, so here is one way you can do it

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Array.au3>

$ini = @ScriptDir & "\myBrowserSettings.ini"
If Not FileExists($ini) Then
    IniWrite($ini, "favorites", "Google", "http://www.google.com")
    IniWrite($ini, "favorites", "Facebook", "http://www.facebook.com")
EndIf

Dim $myFavsMenu[1] ;Array to hold favorite controls
$myFavsMenu[0] = 0 ;This will hold a count

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Demo 2 - with add Favorite", 468, 234, 219, 150)
$MenuItem1 = GUICtrlCreateMenu("Favorites")
$addNewFav = GUICtrlCreateMenuItem("Add new favorite", $MenuItem1)
$separator = GUICtrlCreateMenuItem("", $MenuItem1)

$var = IniReadSection($ini, "favorites")
If @error Then
    MsgBox(4096, "", "Error occurred, probably no INI file.")
Else
    For $i = 1 To $var[0][0]
        $thisFav = GUICtrlCreateMenuItem($var[$i][0], $MenuItem1)
        _ArrayAdd($myFavsMenu, $thisFav)
        $myFavsMenu[0] += 1
    Next
EndIf

GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $addNewFav
            $FavURL = InputBox("Favorite", "What is the url", "http://www.gmail.com")
            _addFavorite($FavURL)
    EndSwitch
    For $i = 1 To $myFavsMenu[0]
        If $nMsg = $myFavsMenu[$i] Then
            ShellExecute($var[$i][1])
        EndIf
    Next
WEnd

Func _addFavorite($cURL)
    $FavName = InputBox("Favorite", "Create Favorite Name", $cURL)
    IniWrite($ini, "Favorites", $FavName, $cURL)

    For $i = 1 To $myFavsMenu[0]
        GUICtrlDelete($myFavsMenu[$i])
    Next

    Dim $myFavsMenu[1]
    $myFavsMenu[0] = 0

    $var = IniReadSection($ini, "favorites")
    If @error Then
    Else
        For $i = 1 To $var[0][0]
            $thisFav = GUICtrlCreateMenuItem($var[$i][0], $MenuItem1)
            _ArrayAdd($myFavsMenu, $thisFav)
            $myFavsMenu[0] += 1
        Next
    EndIf
EndFunc   ;==>_addFavorite

Hope this simplifies things a bit :>

-smartee

Share this post


Link to post
Share on other sites

It took me a minute to figure it out =P

Func _Favorite()
    $FavName = InputBox("Favorite", "Create Favorite Name", $cURL)
    If @error = 1 Then
    Else
    IniWrite($Favorites, "Favorites", $FavName, $cURL)
    
    $var = IniReadSection($Favorites, "favorites")
    If @error Then
    Else
            $thisFav = GUICtrlCreateMenuItem($FavName, $M_Fav)
            _ArrayAdd($myFavsMenu, $thisFav)
            $myFavsMenu[0] += 1
    EndIf
EndIf
EndFunc

Yup, looks about right, however, for a delete, a per item basis approach might not be the best bet, so check my implementation of the add favorite function, it can easier be adapted for a delete function too. Also if a new favorite is added that shares its name with an already existing one, I assume only your version of the function will add another (perhaps bogus) menu item that doesn't show up the next time your program is run, although both our functions would overwrite the old one. By repopulating the array, like my version did, in that situation, this (likely unwanted) outcome is avoided.

-smartee

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

Ah, ok. thanks =D Keep looking for more ways to help me make the code compact please =] I am learning alot from this =D

Also, thanks for the date part again. That saved a lot of space.

Edited by Donald8282

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

Is there any way to get the time code shorter?

Code:

If @HOUR >= 12 Then
        $AM_PM = "PM"
    ElseIf @HOUR < 12 Then
        $AM_PM = "AM"
    EndIf
    
    If @HOUR = 00 Then
        $Hour = 12
    EndIf
Edited by Donald8282

Share this post


Link to post
Share on other sites

hi again,

try replacing this chunk

GUICtrlSetResizing($Browser, 1)
GUICtrlSetResizing($Background, 1)
GUICtrlSetResizing($B_Home, 1)
GUICtrlSetResizing($B_Back, 1)
GUICtrlSetResizing($B_Forward, 1)
GUICtrlSetResizing($I_URL, 1)
GUICtrlSetResizing($B_Go, 1)
GUICtrlSetResizing($B_Refresh, 1)
GUICtrlSetResizing($I_Time, 1)
GUICtrlSetResizing($B_Background, 1)
GUICtrlSetResizing($P_Progress, 1)

GUICtrlSetBkColor($I_URL, 0x000000)
GUICtrlSetColor($I_URL, 0x00FF00)

GUICtrlSetBkColor($B_Home, 0x000000)
GUICtrlSetColor($B_Home, 0x00FF00)

GUICtrlSetBkColor($B_Back, 0x000000)
GUICtrlSetColor($B_Back, 0x00FF00)

GUICtrlSetBkColor($B_Forward, 0x000000)
GUICtrlSetColor($B_Forward, 0x00FF00)

GUICtrlSetBkColor($B_Go, 0x000000)
GUICtrlSetColor($B_Go, 0x00FF00)

GUICtrlSetBkColor($B_Refresh, 0x000000)
GUICtrlSetColor($B_Refresh, 0x00FF00)

GUICtrlSetBkColor($B_Background, 0x000000)
GUICtrlSetColor($B_Background, 0x00FF00)

GUICtrlSetBkColor($I_Time, 0x000000)
GUICtrlSetColor($I_Time, 0x00FF00)
with this bit:
For $i = $B_Home To $P_Progress
    GUICtrlSetResizing($i, 1)
    GUICtrlSetBkColor($i, 0x000000)
    GUICtrlSetColor($i, 0x00FF00)
Next

:unsure:

-smartee

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

Actually yup, play around with the date/time functions :unsure:

#include <Date.au3>
$now = _NowCalc()
MsgBox(64, "Long Time & Date", _DateTimeFormat($now, 1) & " " & _DateTimeFormat($now, 3))

Is there a way to make it so the seconds don't show up? I know I can update it by the minutes and have seconds at 00 but I'd rather just have the hour / minute. Thanks again for all your help =) Edited by Donald8282

Share this post


Link to post
Share on other sites

hi again,

try replacing this chunk

GUICtrlSetResizing($Browser, 1)
GUICtrlSetResizing($Background, 1)
GUICtrlSetResizing($B_Home, 1)
GUICtrlSetResizing($B_Back, 1)
GUICtrlSetResizing($B_Forward, 1)
GUICtrlSetResizing($I_URL, 1)
GUICtrlSetResizing($B_Go, 1)
GUICtrlSetResizing($B_Refresh, 1)
GUICtrlSetResizing($I_Time, 1)
GUICtrlSetResizing($B_Background, 1)
GUICtrlSetResizing($P_Progress, 1)

GUICtrlSetBkColor($I_URL, 0x000000)
GUICtrlSetColor($I_URL, 0x00FF00)

GUICtrlSetBkColor($B_Home, 0x000000)
GUICtrlSetColor($B_Home, 0x00FF00)

GUICtrlSetBkColor($B_Back, 0x000000)
GUICtrlSetColor($B_Back, 0x00FF00)

GUICtrlSetBkColor($B_Forward, 0x000000)
GUICtrlSetColor($B_Forward, 0x00FF00)

GUICtrlSetBkColor($B_Go, 0x000000)
GUICtrlSetColor($B_Go, 0x00FF00)

GUICtrlSetBkColor($B_Refresh, 0x000000)
GUICtrlSetColor($B_Refresh, 0x00FF00)

GUICtrlSetBkColor($B_Background, 0x000000)
GUICtrlSetColor($B_Background, 0x00FF00)

GUICtrlSetBkColor($I_Time, 0x000000)
GUICtrlSetColor($I_Time, 0x00FF00)
with this bit:
For $i = $B_Home To $P_Progress
    GUICtrlSetResizing($i, 1)
    GUICtrlSetBkColor($i, 0x000000)
    GUICtrlSetColor($i, 0x00FF00)
Next

:unsure:

-smartee

O_o I never knew you could use "For" that way. That will definatly come in handy. Thanks =D

Share this post


Link to post
Share on other sites

#18 ·  Posted (edited)

Ok, I cleaned up the code a little bit and remembered this malfunction. When I press "Home" It goes to the home page but when I try to go to another website by typing into the URL bar when I press "Enter" it goes to the home page. I'm pretty sure it's because "Home" Is still selected. How can I make it so "Go" is selected again afterwards? I know there's a function for it but I'm not sure what the name is. Thanks for any help - Donald8282

Edited by Donald8282

Share this post


Link to post
Share on other sites

Hey,

Looking for something like this perhaps?

GUICtrlSetState($B_Go, $GUI_FOCUS)

Happy coding.

-smartee

Share this post


Link to post
Share on other sites

I literally just found that right before I looked here again XD I was thinking "GUICtrlSet.... STATE!"

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  
Followers 0