Cộng đồng AutoIT Việt - Autoitviet.forumvi.com
Chào mừng bạn đến với cộng đồng AutoIT Việt, hãy đăng ký một nick để cùng tham gia thảo luận nhé ^^!

Join the forum, it's quick and easy

Cộng đồng AutoIT Việt - Autoitviet.forumvi.com
Chào mừng bạn đến với cộng đồng AutoIT Việt, hãy đăng ký một nick để cùng tham gia thảo luận nhé ^^!
Cộng đồng AutoIT Việt - Autoitviet.forumvi.com
Bạn có muốn phản ứng với tin nhắn này? Vui lòng đăng ký diễn đàn trong một vài cú nhấp chuột hoặc đăng nhập để tiếp tục.
Latest topics
» [Code] Kiểm tra kết nối mạng
by jameseshell Fri Jul 31, 2015 3:29 pm

» AutoClick không chiếm chuột
by jameseshell Fri Jul 31, 2015 9:58 am

» [Sorf] Connect/Disconet Button
by thanhhan31 Fri Jun 26, 2015 3:56 am

» Giới thiệu ngôn ngữ lập trình Autoit
by vanhoa1402 Mon Jun 08, 2015 12:40 am

» [Code] Đếm ngược thời gian
by satoh290801 Sat Jun 06, 2015 10:11 am

» Debug game online
by cheater Mon Jun 01, 2015 3:15 pm

» [Thắc Mắc] cách nhập xuất dữ liệu
by cadilacst Mon Apr 27, 2015 7:14 am

» [Code] Auto Win 2c6f td1 - sv HN
by Hades Wed Jan 14, 2015 5:41 am

» [Hỏi] AutoIt với CSDL online?
by todzin Wed Nov 19, 2014 11:14 pm

» [Hỏi] Một số vấn đề về Copy & Paste file bằng ứng dụng thứ 3 (Everything.exe)
by aloatiso Tue Nov 11, 2014 10:31 pm

» Click theo điểm ảnh !
by nhatdaica055 Wed Oct 15, 2014 5:17 pm

» Nội quy diễn đàn
by lethusinh01 Fri Sep 12, 2014 3:59 am

» Hide Windows !!!
by Sweetsica Fri Aug 08, 2014 2:31 am

» Cài đặt , sử dụng và biên dịch Autoit
by mankichi Thu Jul 24, 2014 5:11 am

» Tuyển mod cho diễn đàn
by huynhlamid Fri Jan 17, 2014 3:36 pm

» PixelSearch - Quét (hay kiểm tra) điểm ảnh
by vanthang Fri Jan 17, 2014 5:49 am

» Thiệp Cực Đẹp Tặng Người Yêu !!!
by Nokia3G Mon Dec 23, 2013 12:50 pm

» Lấy đường dẫn của phần mềm chạy ngầm
by cuongkoken Sat Dec 21, 2013 1:25 am

» Xin Admin giup do
by xlove_bmt Wed Dec 18, 2013 6:40 am

» [Hỏi] Cần pro chỉ làm trainer game!
by quytucaca Wed May 29, 2013 7:43 am


[Code] Phím tắt mini

2 posters

Go down

[Code] Phím tắt mini Empty [Code] Phím tắt mini

Bài gửi by Admin Mon Dec 17, 2012 3:19 am

Code:
Opt("TrayMenuMode",1)
Opt("TrayOnEventMode",1)

$tt    = TrayCreateItem("Thông tin phím tắt - Shift + T")
TrayCreateItem("")
$tg    = TrayCreateItem("Tác giả - Shift + A")
TrayCreateItem("")
$thoat    = TrayCreateItem("Thoát - Esc")

