2011-06-29 71 views
0

我在AutoIT中爲我們製作的這個程序製作了一個按鈕,我們將其稱爲$ okmystery,並且我想要$ okmystery喜歡到我公司的網站。下面是代碼片段我到目前爲止有:Button =網站鏈接在AutoIT

Dim $msg 
GUISetState() 
    While 1 
     $msg = GUIGetMsg() 
     Select 
      Case $msg = $GUI_EVENT_CLOSE 
       ExitLoop 
      Case $msg = $okbutton 
       ; Minimize Current Window 
       WinSetState($WINTITLE, "", @SW_MINIMIZE) 
       While Not BitAND(WinGetState($WINTITLE, ""), 16) 
        sleep(250) 
       WEnd 

       ; Take Screen Shots and Logs 
       ScreenShotAndLogs() 

       ; Compress Artifacts 
       If FileExists($ZIPFILEPATH) Then FileDelete($ZIPFILEPATH) 
       _Zip_Create($ZIPFILEPATH) 
       _Zip_AddFolderContents($ZIPFILEPATH, $OUTPUTROOT) 
       DeleteOriginals() 

       ; Restore main window 
       WinSetState($WINTITLE, "", @SW_RESTORE) 
      ;------------ Screen Shot 
      Case $msg = $okshot 
       ; Minimize Current Window 
       WinSetState($WINTITLE, "", @SW_MINIMIZE) 
       While Not BitAND(WinGetState($WINTITLE, ""), 16) 
        sleep(250) 
       WEnd 

       ScreenShot() 

       ; Restore main window 
       WinSetState($WINTITLE, "", @SW_RESTORE) 
       ;---------------------------------- 
      $okmystery = ShellExecute ("basic") 
       Run("Http://www.IT-Networks.org") 

      Case Default 
       ; Do Nothing 
     EndSelect 
    WEnd 
Exit(0) 

回答

0

看起來你需要改變「$ okmystery」 case語句來匹配其他case語句(如果這些都是那樣工作,他們應該至)。

然後您可以嘗試ShellExecute()的網址。

Case $msg = $okmystery 
    ShellExecute("Http://www.IT-Networks.org") 

這裏有一個按鈕的GUI的工作例如打開你的公司網站在默認Web瀏覽器:

#include <GUIConstantsEx.au3> 

Global $Button_1, $msg 

GUICreate("Test GUI Button") 
$okmystery = GUICtrlCreateButton("okmystery Button", 10, 30, 100) 

GUISetState() 

While 1 
    $msg = GUIGetMsg() 
    Select 
     Case $msg = $GUI_EVENT_CLOSE 
      ExitLoop 
     Case $msg = $okmystery 
      ShellExecute("Http://www.IT-Networks.org") 
    EndSelect 
WEnd