Jump to content
Sign in to follow this  
mikicun

Autoit Programming...

Recommended Posts

apa kata kita bincang pasal AutoIt programming kat sini... bukan apa cuma kdg2 aku ada masalah tapi x tau nak diskus ngan sapa dan lelain lagi la.....

boleh buat taruk skrip untuk rujukan atau komen....
apa kata..?

Share this post


Link to post
Share on other sites
autoit mmg best..
aku tau guna autoit sikit2 je, tu pun main try and error..
antara software yg aku try buat ialah software untuk auto re-connect bila line disconnected..
aku guna celcom broadband, guna modem huawei e220..

so, software ni akan check line, disconnected atau tak..
kalau dc, mula2 dia akan tutup program IDMan.exe supaya IDm tak skip current file..
pastu dia akan bawa keluar window Mobile Connect dan tekan F2 untuk re-connect..
pastu baru dia akan run IDMan.exe balik..

CODE:

CODE
Global $var, $var2
SelectFolder()

While 1;repeat forever
    
$connect = _GetNetworkConnect()

If Not $connect Then
    _IDMClose()
    ShellExecuteWait("Mobile Connect.exe","",$var)
    Sleep(350);allow Mobile connect window to appear first
    If WinActive("Mobile Connect") Then
        WinActivate("Mobile Connect")
        Send("{F2}")
        Sleep(100)
    Else
        WinWait("Mobile Connect")
        WinActivate("Mobile Connect")
        Send("{F2}")
        Sleep(100)
    EndIf
    Sleep(3000);allow connection to be established first
    _IDMRun()
EndIf
Sleep(350);reduce CPU usage
WEnd

Func SelectFolder();Select installation folder
;Mobile connect
$var = FileSelectFolder("Choose Mobile Connect.exe installation folder", "", 2, "C:\Program Files\Huawei technologies\Mobile Connect")

If @error Then
    MsgBox(4096,"","No Folder chosen")
Else
    $var = StringReplace($var, "|", @CRLF)
    MsgBox(4096,"","You chose " & $var)
EndIf
;IDM
$var2 = FileSelectFolder("Choose IDM.exe installation folder", "", 2, "C:\Program Files\Internet Download Manager")

If @error Then
    MsgBox(4096,"","No Folder chosen")
Else
    $var2 = StringReplace($var2, "|", @CRLF)
    MsgBox(4096,"","You chose " & $var2)
EndIf
EndFunc

Func _GetNetworkConnect();check connection
    Local Const $NETWORK_ALIVE_LAN = 0x1 ;net card connection
    Local Const $NETWORK_ALIVE_WAN = 0x2 ;RAS (internet) connection
    Local Const $NETWORK_ALIVE_AOL = 0x4 ;AOL
    
    Local $aRet, $iResult
    
    $aRet = DllCall("sensapi.dll", "int", "IsNetworkAlive", "int*", 0)
    
    If BitAND($aRet[1], $NETWORK_ALIVE_LAN) Then $iResult &= "LAN connected" & @LF
    If BitAND($aRet[1], $NETWORK_ALIVE_WAN) Then $iResult &= "WAN connected" & @LF
    If BitAND($aRet[1], $NETWORK_ALIVE_AOL) Then $iResult &= "AOL connected" & @LF
    
    Return $iResult
EndFunc

Func _IDMClose();close idm
    ProcessClose("IDMan.exe")
    ProcessWaitClose("IDMan.exe")
EndFunc

Func _IDMRun();run idm
    ShellExecuteWait("IDMan.exe","",$var2)
EndFunc


ada apa2 cadangan nak perbaiki software ni?
antara masalahnya ialah kuat makan resource --> memory usage dia tinggi juga dalam 11000 K..
camna ek nak kurangkan memory usage dia? Edited by Ku2_BiO_X

Share this post


Link to post
Share on other sites
apasal x amik install folder direct dari registry? kan senang... x yah tanya2 lagi kat mana lokasi modem connect atau idm...?