TrayItemSetOnEvent ($tg, "tg" )
TrayItemSetOnEvent ($thoat, "exit1" )
trayItemSetOnEvent ($tt, "Info" )

        HotKeySet("+t","Info")
        HotKeySet("+a","tg")
        HotKeySet("{esc}","exit1")

        HotKeySet( "b","back")
        HotKeySet( "f","Forward")
        Hotkeyset( "r","Refresh")
        Hotkeyset( "s","stop")
        Hotkeyset( "h","home")
        Hotkeyset ("+s","Search")
        HotKeySet( "+f","Favorites")
        Hotkeyset( "m","mute")
        Hotkeyset( "d","Down")
        Hotkeyset( "u","up")
        Hotkeyset( "n","iNext")
        Hotkeyset( "p","iprev")
        Hotkeyset( "+d","istop")
        Hotkeyset( "+p","iplay_pause")
        Hotkeyset( "+m","imedia")
        Hotkeyset( "c","maytinh")
        Hotkeyset( "e","Computer")
        Hotkeyset( "w","wordpad")
        Hotkeyset( "+l","cmd")
        Hotkeyset( "+n","Notepad")
        Hotkeyset( "+c","clipboard")
        Hotkeyset( "!d","DisplayProperties")
        Hotkeyset( "!f","FoldersProperties")
        Hotkeyset( "!p","fonts")
        Hotkeyset( "!m","MouseProperties")
        Hotkeyset( "!n","MouseProperties")


While 1
    Sleep(5000)
WEnd

func exit1()
    Exit
EndFunc

Func tg()
    $text = "Chương trình phím tắt nhanh gọn" & @CRLF & _
"Tác giả: Nguyễn Đức Hải - xmenduchai@yahoo.com" & @CRLF & _
"Ngôn ngữ lập trình AutoIT"
TrayTip("Phím tắt Mini",$text,"",1)
EndFunc

Func Info()
MsgBox(0,"Thông tin phím tắt","Phím B - Thực hiện phím Back trong trình duyệt" & @CRLF & _
"Phím F - Thực hiện phím Forward trong trình duyệt" & @CRLF & _
"Phím R - Thực hiện phím Refresh trong trình duyệt" & @CRLF & _
"Phím S - Thực hiện phím Stop trong trình duyệt" & @CRLF & _
"Phím H - Thực hiện chức năng trở về trang chủ trong trình duyệt" & @CRLF & _
"Phím Shift + S - Thực hiện phím Search trong trình duyệt" & @CRLF & _
"Phím Shift + F - Thực hiện phím Favorites trong trình duyệt" & @CRLF & @CRLF & _
"Phím M - Thực hiện chức năng tắt âm lượng" & @CRLF & _
"Phím D - Thực hiện chức năng giảm âm lượng" & @CRLF & _
"Phím U - Thực hiện chức năng tăng âm lượng" & @CRLF &  _
"Phím N - Thực hiện chức năng chuyển bài tiếp theo" & @CRLF & _
"Phím P - Thực hiện chức năng chuyển về bài trước" & @CRLF  & @CRLF & _
"Phím Shift + D - Thực hiện chức năng dừng bài đang hát" & @CRLF & _
"Phím Shift + P - Thực hiện chức năng tạm dừng bài đang hát" & @CRLF & _
"Phím Shift + M - Thực hiện chức năng gọi trình nghe nhạc" & @CRLF & @CRLF & _
"Phím C - Gọi My Computer" & @CRLF & _
"Phím E - Gọi máy tính" & @CRLF & _
"Phím W - Gọi WordPad" & @CRLF & _
"Phím Shift + L - Gọi Command Prompt" & @CRLF & _
"Phím Shift + N - Gọi Notepad" & @CRLF & _
"Phím Shift + C - Gọi ClipBook Viewer" & @CRLF & _
"Phím Alt + D - Gọi Display Properties" & @CRLF & _
"Phím Alt + F - Gọi Folders Properties" & @CRLF & _
"Phím Alt + P - Gọi thư mục chứa Font được cài vào máy tính" & @CRLF & _
"Phím Alt + M - Gọi Mouse Properties" & @CRLF & _
"Phím Alt + N - Gọi thư mục Network Connections")

EndFunc

Func back()
    Send("{BROWSER_BACK}")
EndFunc
Func Forward()
    Send("{BROWSER_FORWARD}")
EndFunc
Func Refresh()
    Send("{BROWSER_REFRESH}")
EndFunc
Func stop()
    Send("{BROWSER_STOP}")
EndFunc
Func home()
    Send("{BROWSER_HOME}")
EndFunc
Func Search()
    Send("{BROWSER_SEARCH}")
