按钮 = AutoIT 中的网站链接

发布于 2024-11-18 07:27:45 字数 1613 浏览 3 评论 0原文

我在 AutoIT 中为我们正在制作的这个程序制作了一个按钮,我们将其称为 $okmystery,我希望 $okmystery 喜欢我的公司网站。这是我到目前为止的代码片段:

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 )

I have made a button in AutoIT for this program we are making for work we will call it $okmystery and I want $okmystery to like to my company website. Here is a snippet of the code I have so far:

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 )

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

缺⑴份安定 2024-11-25 07:27:45

看起来您需要更改“$okmystery”case 语句以匹配其他 case 语句(如果这些语句都按预期工作)。

然后您可以尝试 ShellExecute() 该 url。

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

It looks like you need to change the "$okmystery" case statement to match the other case statements (if those are all working like they're supposed to).

You can then try to ShellExecute() the url.

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

Here's a working example of a GUI with a button that opens your company website in your default web browser:

#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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文