cuba guna adlib..
CODE
AdlibEnable("_GetNetworkConnect", 500); akan cek status setiap 500ms
While 1;repeat forever
;$connect = _GetNetworkConnect(); x pakai lg sebab dah ada adlib...


CODE
    If BitAND($aRet[1], $NETWORK_ALIVE_AOL) Then $iResult &= "AOL connected" & @LF

ko ada pakai AOL ka? klau x dak... x yah guna la kot...

aku test kat pc aku... mem guna 7400K (+-)
nak test lebih2, dua dua tuh aku x der (huawei ngan idm), so x leh bagi info tepat lagi la...

============================================================



nih aku baru buat 2-3 minggu lepas.... ada error sket...
sesetengah windows proses x leh kill (cam alg.exe, dia akan kluar error...)
ada sapa2 bleh tolong repair...?

CODE
#Region;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=160.ico
#AutoIt3Wrapper_Outfile=C:\Documents and Settings\Administrator\Desktop\ProcessMGR.exe
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Res_Comment=Simple Process Manager for monitoring, killing and deleting running process in local machine by MiKiCuN.
#AutoIt3Wrapper_Res_Description=Simple Process Manager for monitoring, killing and deleting running process in local machine by MiKiCuN.
#AutoIt3Wrapper_Res_Fileversion=1.0.0.0
#AutoIt3Wrapper_Res_LegalCopyright=Copyright © 2008 ProjectPortables.Org. All rights reserved.
#AutoIt3Wrapper_Run_Obfuscator=y
#EndRegion;**** Directives created by AutoIt3Wrapper_GUI ****
#include-once
Opt("TrayIconHide", 1)
HotKeySet("{ESC}", "ext")
HotKeySet("{F5}", "ref")
HotKeySet("{F6}", "kill")
HotKeySet("{F7}", "del")
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>
#include <GuiListBox.au3>
#include <process.au3>
$version = "Mini RegTweak v" & StringLeft(FileGetVersion(@ScriptName), 5) & "  -  Process Manager "
$Debug_LV = False; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

Global $B_DESCENDING, $avProcs = ProcessList(), $Process = "", $sComputer = "."

$about = "About " & $version
$MainLabel = $version;& @LF & "Portable"
$CopyRLabel = "Copyright © 2008 ProjectPortables.Org" & @LF & "All rights reserved."
$NameURL1 = "HomePage"
$URL1 = "http://www.projectportables.org/freeware"
$NameURL2 = "Email Developer"
$URL2 = "mailto:[email protected]"
$NameURL3 = "ProjectPortables"
$URL3 = "http://www.projectportables.org"
$LinkColor = 0x0000FF
$BkColor = 0xAEC0FF
$hWnd = WinGetHandle(WinGetTitle(""))