EndFunc
Func Favorites()
    Send("{BROWSER_FAVORITES}")
EndFunc
Func mute()
    Send("{VOLUME_MUTE}")
EndFunc
Func Down()
    Send("{VOLUME_DOWN}")
EndFunc
Func up()
    Send("{VOLUME_UP}")
EndFunc
Func iNext()
    Send("{MEDIA_NEXT}")
EndFunc
Func iprev()
    Send("{MEDIA_PREV}")
EndFunc
Func istop()
    Send("{MEDIA_STOP}")
EndFunc
Func iplay_pause()
    Send("{MEDIA_PLAY_PAUSE}")
EndFunc
Func imedia()
    Send("{LAUNCH_MEDIA}")
EndFunc
Func maytinh()
    Send("{LAUNCH_APP1}")
EndFunc
Func Computer()
Send("{LAUNCH_APP2}")
EndFunc

Func wordpad()
    Run("write")
EndFunc
Func cmd()
    Run("cmd")
EndFunc
Func Notepad()
    Run("notepad")
EndFunc
Func clipboard()
    Run("clipbrd")
EndFunc
Func DisplayProperties()
 Run("control desktop")
 EndFunc
Func FoldersProperties()
    Run("control folders")
EndFunc
Func fonts()
Run("control fonts")
EndFunc
Func MouseProperties()
    Run("control mouse")
EndFunc
Func NetworkConnections()
Run("control netconnections")
EndFunc

Admin
Admin
Admin

Tổng số bài gửi : 63
Join date : 16/08/2011

https://autoitviet.forumvi.com

Về Đầu Trang Go down

[Code] Phím tắt mini Empty Re: [Code] Phím tắt mini

Bài gửi by Jindo_Katori Mon Feb 25, 2013 9:33 am

Tình hình là e đã caỳ cháy google mà không tìm ra sorf này...
Thực
ra em chỉ cần có thể tắt mở mạng connect / disconncet bằng 1
phím nóng hoặc 2 phím gì đó cũng được (ví dụ: F9 conncet, F10
disconnet).
Mong nhờ ADMIN giúp đỡ.
Chân thành cảm ơn.

Jindo_Katori

Tổng số bài gửi : 2
Join date : 25/02/2013

Về Đầu Trang Go down

[Code] Phím tắt mini Empty Re: [Code] Phím tắt mini

Bài gửi by Admin Fri May 03, 2013 2:40 pm

Jindo_Katori đã viết:Tình hình là e đã caỳ cháy google mà không tìm ra sorf này...
Thực
ra em chỉ cần có thể tắt mở mạng connect / disconncet bằng 1
phím nóng hoặc 2 phím gì đó cũng được (ví dụ: F9 conncet, F10
disconnet).
Mong nhờ ADMIN giúp đỡ.
Chân thành cảm ơn.

thử UDF này xem [Code] Phím tắt mini 3193073972

Code:
;====================================================================================================================
; Name              : _NicControl
; Description      : Activate or deactivate a Network Interface Controler (NIC)
; Syntax            : _NicControl($oLanConnection, [$iFlag, , [$iFullName]])
; Parameter(s)      : $oLanConnection    - The name of the Lan connection.
;                      If equal to 'All' then change state of all NIC.
;                    $iFlag        - The state of the NIC (Default 1 for activate).
;                    $iFullName    - Look for string $oLanConnection in NIC name (Default 1 for full name).
; Requirement(s)    : Win32_NT OS
; Return value(s)  : On Success - Return 1
;                    On Failure - Return 0 and @Extented is set.
;                      @Extented = 1 : Not Win32_NT OS
;                      @Extented = 2 : Network folder not find.
;                      @Extented = 3 : Lan connection not find.
; Author            : Tlem <tlem at tuxolem dot net>
;                      http://www.autoitscript.fr/forum/viewtopic.php?f=21&t=1092
; Note(s)          :
;
; To Do                : Get individual errors for changing state of multiple NIC (Perhaps with array).
; ===================================================================================================================

#RequireAdmin
Global $strEnableVerb
Global $strDisableVerb
Global $strFolderName


