Sign in to follow this  
Followers 0
JavaScript_Freek

Combo Box URL

6 posts in this topic

How would you go about?

Where you go down a drop down box and once you click a option, it would go to a specified URL?


[center]Cookyx.com :: Simple LAN Chat[/center]

Share this post


Link to post
Share on other sites



maybe...

#include <GUIConstants.au3>

$home = "http://www.autoitscript.com/"
$forum = "http://www.autoitscript.com/forum/index.php?"

GUICreate("My GUI combo")  ; will create a dialog box that when displayed is centered

$combo = GUICtrlCreateCombo ("", 10,10) ; create first item
GUICtrlSetData(-1,"Autoit Home|Autoit Forums","Autoit Home") ; add other item snd set a new default

GUISetState ()

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    
    If $msg = $combo Then
        If StringInStr(GUICtrlRead($combo), "Home") Then
            Run(@ComSpec & " /c Start " & $home, "", @SW_HIDE)
        Else
            Run(@ComSpec & " /c Start " & $forum, "", @SW_HIDE)
        EndIf
    EndIf
    
Wend

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Thanks :whistle:

;***********************
; ZetaBase
; Coded by: Dan
; August 8, 2006
; Special Thanks to: keen for graphics!
;***********************

#include <GUIConstants.au3>
#include <GuiListView.au3>
FileWrite("c:/blank.txt", "")
Global $oRP

$name = InputBox("Log In", "Please enter your name:")

; GUI
GUICreate("ZetaBase", 400, 400)
GUISetIcon("C:\Program Files\AutoIt3\beta\Icons\au3.ico", 0)
$TagsPageC = GUICtrlCreateLabel('Visit ZetaStyles', 1, 293, 200, 20, $SS_CENTER)
GUICtrlSetFont($TagsPageC, 9, 400, 4)
GUICtrlSetColor($TagsPageC, 0x0000ff)

; BANNER
$s_TempFile = _TempFile()
InetGet("http://i37.photobucket.com/albums/e91/Zombie1992/logo4.gif", $s_TempFile)
GUICtrlCreatePic($s_TempFile, 0, 0, 400, 67)

; TEXT
GUICtrlCreateLabel("Sample Label ", 10, 275, 389,20)
$label = GUICtrlCreateLabel("Logged in as: " & $name, 150, 75, 400, 14)
;GUICtrlSetStyle (-1, $SS_RIGHT )

; MENU
$filemenu = GUICtrlCreateMenu("File")
$fileitem = GUICtrlCreateMenuitem("Open...", $filemenu)
$recentfilesmenu = GUICtrlCreateMenu("Recent Files", $filemenu)
$separator1 = GUICtrlCreateMenuitem("", $filemenu)
$exititem = GUICtrlCreateMenuitem("Exit", $filemenu)
$helpmenu = GUICtrlCreateMenu("About")
$aboutitem = GUICtrlCreateMenuitem("About ZetaBase", $helpmenu)
GUISetState(@SW_Show)

; TAB
GUICtrlCreateTab(1, 70, 400, 190)
$tab1 = GUICtrlCreateTabItem("Welcome")
GUICtrlCreateLabel("Welcome to ZetaBase." & @CRLF & " " & @CRLF & "This project was started by keen and coded by Dan of www.zetastyles.com. This is ZetaBase. A program to show you the best of the best of what ZetaStyles has to offer. This program has ZS Best Skins, ZS Document Database, GFX Tutorial Database, and Website Template Database!",20, 120, 375, 100)
GUICtrlCreateTabItem("Pro Skins")
$combo = GUICtrlCreateCombo ("", 10,10) ; create first item
GUICtrlSetData(-1,"Autoit Home|Autoit Forums","Autoit Home") ; add other item snd set a new default
GUICtrlCreateTabItem("Documents")
GUICtrlCreateTabItem("Tutorials")
GUICtrlCreateTabItem("Website Templates")
; GUI MESSAGE        LOOP

GUICtrlCreateTabItem("")  ; end tabitem definition
GUICtrlSetState($tab1, $GUI_SHOW)  ; will be display first

GUISetState()

While 1
    $msg = GUIGetMsg()
   
    Select
        Case $msg = $fileitem
            $file = FileOpenDialog("Choose file...", @TempDir, "All (*.*)")
            If @error <> 1 Then GUICtrlCreateMenuitem($file, $recentfilesmenu)
            While 1
    $msg = GUIGetMsg()
    If $msg = $combo Then
        If StringInStr(GUICtrlRead($combo), "Home") Then
            Run(@ComSpec & " /c Start " & $home, "", @SW_HIDE)
        Else
            Run(@ComSpec & " /c Start " & $forum, "", @SW_HIDE)
            Case $msg = $TagsPageC
            Run(@ComSpec & ' /c start http://www.zetastyles.com', '', @SW_HIDE)
        Case $msg = $aboutitem
            MsgBox(0, "About ZetaBase", "ZetaBase" & @CRLF & @CRLF & "Created by: keen" & @CRLF & "" & @CRLF & "Coded by: Dan" & @CRLF & "" & @CRLF & "©Copyrighted to repective owners")
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
    EndSelect
