Sign in to follow this  
Followers 0
Bert

Run A Url?

6 posts in this topic

I have a url that I want ran if the user does something. I want to allow for the user to have either IE or Firefox, or what ever web browser they choose to have as their default. I tried Run("AutoIt Forums.url",""), but of course it didn't work. Yes, that is the URL I want to goto when they click the button. Its for the SciTE toolbar. I wanted to have a button that would open a web browser to the forum. It will be part of the options GUI I'm making for it.

Share this post


Link to post
Share on other sites



I have a url that I want ran if the user does something. I want to allow for the user to have either IE or Firefox, or what ever web browser they choose to have as their default. I tried Run("AutoIt Forums.url",""), but of course it didn't work. Yes, that is the URL I want to goto when they click the button. Its for the SciTE toolbar. I wanted to have a button that would open a web browser to the forum. It will be part of the options GUI I'm making for it.

I use this one, but there are others:
$Url = "http://AutoItScript.com"
DllCall("shell32.dll", "long", "ShellExecute", "hwnd", 0, "string", 'open', "string", $Url, "string", '', "string", @ScriptDir, "long", @SW_SHOWNORMAL)

[center]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.[/center]

Share this post


Link to post
Share on other sites

... hHAHAHH wooot thanks for that Smoke i realllly needed that

Share this post


Link to post
Share on other sites

i use this

$QT_web = "www.XPCleanMenu.HostRocket.com"

Run(@ComSpec & " /c Start " & $QT_web, "", @SW_HIDE)

and since you are still on the toolbar bit,

as for the scite toolbar, i use it all the time... with changes so i can call my script/text search/manager

#include<guiconstants.au3>
#include<misc.au3>
Run(@ProgramFilesDir & "\AutoIt3\SciTe\SciTe.exe")
Sleep(1000)

If _Singleton("SciTEAdditionalIcons", 1) = 0 Then
    Exit
EndIf