; ===================================================================================================================
; ===================================================================================================================
; Exemple :
; $Res = _NICContol('all', 1, 0)
; MsgBox(0, "", "$Res=" & $Res & "  @Error=" & @error & "  @extented=" & @extended)
; ===================================================================================================================
; ===================================================================================================================



Func _NICContol($oLanConnection, $iFlag = 1, $iFullName = 1)
    ; Control OS type.
    If @OSTYPE <> "WIN32_NT" Then
        SetError(1, 1)
        Return 0
    EndIf

    ; Langage selection.
    Select
        ; English (United States)
        Case StringInStr("0409,0809,0c09,1009,1409,1809,1c09,2009,2409,2809,2c09,3009,3409", @OSLang)
            $strEnableVerb = "En&able"
            $strDisableVerb = "Disa&ble"
            If @OSVersion = "WIN_2000" Then
                $strFolderName = "Network and Dial-up Connections" ; Windows 2000
            Else
                $strFolderName = "Network Connections"; Windows XP
            EndIf

            ; Français (France)
        Case StringInStr("040c,080c,0c0c,100c,140c,180c", @OSLang)
            $strEnableVerb = "&Activer"
            $strDisableVerb = "&Désactiver"
            If @OSVersion = "WIN_2000" Then
                $strFolderName = "Connexions réseau et accès à distance" ; Windows 2000
            Else
                $strFolderName = "Connexions réseau"; Windows XP
            EndIf

            ; Add here the correct Verbs for your Operating System Language
    EndSelect


    ; Vista/W2K8
    If @OSVersion <> "WIN_2000" And @OSVersion <> "WIN_XP" And @OSVersion <> "WIN_2003" Then
        $Res = _NICContolWin32New($oLanConnection, $iFlag, $iFullName)
    Else
        ; W2K/XP/W2K3
        $Res = _NICContolWin32($oLanConnection, $iFlag, $iFullName)
    EndIf
   
    SetError(@error, @extended)
    Return $Res

EndFunc  ;==>_NICContol


Func _NICContolWin32($oLanConnection, $iFlag = 1, $iFullName = 1)
; Inspired from :
; Original author : SvenP
; http://www.autoitscript.com/forum/index.php?showtopic=12645&view=findpost&p=87000
    $ShellApp = ObjCreate("Shell.Application")
    $oControlPanel = $ShellApp.Namespace(3)

    ; Find 'Network connections' control panel item
    $oNetConnections = ""
    For $FolderItem In $oControlPanel.Items
        If $FolderItem.Name = $strFolderName Then
            $oNetConnections = $FolderItem.GetFolder
            ExitLoop
        EndIf
    Next

    ; If no 'Network connections' folder then return error.
    If Not IsObj($oNetConnections) Then
        SetError(1, 2)
        Return 0
    EndIf

    ; Change all NIC state (Do not return extented errors).
    If StringLower($oLanConnection) = "all" Then
        For $FolderItem In $oNetConnections.Items
            _NICContolWin32($FolderItem.name, $iFlag)
        Next
        Return 1
    EndIf

    ; Change NIC state by partial name (Do not return extented errors).
    If $iFullName = 0 Then
        For $FolderItem In $oNetConnections.Items
            If StringInStr(StringLower($FolderItem.name), StringLower($oLanConnection)) Then
                _NICContolWin32($FolderItem, $iFlag)
            EndIf
        Next
        Return 1
    EndIf

    ; Find the collection of the network connection name.
    For $FolderItem In $oNetConnections.Items
        If StringLower($FolderItem.Name) = StringLower($oLanConnection) Then
            $oLanConnection = $FolderItem
            ExitLoop
        EndIf
    Next

    ; If no network connection name then return error.
    If Not IsObj($oLanConnection) Then
        SetError(1, 3)
        Return 0
    EndIf

    $oEnableVerb = ""
    $oDisableVerb = ""

    ; Find the state of the network connection.
    For $Verb In $oLanConnection.Verbs
        If $Verb.Name = $strEnableVerb Then
            $oEnableVerb = $Verb
            $State = 0
        EndIf
        If $Verb.Name = $strDisableVerb Then
            $oDisableVerb = $Verb
            $State = 1
        EndIf
    Next
   
    If $iFlag = 3 Then Return $State

    ; Enable NIC
    If $iFlag Then
        If IsObj($oEnableVerb) Then $oEnableVerb.DoIt
    EndIf

    ; Disable NIC
    If Not $iFlag Then
        If IsObj($oDisableVerb) Then $oDisableVerb.DoIt
    EndIf

    $begin = TimerInit()
    While 1
        $dif = Int(TimerDiff($begin) / 1000)
        If $dif > 10 Then ExitLoop
        ; Control the state of the NIC to exit before the end of waiting time.
        If $iFlag = 1 And _NICContolWin32($oLanConnection, 3) = 1 Then ExitLoop
        If $iFlag = 0 And _NICContolWin32($oLanConnection, 3) = 0 Then ExitLoop
        Sleep(100)
    WEnd

    ; Set the return value of the function.
    $Res = _NICContolWin32($oLanConnection, 3)
    If $iFlag = 1 And $Res = 0 Then
        Return 0
    ElseIf $iFlag = 0 And $Res = 1 Then
        Return 0
    Else
        Return 1
    EndIf