WEnd

Not working =\

Edited by JavaScript_Freek

[center]Cookyx.com :: Simple LAN Chat[/center]

Share this post


Link to post
Share on other sites

if you don't use SciTE I would suggest you start, it would help greatly in writing/debugging code.

fixed some of your stuff not all.

;***********************
; ZetaBase
; Coded by: Dan
; August 8, 2006
; Special Thanks to: keen for graphics!
;***********************

#include <GUIConstants.au3>
#include <GuiListView.au3>
#include <File.au3>

FileWrite("c:/blank.txt", "")
Global $oRP
$home = "http://www.Autoitscript.com"
$forum = "http://www.Autoitscript.com/forum"
$name = InputBox("Log In", "Please enter your name:")

; GUI
GUICreate("ZetaBase", 400, 400)
GUISetIcon("C:\Program Files\AutoIt3\beta\Icons\au3.ico", 0)
$TagsPageC = GUICtrlCreateLabel('Visit ZetaStyles', 1, 293, 200, 20, $SS_CENTER)
GUICtrlSetFont($TagsPageC, 9, 400, 4)
GUICtrlSetColor($TagsPageC, 0x0000ff)

; BANNER
$s_TempFile = _TempFile()
InetGet("http://i37.photobucket.com/albums/e91/Zombie1992/logo4.gif", $s_TempFile)
GUICtrlCreatePic($s_TempFile, 0, 0, 400, 67)

; TEXT
GUICtrlCreateLabel("Sample Label ", 10, 275, 389, 20)
$label = GUICtrlCreateLabel("Logged in as: " & $name, 150, 75, 400, 14)
;GUICtrlSetStyle (-1, $SS_RIGHT )

; MENU
$filemenu = GUICtrlCreateMenu("File")
$fileitem = GUICtrlCreateMenuitem("Open...", $filemenu)
$recentfilesmenu = GUICtrlCreateMenu("Recent Files", $filemenu)
$separator1 = GUICtrlCreateMenuitem("", $filemenu)
$exititem = GUICtrlCreateMenuitem("Exit", $filemenu)
$helpmenu = GUICtrlCreateMenu("About")
$aboutitem = GUICtrlCreateMenuitem("About ZetaBase", $helpmenu)
GUISetState(@SW_SHOW)

; TAB
GUICtrlCreateTab(1, 70, 400, 190)
$tab1 = GUICtrlCreateTabItem("Welcome")
GUICtrlCreateLabel("Welcome to ZetaBase." & @CRLF & " " & @CRLF & "This project was started by keen and coded by Dan of www.zetastyles.com. This is ZetaBase. A program to show you the best of the best of what ZetaStyles has to offer. This program has ZS Best Skins, ZS Document Database, GFX Tutorial Database, and Website Template Database!", 20, 120, 375, 100)
GUICtrlCreateTabItem("Pro Skins")
$combo = GUICtrlCreateCombo("", 10, 100) ; create first item
GUICtrlSetData(-1, "Autoit Home|Autoit Forums", "Autoit Home") ; add other item snd set a new default
GUICtrlCreateTabItem("Documents")
GUICtrlCreateTabItem("Tutorials")
GUICtrlCreateTabItem("Website Templates")
; GUI MESSAGE        LOOP

GUICtrlCreateTabItem("")  ; end tabitem definition
GUICtrlSetState($tab1, $GUI_SHOW)  ; will be display first

GUISetState()

While 1
    $msg = GUIGetMsg()
    
    Select
        Case $msg = $fileitem
            $file = FileOpenDialog("Choose file...", @TempDir, "All (*.*)")
            If @error <> 1 Then GUICtrlCreateMenuitem($file, $recentfilesmenu)
        Case $msg = $combo
            If StringInStr(GUICtrlRead($combo), "Home") Then
                Run(@ComSpec & " /c Start explorer " & $home, "", @SW_HIDE)
            Else
                Run(@ComSpec & " /c Start explorer " & $forum, "", @SW_HIDE)
            EndIf
        Case $msg = $TagsPageC
            Run(@ComSpec & ' /c start explorer http://www.zetastyles.com', '', @SW_HIDE)
        Case $msg = $aboutitem
            MsgBox(0, "About ZetaBase", "ZetaBase" & @CRLF & @CRLF & "Created by: keen" & @CRLF & "" & @CRLF & "Coded by: Dan" & @CRLF & "" & @CRLF & "©Copyrighted to repective owners")
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
    EndSelect
WEnd

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Run(@ComSpec & ' /c start http://www.zetastyles.com', '', @SW_HIDE)

runs the default web browser

Run(@ComSpec & ' /c start explorer http://www.zetastyles.com', '', @SW_HIDE)

Runs explorer

8)

true, it runs the default browser if nothing is wrong, haven't looked into it yet, but I have 2 systems the 1st won't work on. At one time it did, but then after some of the XP patches it quit.

Edit: Using ShellExecute I'm able to narrow it down to access denied, so I must have some setting set that won't let me run it that way. One of these days I'll figure it out.

Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

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