$GUI = GUICreate($version, 700, 480, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_SIZEBOX + $WS_SYSMENU))
GUISetBkColor(0xAEC0FF)
$inp1 = GUICtrlCreateListView("Active Running Process  | PID | Owner | CPU | Memory | Originate Path ", 5, 5, 685, 390, BitOR($LVS_SORTASCENDING, $LVS_SINGLESEL, $LVS_EX_CHECKBOXES))
GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
_GUICtrlListView_JustifyColumn($inp1, 1, 1)
_GUICtrlListView_JustifyColumn($inp1, 2, 1)
_GUICtrlListView_JustifyColumn($inp1, 3, 1)
_GUICtrlListView_JustifyColumn($inp1, 4, 1)
_GUICtrlListView_JustifyColumn($inp1, 5, 0)
GUICtrlSendMsg($inp1, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
GUICtrlSendMsg($inp1, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT)
GUICtrlSendMsg($inp1, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_TRACKSELECT, $LVS_EX_TRACKSELECT)
GUICtrlSendMsg($inp1, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_CHECKBOXES, $LVS_EX_CHECKBOXES)
_GUICtrlListView_SetColumnWidth($inp1, 0, 160)
_GUICtrlListView_SetColumnWidth($inp1, 1, 50)
_GUICtrlListView_SetColumnWidth($inp1, 2, 80)
_GUICtrlListView_SetColumnWidth($inp1, 3, 55)
_GUICtrlListView_SetColumnWidth($inp1, 4, 70)
_GUICtrlListView_SetColumnWidth($inp1, 5, 300)
$lbl = GUICtrlCreateLabel("", 7, 395, 200, 20)
ControlSetText($version, "", $lbl, "Reading running process, please wait . . .   ")
GUICtrlSetColor($lbl, 0xaa0000)
$rfh = GUICtrlCreateButton("Refresh (F5)", 5, 420, 90, 25)
GUICtrlSetResizing($rfh, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKLEFT)
GUICtrlSetTip(-1, "Refresh process list...")
$kill = GUICtrlCreateButton("", 95, 420, 90, 25)
GUICtrlSetResizing($kill, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKLEFT)
GUICtrlSetData($kill, "Kill Process (F6)")
GUICtrlSetTip(-1, "Kill selected process...")
$del = GUICtrlCreateButton("Delete File (F7)", 185, 420, 90, 25)
GUICtrlSetResizing($del, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKLEFT)
GUICtrlSetTip(-1, "Kill process and delete source file...")
;GUICtrlSetState($del, $GUI_DISABLE)
$end = GUICtrlCreateButton("Exit (ESC)", 275, 420, 90, 25)
GUICtrlSetResizing($end, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKLEFT)
GUICtrlSetTip(-1, "Exit this program...")
$abt = GUICtrlCreateButton("About ", 400, 420, 90, 25)
GUICtrlSetResizing($abt, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKLEFT)
GUICtrlSetTip(-1, "About this program...")
GUICtrlCreateLabel("Memory in use: ", 550, 400, 80, 15)
GUICtrlSetResizing(-1, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKRIGHT)
$ram1 = GUICtrlCreateLabel("", 630, 400, 50, 15)
GUICtrlSetResizing($ram1, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKRIGHT)
GUICtrlSetTip(-1, "Memory in use...")
GUICtrlCreateLabel("Total Memory: ", 555, 417, 80, 15)
GUICtrlSetResizing(-1, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKRIGHT)
$ram2 = GUICtrlCreateLabel("", 630, 417, 70, 15)
GUICtrlSetResizing($ram2, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKRIGHT)
GUICtrlSetTip(-1, "Total Memory Available...")
GUICtrlCreateLabel("Memory Available: ", 538, 434, 90, 15)
GUICtrlSetResizing(-1, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKRIGHT)
$ram3 = GUICtrlCreateLabel("", 630, 434, 70, 15)
GUICtrlSetResizing($ram3, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKRIGHT)
GUICtrlSetTip(-1, "Memory Available...")
Global $B_DESCENDING[_GUICtrlListView_GetColumnCount($inp1)]

GUISetState()
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

$avRET = _ProcessListProperties()
AdlibEnable("mem", 500)

While 1
    $Msg = GUIGetMsg()
    Sleep(15)
    Select
        Case $Msg = $GUI_EVENT_CLOSE Or $Msg = $end
            ControlSetText($version, "", $lbl, "Exiting, please wait . . .   ")
            Sleep(250)
            Exit
        Case $Msg = $rfh
            ControlSetText($version, "", $lbl, "Reading running process, please wait . . .   ")
            _GUICtrlListView_DeleteAllItems($inp1)
            _ProcessListProperties()
        Case $Msg = $abt
            _About($about, $MainLabel, $CopyRLabel, StringLeft(FileGetVersion(@ScriptName), 5), $NameURL1, $URL1, $NameURL2, $URL2, $NameURL3, $URL3, @ScriptName, $LinkColor, $BkColor, -1, -1, -1, -1, $hWnd)
        Case $Msg = $kill
            ControlSetText($version, "", $lbl, "Killing selected process, please wait . . .   ")
            kill()
        Case $Msg = $del
            ControlSetText($version, "", $lbl, "Killing and deleting selected process, please wait . . .   ")
            del()
    EndSelect
WEnd

Func mem()
    $mem = MemGetStats()
    ControlSetText($version, "", $ram1, $mem[0] & "%")
    ControlSetText($version, "", $ram2, Round($mem[1] / 1024, 2) & " MB")
    ControlSetText($version, "", $ram3, Round($mem[2] / 1024, 2) & " MB")
EndFunc;==>mem

Func kill()
    If _GUICtrlListView_GetSelectedCount($inp1) > 0 Then
        FileDelete(@TempDir & "\*.ini")
        $n = 1
        For $z = 1 To _GUICtrlListView_GetItemCount($inp1)
            If _GUICtrlListView_GetItemChecked($inp1, $z) = "True" Then
                $item = StringSplit(_GUICtrlListView_GetItemText($inp1, $z, 1), "|")
                IniWrite(@TempDir & "\lists.ini", $n, $n, $item[1])
                $n = $n + 1
            EndIf
        Next
        $var = IniReadSectionNames(@TempDir & "\lists.ini")
        If $var[0] > 4 Then
            $va = IniReadSection(@TempDir & "\lists.ini", "5")
            $va1 = IniReadSection(@TempDir & "\lists.ini", "4")
            $va2 = IniReadSection(@TempDir & "\lists.ini", "3")
            $va3 = IniReadSection(@TempDir & "\lists.ini", "2")
            $va4 = IniReadSection(@TempDir & "\lists.ini", "1")
            _RunDOS("taskkill.exe /F /PID " & $va[1][1] & " /PID " & $va1[1][1] & " /PID " & $va2[1][1] & " /PID " & $va3[1][1] & " /PID " & $va4[1][1] & " /T")
        ElseIf $var[0] > 3 Then
            $va1 = IniReadSection(@TempDir & "\lists.ini", "4")
            $va2 = IniReadSection(@TempDir & "\lists.ini", "3")
            $va3 = IniReadSection(@TempDir & "\lists.ini", "2")
            $va4 = IniReadSection(@TempDir & "\lists.ini", "1")
            _RunDOS("taskkill.exe /F /PID " & $va1[1][1] & " /PID " & $va2[1][1] & " /PID " & $va3[1][1] & " /PID " & $va4[1][1] & " /T")
        ElseIf $var[0] > 2 Then
            $va2 = IniReadSection(@TempDir & "\lists.ini", "3")
            $va3 = IniReadSection(@TempDir & "\lists.ini", "2")
            $va4 = IniReadSection(@TempDir & "\lists.ini", "1")
            _RunDOS("taskkill.exe /F /PID " & $va2[1][1] & " /PID " & $va3[1][1] & " /PID " & $va4[1][1] & " /T")
        ElseIf $var[0] > 1 Then
            $va3 = IniReadSection(@TempDir & "\lists.ini", "2")
            $va4 = IniReadSection(@TempDir & "\lists.ini", "1")
            _RunDOS("taskkill.exe /F /PID " & $va3[1][1] & " /PID " & $va4[1][1] & " /T")
        Else
            _RunDOS("taskkill.exe /F /PID " & $item[1] & " /T")
        EndIf
        FileDelete(@TempDir & "\*.ini")
        _GUICtrlListView_DeleteAllItems($inp1)
        _ProcessListProperties()
    Else
        ControlSetText($version, "", $lbl, "Error, item not selected . . .   ")
    EndIf
EndFunc;==>kill

Func del()
    If _GUICtrlListView_GetSelectedCount($inp1) > 0 Then
        FileDelete(@TempDir & "\*.ini")
        $n = 1
        For $z = 1 To _GUICtrlListView_GetItemCount($inp1)
            If _GUICtrlListView_GetItemChecked($inp1, $z) = "True" Then
                $item = StringSplit(_GUICtrlListView_GetItemText($inp1, $z, 1), "|")
                IniWrite(@TempDir & "\lists.ini", $n, $n, $item[1])
                $dir = StringSplit(_GUICtrlListView_GetItemText($inp1, $z, 5), "|")
                IniWrite(@TempDir & "\del.ini", $n, $n, FileGetShortName($dir[1]))
                $n = $n + 1
            EndIf
        Next
        $var = IniReadSectionNames(@TempDir & "\lists.ini")
        If $var[0] > 4 Then
            $va = IniReadSection(@TempDir & "\lists.ini", "5")
            $va1 = IniReadSection(@TempDir & "\lists.ini", "4")
            $va2 = IniReadSection(@TempDir & "\lists.ini", "3")
            $va3 = IniReadSection(@TempDir & "\lists.ini", "2")
            $va4 = IniReadSection(@TempDir & "\lists.ini", "1")
            _RunDOS("taskkill.exe /F /PID " & $va[1][1] & " /PID " & $va1[1][1] & " /PID " & $va2[1][1] & " /PID " & $va3[1][1] & " /PID " & $va4[1][1] & " /T")
            $da = IniReadSection(@TempDir & "\del.ini", "5")
            $da1 = IniReadSection(@TempDir & "\del.ini", "4")
            $da2 = IniReadSection(@TempDir & "\del.ini", "3")
            $da3 = IniReadSection(@TempDir & "\del.ini", "2")
            $da4 = IniReadSection(@TempDir & "\del.ini", "1")
            FileSetAttrib($da[1][1], "-RSH")
            FileSetAttrib($da1[1][1], "-RSH")
            FileSetAttrib($da2[1][1], "-RSH")
            FileSetAttrib($da3[1][1], "-RSH")
            FileSetAttrib($da4[1][1], "-RSH")
            Sleep(250)
            FileDelete($da[1][1])
            FileDelete($da1[1][1])
            FileDelete($da2[1][1])
            FileDelete($da3[1][1])
            FileDelete($da4[1][1])
        ElseIf $var[0] > 3 Then
            $va1 = IniReadSection(@TempDir & "\lists.ini", "4")
            $va2 = IniReadSection(@TempDir & "\lists.ini", "3")
            $va3 = IniReadSection(@TempDir & "\lists.ini", "2")
            $va4 = IniReadSection(@TempDir & "\lists.ini", "1")
            _RunDOS("taskkill.exe /F /PID " & $va1[1][1] & " /PID " & $va2[1][1] & " /PID " & $va3[1][1] & " /PID " & $va4[1][1] & " /T")
            $da1 = IniReadSection(@TempDir & "\del.ini", "4")
            $da2 = IniReadSection(@TempDir & "\del.ini", "3")
            $da3 = IniReadSection(@TempDir & "\del.ini", "2")
            $da4 = IniReadSection(@TempDir & "\del.ini", "1")
            FileSetAttrib($da1[1][1], "-RSH")
            FileSetAttrib($da2[1][1], "-RSH")
            FileSetAttrib($da3[1][1], "-RSH")
            FileSetAttrib($da4[1][1], "-RSH")
            Sleep(250)
            FileDelete($da1[1][1])
            FileDelete($da2[1][1])
            FileDelete($da3[1][1])
            FileDelete($da4[1][1])
        ElseIf $var[0] > 2 Then
            $va2 = IniReadSection(@TempDir & "\lists.ini", "3")
            $va3 = IniReadSection(@TempDir & "\lists.ini", "2")
            $va4 = IniReadSection(@TempDir & "\lists.ini", "1")
            _RunDOS("taskkill.exe /F /PID " & $va2[1][1] & " /PID " & $va3[1][1] & " /PID " & $va4[1][1] & " /T")
            $da2 = IniReadSection(@TempDir & "\del.ini", "3")
            $da3 = IniReadSection(@TempDir & "\del.ini", "2")
            $da4 = IniReadSection(@TempDir & "\del.ini", "1")
            FileSetAttrib($da2[1][1], "-RSH")
            FileSetAttrib($da3[1][1], "-RSH")
            FileSetAttrib($da4[1][1], "-RSH")
            Sleep(250)
            FileDelete($da2[1][1])
            FileDelete($da3[1][1])
            FileDelete($da4[1][1])
        ElseIf $var[0] > 1 Then
            $va3 = IniReadSection(@TempDir & "\lists.ini", "2")
            $va4 = IniReadSection(@TempDir & "\lists.ini", "1")
            _RunDOS("taskkill.exe /F /PID " & $va3[1][1] & " /PID " & $va4[1][1] & " /T")
            $da3 = IniReadSection(@TempDir & "\del.ini", "2")
            $da4 = IniReadSection(@TempDir & "\del.ini", "1")
            FileSetAttrib($da3[1][1], "-RSH")
            FileSetAttrib($da4[1][1], "-RSH")
            Sleep(250)
            FileDelete($da3[1][1])
            FileDelete($da4[1][1])
        Else
            _RunDOS("taskkill.exe /F /PID " & $item[1] & " /T")
            FileSetAttrib($dir[1], "-RSH")
            Sleep(250)
            FileDelete($dir[1])
        EndIf
        FileDelete(@TempDir & "\*.ini")
        _GUICtrlListView_DeleteAllItems($inp1)
        _ProcessListProperties()
    Else
        ControlSetText($version, "", $lbl, "Error, item not selected . . .   ")
    EndIf
EndFunc;==>del

Func _ProcessListProperties($Process = "", $sComputer = ".")
    Local $sUserName, $sMsg, $sUserDomain, $avProcs
    If $Process = "" Then
        $avProcs = ProcessList()
    Else
        $avProcs = ProcessList($Process)
    EndIf

    If $avProcs[0][0] = 0 Then Return $avProcs
    ReDim $avProcs[$avProcs[0][0] + 1][8]
    $oWMI = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & $sComputer & "\root\cimv2")
    If IsObj($oWMI) Then
        $colProcs = $oWMI.ExecQuery("select * from win32_process")
        If IsObj($colProcs) Then
            For $oProc In $colProcs
                For $n = 1 To $avProcs[0][0]
                    If $avProcs[$n][1] = $oProc.ProcessId Then
                        $avProcs[$n][2] = $oProc.ParentProcessId
                        If $oProc.GetOwner($sUserName, $sUserDomain) = 0 Then $avProcs[$n][3] = $sUserDomain & "\" & $sUserName
                        $avProcs[$n][4] = $oProc.Priority
                        $avProcs[$n][5] = $oProc.ExecutablePath

                        ExitLoop
                    EndIf
                Next
            Next
        Else
            SetError(2)
        EndIf
        Local $oRefresher = ObjCreate("WbemScripting.SWbemRefresher")
        $colProcs = $oRefresher.AddEnum($oWMI, "Win32_PerfFormattedData_PerfProc_Process" ).objectSet
        $oRefresher.Refresh
        Local $iTime = TimerInit()
        Do
            Sleep(10)
        Until TimerDiff($iTime) > 100
        $oRefresher.Refresh
        For $oProc In $colProcs
            For $n = 1 To $avProcs[0][0]
                If $avProcs[$n][1] = $oProc.IDProcess Then
                    $avProcs[$n][6] = $oProc.PercentProcessorTime
                    $avProcs[$n][7] = $oProc.WorkingSet
                    ExitLoop
                EndIf
            Next
        Next
    Else
        SetError(1)
    EndIf

    For $i = 1 To $avProcs[0][0]
        $own = StringSplit($avProcs[$i][3], '\')
        If $own[0] > 1 Then
            $own1 = $own[2]
        Else
            $own1 = $own[1]
        EndIf
        If $avProcs[$i][5] = "" And $avProcs[$i][0] <> "System" Then $avProcs[$i][5] = @SystemDir & "\" & $avProcs[$i][0]
        If $avProcs[$i][1] <> 0 Then GUICtrlCreateListViewItem($avProcs[$i][0] & "|" & $avProcs[$i][1] & "|" & $own1 & "|" & $avProcs[$i][6] & "% |" & Round($avProcs[$i][7] / 1048576, 2) & "MB" & "|" & $avProcs[$i][5], $inp1)
    Next
    ControlSetText($version, "", $lbl, "Ready . . .   ")
    Return $avProcs
EndFunc;==>_ProcessListProperties

Func _About($about, $MainLabel, $CopyRLabel, $VerLabel, $NameURL1, $URL1, $NameURL2, $URL2, $NameURL3, $URL3, $IconFile = @ScriptName, $LinkColor = 0x0000FF, $BkColor = 0xFFFFFF, $Left = -1, $Top = -1, $Style = -1, $ExStyle = -1, $Parent = 0)
    Local $OldEventOpt = Opt("GUIOnEventMode", 0)
    Local $GUI, $LinkTop = 100, $Msg
    Local $CurIsOnCtrlArr[1]
    Local $LinkVisitedColor[4] = [3, $LinkColor, $LinkColor, $LinkColor]
    Local $LinkLabel[4]
    WinSetState($Parent, "", @SW_DISABLE)
    If $ExStyle = -1 Then $ExStyle = ""
    $GUI = GUICreate($about, 320, 240, $Left, $Top, $Style, 0x00000080 + $ExStyle, $Parent)
    GUISetBkColor($BkColor)
    GUICtrlCreateLabel($MainLabel, 40, 20, 280, 50, 1)
    GUICtrlSetFont(-1, 16)
    GUICtrlCreateIcon($IconFile, 0, 10, 20)
    GUICtrlCreateGraphic(5, 75, 310, 3, $SS_ETCHEDFRAME)
    For $i = 1 To 3
        $LinkLabel[$i] = GUICtrlCreateLabel(Eval("NameURL" & $i), 150, $LinkTop, 145, 15, 1)
        GUICtrlSetCursor(-1, 0)
        GUICtrlSetColor(-1, $LinkColor)
        GUICtrlSetFont(-1, 9, 400, 0)
        $LinkTop += 30
    Next
    GUICtrlCreateLabel("Program version: " & @LF & $VerLabel, 10, 100, 150, 35, 1)
    GUICtrlSetFont(-1, 10, 600, 0, "Tahoma")
    GUICtrlCreateLabel($CopyRLabel, 0, 210, 320, -1, 1)
    GUISetState(@SW_SHOW, $GUI)

    While 1
        $Msg = GUIGetMsg()
        If $Msg = -3 Then ExitLoop
        For $i = 1 To 3
            If $Msg = $LinkLabel[$i] Then
                $LinkVisitedColor[$i] = 0xAC00A9
                GUICtrlSetColor($LinkLabel[$i], $LinkVisitedColor[$i])
                ShellExecute(Eval("URL" & $i))
            EndIf
        Next
        If WinActive($GUI) Then
            For $i = 1 To 3
                ControlHover($GUI, $LinkLabel[$i], $i, $CurIsOnCtrlArr, 0xFF0000, $LinkVisitedColor[$i])
            Next
        EndIf
    WEnd
    WinSetState($Parent, "", @SW_ENABLE)
    GUIDelete($GUI)
    Opt("GUIOnEventMode", $OldEventOpt)
EndFunc;==>_About

Func ControlHover($hWnd, $CtrlID, $CtrlNum, ByRef $CurIsOnCtrlArr, $HoverColor = 0xFF0000, $LinkColor = 0x0000FF)
    Local $CursorCtrl = GUIGetCursorInfo($hWnd)
    ReDim $CurIsOnCtrlArr[UBound($CurIsOnCtrlArr) + 1]
    If $CursorCtrl[4] = $CtrlID And $CurIsOnCtrlArr[$CtrlNum] = 1 Then
        GUICtrlSetFont($CtrlID, 9, 400, 6)
        GUICtrlSetColor($CtrlID, $HoverColor)
        $CurIsOnCtrlArr[$CtrlNum] = 0
    ElseIf $CursorCtrl[4] <> $CtrlID And $CurIsOnCtrlArr[$CtrlNum] = 0 Then
        GUICtrlSetFont($CtrlID, 9, 400, 0)
        GUICtrlSetColor($CtrlID, $LinkColor)
        $CurIsOnCtrlArr[$CtrlNum] = 1
    EndIf
EndFunc;==>ControlHover

Func ext()
    ControlSetText($version, "", $lbl, "Exiting, please wait . . .   ")
    Sleep(250)
    Exit
EndFunc;==>ext

Func ref()
    _GUICtrlListView_DeleteAllItems($inp1)
    _ProcessListProperties()
EndFunc;==>ref

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
    #forceref $hWnd, $iMsg, $iwParam
    Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo
    $hWndListView = $inp1
    If Not IsHWnd($inp1) Then $hWndListView = GUICtrlGetHandle($inp1)

    $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
    $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
    $iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
    $iCode = DllStructGetData($tNMHDR, "Code")
    Switch $hWndFrom
        Case $hWndListView
            Switch $iCode
                Case $LVN_COLUMNCLICK; A column was clicked
                    $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
                    _GUICtrlListView_SimpleSort($hWndListView, $B_DESCENDING, DllStructGetData($tInfo, "SubItem"))
            EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc;==>WM_NOTIFY
Edited by mikicun

Share this post


Link to post
Share on other sites
CODE
_RunDOS("taskkill.exe /F /PID " & $va[1][1] & " /PID " & $va1[1][1] & " /PID " & $va2[1][1] & " /PID " & $va3[1][1] & " /PID " & $va4[1][1] & " /T")

ko guna command taskkill ekk untuk kill process? cuba ko carik coding lain untuk ganti taskkill tu, aku rasa senang jer carik.. wink.gif

Share this post


Link to post
Share on other sites
QUOTE(ApoNie @ Jan 4 2009, 05:14 PM) <{POST_SNAPBACK}>
CODE
_RunDOS("taskkill.exe /F /PID " & $va[1][1] & " /PID " & $va1[1][1] & " /PID " & $va2[1][1] & " /PID " & $va3[1][1] & " /PID " & $va4[1][1] & " /T")

ko guna command taskkill ekk untuk kill process? cuba ko carik coding lain untuk ganti taskkill tu, aku rasa senang jer carik.. wink.gif


dalam autoit pun ada command untuk taskkill; ProcessClose("prog yg nak close")
tapi kekadang x berkesan.... tu pasal aku guna taskkill, memang confirm leh kill punya...

Share this post


Link to post
Share on other sites
ala.. nak gaduh plak utk kill task.. :lol:
apa kbar semua kawan2.. ? masokis nak tanya sket..
mcmna nak gunakan GUI pada autoit ni.. ? :huh:

Share this post


Link to post
Share on other sites
[quote name='masokis' date='17 May 2010 - 09:21 PM' timestamp='1274102482' post='1031450']
ala.. nak gaduh plak utk kill task.. :lol:
apa kbar semua kawan2.. ? masokis nak tanya sket..
mcmna nak gunakan GUI pada autoit ni.. ? :huh:
[/quote]

gui bleh design gune KODA GUI designer..
nak control gui, bleh gune guictrlsetdata,guictrlread,guictrlget dll..

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...