EndFunc  ;==>_NICContolWin32


Func _NICContolWin32New($oLanConnection, $iFlag = 1, $iFullName = 1)
; Inspired from :
; Original author : Danny35d
; http://www.autoitscript.com/forum/index.php?showtopic=72165&view=findpost&p=528862
    $objWMIService = ObjGet("winmgmts:\\localhost\root\CIMV2")
    $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapter", "WQL", 0x30)
    If IsObj($colItems) Then
        $iModState = 0

   
        ; Activate All NIC (Return just 1 if function end correctly).
        If StringLower($oLanConnection) = "all" Then
            For $objItem In $colItems
                If $objItem.NetConnectionID <> '' Then
                    _NICContolWin32New($objItem.NetConnectionID, $iFlag)
                    EndIf
            Next
            Return 1
        EndIf
       
        ; Change NIC state by partial name (Return just 1 if function end correctly or if no connection was find).
        If $iFullName = 0 Then
            For $objItem In $colItems
                If StringInStr(StringLower($objItem.NetConnectionID), StringLower($oLanConnection)) Then
                    $iModState = 1
                    $Res = _NICContolWin32New($objItem.NetConnectionID, $iFlag)
                EndIf
            Next
            ; If no connection find.
            If $iModState = 0 Then
                SetError(1,3)
                Return 0
            Else
                Return 1
            EndIf
        EndIf

        ; Change NIC state of $oLanConnection
        For $objItem In $colItems
            If $objItem.NetConnectionID = $oLanConnection Then
                ; Check State.
                If $iFlag = 3 Then
                    If $objItem.NetEnabled = True Then
                        Return 1
                    Else
                        Return 0
                    EndIf
                Else
                    ; Change State.
                    If $iFlag = 0 And $objItem.NetEnabled = True Then
                        $objItem.Disable
                    ElseIf $iFlag = 1 And $objItem.NetEnabled = False Then
                        $objItem.Enable
                    EndIf
                    $iModState = 1
                EndIf
                ExitLoop
            EndIf
        Next
        ; If no connection then error.
        If $iModState = 0 Then
            SetError(1, 3)
            Return 0
        EndIf
    Else
        SetError(1, 2)
        Return 0
    EndIf

    If $iFlag = 3 Then
        While $iFlag <> _NICContolWin32New($oLanConnection, 3)
            Sleep(250)
        WEnd
    Else
        Sleep(1000)
        If $iFlag = 1 And _NICContolWin32New($oLanConnection, 3) = 1 Then
            Return 1
        ElseIf $iFlag = 0 And _NICContolWin32New($oLanConnection, 3) = 0 Then
            Return 1
        Else
            Return 0
        EndIf
    EndIf

EndFunc  ;==>_NICContolWin32New
Admin
Admin
Admin

Tổng số bài gửi : 63
Join date : 16/08/2011

https://autoitviet.forumvi.com

Về Đầu Trang Go down

[Code] Phím tắt mini Empty Re: [Code] Phím tắt mini

Bài gửi by Sponsored content


Sponsored content


Về Đầu Trang Go down

Về Đầu Trang

- Similar topics

 
Permissions in this forum:
Bạn không có quyền trả lời bài viết