Opt("MouseCoordMode", 2)
;opt("trayiconhide", 1)
Opt("WinSearchChildren", 1)
Opt("WinTitleMatchMode", 4)
Global $WM_COPYDATA = 74
Global $SciTECmd
Global $last_SciTE_Pos_x = -99999
Global $last_SciTE_Pos_y = -99999
; Get SciTE DirectorHandle
$Scite_hwnd = WinGetHandle("DirectorExtension")
; Get My GUI Handle numeric
Global $My_Hwnd = GUICreate("SciTE interface", 550, 18, Default, Default, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
$Toolbar_Info = IniReadSection(@ScriptDir & "\SciteToolbar2.ini", "ToolBar")

Local $go[(UBound($Toolbar_Info))+ 7] 
Dim $godo[(UBound($Toolbar_Info))+ 7] 

_Adjust_Toolbar_Info($Toolbar_Info)
_CreateToolbar($go, $Toolbar_Info)

$My_Dec_Hwnd = Dec(StringTrimLeft($My_Hwnd, 2))
;Register COPYDATA message.
GUIRegisterMsg($WM_COPYDATA, "MY_WM_COPYDATA")
GUISetState()
;
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case Else
            If $msg > 1 Then 
            For $x = 0 To UBound($go) - 1
                If $msg = $go[$x] Then
                    If StringInStr($godo[$x], ".") Then
                    ;MsgBox(64,"Run initiated", "Now Running" & @CRLF & $godo[$x] & "   ", 1)
                        Run(FileGetShortName(@ScriptDir & "\" & $godo[$x]))
                        ExitLoop
                    Else
                        SendSciTE_Command($My_Hwnd, $Scite_hwnd, "menucommand:" & $godo[$x])
                    ;SendSciTE_Command($My_Hwnd, $Scite_hwnd, StringFormat("menucommand:11%02d", $x))
                        ExitLoop
                    EndIf
                EndIf
            Next
            EndIf
            Sleep(10)
    EndSelect
    
; set position of window correct
    If WinExists("classname=SciTEWindow") Then
        If WinActive("classname=SciTEWindow") Or WinActive($My_Hwnd) Then
            TraySetToolTip("SciTE active")
            For $x = 1 To UBound($Toolbar_Info) - 1
                If $Toolbar_Info[$x][0] <> "bar" Then GUICtrlSetTip($go[$Toolbar_Info[$x][0]],$Toolbar_Info[$x][2])
            Next
            $Scite_pos = WinGetPos("classname=SciTEWindow")
            If $Scite_pos[0] <> $last_SciTE_Pos_x Or $Scite_pos[1] <> $last_SciTE_Pos_y Then
                $last_SciTE_Pos_x = $Scite_pos[0]
                $last_SciTE_Pos_y = $Scite_pos[1]
                $w_size = WinGetClientSize("classname=SciTEWindow")
                WinMove($My_Hwnd, '', $Scite_pos[0] + 360, $Scite_pos[1] + ($Scite_pos[3] - $w_size[1]))
                WinSetState($My_Hwnd, '', @SW_SHOW)
            EndIf
        Else
            TraySetToolTip("SciTE not active")
            $last_SciTE_Pos_x = -9999
            $last_SciTE_Pos_y = -9999
            WinSetState($My_Hwnd, '', @SW_HIDE)
        EndIf
    Else
        Exit
    EndIf
    If WinActive($My_Hwnd) Then WinActivate("classname=SciTEWindow")
WEnd
Exit

Func _Adjust_Toolbar_Info(ByRef $Toolbar_Info)
    ReDim $Toolbar_Info[UBound($Toolbar_Info) - 1][4]
    Local $tmp_string
    For $x = 1 To UBound($Toolbar_Info) - 1
        If $Toolbar_Info[$x][0] <> "bar" Then
            $tmp_string = StringSplit($Toolbar_Info[$x][1], "|")
            $Toolbar_Info[$x][1] = $tmp_string[1]
            $Toolbar_Info[$x][2] = $tmp_string[2]
            $Toolbar_Info[$x][3] = $tmp_string[3]
        EndIf
    Next
EndFunc  ;==>_Adjust_Toolbar_Info

Func _CreateToolbar(ByRef $go, ByRef $Toolbar_Info)
    Local $bars = 0, $x, $y = 10, $bar
    For $x = 0 To UBound($go) - 1
        $go[$x] = -999
    Next
    For $x = 1 To UBound($Toolbar_Info) - 1
        If $Toolbar_Info[$x][0] = "bar" Then
            $bar = GUICtrlCreateGraphic($bars * 110, 1, 1, 16)
            GUICtrlSetBkColor($bar, 0xff0000)
            If $bars Then $y += 10
            $bars += 1
        Else
            $go[Number($Toolbar_Info[$x][0]) ] = GUICtrlCreateIcon(@ScriptDir & "\icons\" & $Toolbar_Info[$x][1], -1, $y, 1, 16, 16)
            GUICtrlSetTip($go[Number($Toolbar_Info[$x][0]) ], $Toolbar_Info[$x][2])
            $godo[Number($Toolbar_Info[$x][0])] = $Toolbar_Info[$x][3]
            $y += 25
        EndIf
    Next
EndFunc  ;==>_CreateToolbar
;
; Send command to SciTE
Func SendSciTE_Command($My_Hwnd, $Scite_hwnd, $sCmd)
    ConsoleWrite('-->' & $sCmd & @LF)
    Local $CmdStruct = DllStructCreate('Char[' & StringLen($sCmd) + 1 & ']')
    DllStructSetData($CmdStruct, 1, $sCmd)
    Local $COPYDATA = DllStructCreate('Ptr;DWord;Ptr')
    DllStructSetData($COPYDATA, 1, 1)
    DllStructSetData($COPYDATA, 2, StringLen($sCmd) + 1)
    DllStructSetData($COPYDATA, 3, DllStructGetPtr($CmdStruct))
    DllCall('User32.dll', 'None', 'SendMessage', 'HWnd', $Scite_hwnd, _
            'Int', $WM_COPYDATA, 'HWnd', $My_Hwnd, _
            'Ptr', DllStructGetPtr($COPYDATA))
EndFunc  ;==>SendSciTE_Command

; Received Data from SciTE
Func MY_WM_COPYDATA($hWnd, $msg, $wParam, $lParam)
    Local $COPYDATA = DllStructCreate('Ptr;DWord;Ptr', $lParam)
    $SciTECmdLen = DllStructGetData($COPYDATA, 2)
    Local $CmdStruct = DllStructCreate('Char[255]', DllStructGetData($COPYDATA, 3))
    $SciTECmd = StringLeft(DllStructGetData($CmdStruct, 1), $SciTECmdLen)
    ConsoleWrite('<--' & $SciTECmd & @LF)
;GUICtrlSetData($list,GUICtrlRead($list) & '<--' & $SciTECmd & @CRLF )
EndFunc  ;==>MY_WM_COPYDATA

and the ini

[ToolBar]
bar=
0=go.ico|Run with Beta|1100
1=toolbox.ico|Compile with CompileAU3.exe|1101
2=Book07.ico|Beta AutoIt Helpfile|1102
4=SafetyHelmet.ico|Syntax Check Beta|1104
bar=
5=FuncPopUp.ico|Function Popup|1105
6=Binoculars1c.ico|AutoIt Window Info|1106
7=SonyTRV99.ico|AU3Recorder|1107
8=Etchasketch.ico|Macro Generator|1108
bar=
9=tidy.ico|Tidy AutoIt Source|1109
10=Wizard.ico|Code Wizard|1110
11=CodelessDrill.ico|GUI Builder|1111
12=Crayons.ico|Koda(FormDesigner)|1112
bar=
23=NotePad.ico|Insert Bookmarked Line(s)|1123
24=IDBadge.ico|Debug to MsgBox|1124
25=Zvaiofu045.ico|Debug to Console|1125
26=Papertowels.ico|Debug Remove Lines|1126
bar=
13=au3.ico|Script/Text Manager|Script-Text-Manager.exe
bar=

i use it all the time

8)


NEWHeader1.png

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