| 1 | ;Athor: Shivakumar Shreeshail
|
|---|
| 2 | ;Version: 0.0.1
|
|---|
| 3 | ;Last Modified Date: 13th august 2009
|
|---|
| 4 | ;Description: To Uninstall HttDmp Internal and NDA Products for windows-XP and Vista-32 bit machines
|
|---|
| 5 |
|
|---|
| 6 | #include<File.au3>
|
|---|
| 7 | #Include <Excel.au3>
|
|---|
| 8 | #Include <GuiTreeView.au3>
|
|---|
| 9 | #Include <GuiTab.au3>
|
|---|
| 10 | #include <Word.au3>
|
|---|
| 11 | #include <Array.au3>
|
|---|
| 12 | #Include <WinAPI.au3>
|
|---|
| 13 |
|
|---|
| 14 | Global $return
|
|---|
| 15 | Global $var1
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 | $Version = "5.1.2600.5512"
|
|---|
| 20 | ;======================================================================================================================================
|
|---|
| 21 | ;verification of AMD Special Tools Driver in Device manager
|
|---|
| 22 | ;======================================================================================================================================
|
|---|
| 23 | ;Deveice_Manager("AMD Special Tools Driver","Driver","1.7.12.196")
|
|---|
| 24 | $Child = "ACPI Thermal Zone" ;| "AMD Low Level Device Driver"
|
|---|
| 25 | $Tab_name = "Driver"
|
|---|
| 26 | $Version = "1.7.12.196"
|
|---|
| 27 | ;httdmp
|
|---|
| 28 |
|
|---|
| 29 | Deveice_Manager($Child,$Tab_name,$Version)
|
|---|
| 30 |
|
|---|
| 31 | func Deveice_Manager($Child,$Tab_name,$Version)
|
|---|
| 32 |
|
|---|
| 33 | ;if NOT StringCompare($Devmanager ,"Execute",1) Then
|
|---|
| 34 | ;$Step+=1
|
|---|
| 35 | ;concat("[STEP_00"& $Step & "]//Step Name: My step " & $Step & "//Description: verification of AMD Special Tools Driver in Device manager",0)
|
|---|
| 36 |
|
|---|
| 37 | ShellExecute("devmgmt.msc")
|
|---|
| 38 | Sleep(3000)
|
|---|
| 39 | $hTree = ControlGetHandle("Device Manager", "", "[Class:SysTreeView32;Instance:1]")
|
|---|
| 40 |
|
|---|
| 41 | MsgBox(0, "Information", $hTree)
|
|---|
| 42 | _GUICtrlTreeView_Expand($hTree,true)
|
|---|
| 43 | Exit
|
|---|
| 44 | $hItem = _GUICtrlTreeView_FindItem($hTree,$Child)
|
|---|
| 45 | ;MsgBox(0,"error",$hItem,2)
|
|---|
| 46 | if not $hItem then
|
|---|
| 47 | MsgBox(0,"title","dev manager :Pass",3)
|
|---|
| 48 | $return = "-1"
|
|---|
| 49 | $pid = ProcessExists ("mmc.exe")
|
|---|
| 50 | if $pid Then
|
|---|
| 51 | ProcessClose("mmc.exe")
|
|---|
| 52 | EndIf
|
|---|
| 53 | else
|
|---|
| 54 | _GUICtrlTreeView_SelectItem($hTree, $hItem, $TVGN_CARET)
|
|---|
| 55 | ; Focus treeview and Send Enter
|
|---|
| 56 | ControlFocus("Device Manager", "", $hTree)
|
|---|
| 57 | ControlSend("Device Manager", "", $hTree, "{ENTER}")
|
|---|
| 58 | WinActivate($Child)
|
|---|
| 59 | Sleep(2000);;;
|
|---|
| 60 | ;to Select driver TAB
|
|---|
| 61 | ;Dim $sTitle = "AMD Special Tools Driver Properties"
|
|---|
| 62 | ;Sleep(1000)
|
|---|
| 63 | Dim $hWnd=$Child & " " & "Properties"
|
|---|
| 64 | ; Get handle to Tab control
|
|---|
| 65 | $hTab = ControlGetHandle($hWnd, "", "SysTabControl321")
|
|---|
| 66 | ;If @error Then _ExitOnError("Failed to get handle to TAB control.") EndIf
|
|---|
| 67 | ; Find and select Advanced tab
|
|---|
| 68 | $iRemTab = _GUICtrlTab_FindTab($hTab,$Tab_name)
|
|---|
| 69 | ; If $iRemTab = -1 Then _ExitOnError("Failed to find 'Advanced' tab.") EndIf
|
|---|
| 70 | _GUICtrlTab_ClickTab($hTab, $iRemTab)
|
|---|
| 71 | ;If _GUICtrlTab_GetCurSel($hTab) <> $iRemTab Then _ExitOnError("Failed to change selected tab to 'Driver'.") EndIf
|
|---|
| 72 | Sleep(1000) ;to check the driver version
|
|---|
| 73 | $text = WinGetText($Child, "")
|
|---|
| 74 | ;MsgBox(0, "Text read was:",$text,5)
|
|---|
| 75 | $compare = StringInStr($text, $Version)
|
|---|
| 76 | if $compare == 0 Then
|
|---|
| 77 | $return = 0
|
|---|
| 78 | MsgBox(0,"title","dev manager :Fail",3)
|
|---|
| 79 |
|
|---|
| 80 | Else
|
|---|
| 81 | $return = 1
|
|---|
| 82 | MsgBox(0,"title","dev manager :Pass",3)
|
|---|
| 83 |
|
|---|
| 84 | EndIf
|
|---|
| 85 | ;sleep(5)
|
|---|
| 86 | ;to close the device manager - AMD Special Tools Driver Properties window
|
|---|
| 87 | WinActivate($Child & " " & "Properties")
|
|---|
| 88 | WinWaitActive($Child & " " & "Properties", $Child,10)
|
|---|
| 89 | Send("!c")
|
|---|
| 90 | ;to close the device manager window
|
|---|
| 91 |
|
|---|
| 92 | EndIf ;if not $hItem then
|
|---|
| 93 | WinActivate("Device Manager")
|
|---|
| 94 | $pid = ProcessExists ("mmc.exe")
|
|---|
| 95 | if $pid Then
|
|---|
| 96 | ProcessClose("mmc.exe")
|
|---|
| 97 | EndIf
|
|---|
| 98 | ;EndIf
|
|---|
| 99 | MsgBox(0,"title",$return,3)
|
|---|
| 100 | Return($return)
|
|---|
| 101 | EndFunc
|
|---|
| 102 |
|
|---|
| 103 |
|
|---|
| 104 | ;=======================================================================================================================================
|
|---|
| 105 | ;function for writing the variable content with split function
|
|---|
| 106 | ;=======================================================================================================================================
|
|---|
| 107 | func WriteToFile($split,$Fname)
|
|---|
| 108 |
|
|---|
| 109 | $temp=0 ;is taken to start writin to file from index 1 index 0 contains number of array elemets count
|
|---|
| 110 |
|
|---|
| 111 | if not FileExists($Fname) then
|
|---|
| 112 | if _FileCreate($Fname) Then ;log for sucessful creation
|
|---|
| 113 | concat("sucessful creation of "& $Fname,1)
|
|---|
| 114 |
|
|---|
| 115 | elseif @error = 1 Then ;log for error in opening file
|
|---|
| 116 | concat("error in opening file "& $Fname,1)
|
|---|
| 117 | Exit
|
|---|
| 118 | elseif @error = 2 Then ;File could not be written to
|
|---|
| 119 | concat("File could not be written to "& $Fname,1)
|
|---|
| 120 | exit
|
|---|
| 121 | EndIf
|
|---|
| 122 |
|
|---|
| 123 | EndIf ;if not FileExists("c:\Ctest1234.txt") then
|
|---|
| 124 | $array=StringSplit($split,'//',1)
|
|---|
| 125 | $file1 = FileOpen($Fname, 1)
|
|---|
| 126 | If $file1 = -1 Then
|
|---|
| 127 | ;MsgBox(0, "Error", "Unable to open file.")
|
|---|
| 128 | Exit
|
|---|
| 129 | EndIf
|
|---|
| 130 | FOR $element IN $array
|
|---|
| 131 | ;MsgBox(0,"element",$element)
|
|---|
| 132 | if $temp=0 Then
|
|---|
| 133 | $temp=1
|
|---|
| 134 | Else
|
|---|
| 135 | FileWriteLine($file1, $element & @CRLF)
|
|---|
| 136 | endif
|
|---|
| 137 | NEXT
|
|---|
| 138 |
|
|---|
| 139 | FileClose($file1)
|
|---|
| 140 |
|
|---|
| 141 | EndFunc ;WriteToFile($split,$Fname)
|
|---|
| 142 |
|
|---|
| 143 | ;======================================================================================================================================
|
|---|
| 144 | ;To concatenate the result string to a variable
|
|---|
| 145 | ;======================================================================================================================================
|
|---|
| 146 |
|
|---|
| 147 | Func concat($var1,$check)
|
|---|
| 148 |
|
|---|
| 149 | Select
|
|---|
| 150 | Case $check = 0 ;concatenation for result variable
|
|---|
| 151 | $Result = $Result&"//"&$var1
|
|---|
| 152 | ;msgbox(0,"Result",$Result)
|
|---|
| 153 | Case $check = 1 ;concatenation for status variable
|
|---|
| 154 | $Log = $Log&"//"&$var1
|
|---|
| 155 | case $check = 2 ;concatenation for log variable
|
|---|
| 156 | $Status = $var1
|
|---|
| 157 | Case Else
|
|---|
| 158 | ;MsgBox(0, "", "No preceding case was true!",1)
|
|---|
| 159 | exit
|
|---|
| 160 | EndSelect
|
|---|
| 161 | $var1=""
|
|---|
| 162 |
|
|---|
| 163 | ;$val = $val&"//"&$var1
|
|---|
| 164 | ;return $val
|
|---|
| 165 | EndFunc
|
|---|
| 166 |
|
|---|
| 167 |
|
|---|
| 168 | ;=======================================================================================================================================
|
|---|
| 169 | ;function for cleanup
|
|---|
| 170 | ;=======================================================================================================================================
|
|---|
| 171 |
|
|---|
| 172 | func cleanup($clean)
|
|---|
| 173 | if FileDelete($clean) Then
|
|---|
| 174 | concat("sucessfully deleted the log file:" & $clean,1)
|
|---|
| 175 | Else
|
|---|
| 176 | concat("file are not deleted or do not exist:" & $clean,1)
|
|---|
| 177 | EndIf
|
|---|
| 178 | EndFunc
|
|---|
| 179 |
|
|---|
| 180 |
|
|---|
| 181 |
|
|---|
| 182 |
|
|---|
| 183 | ;======================================================================================================================================
|
|---|
| 184 | ;function for creating logfile
|
|---|
| 185 | ;======================================================================================================================================
|
|---|
| 186 |
|
|---|
| 187 | func Log_Reoprt($report,$step)
|
|---|
| 188 |
|
|---|
| 189 | If FileExists("C:\Result.doc") Then
|
|---|
| 190 | ;MsgBox(0, "C:\Result.doc", ""& $step,2)
|
|---|
| 191 | Else
|
|---|
| 192 | $oWordApp = _WordCreate (@ScriptDir & "\Result.doc", 0, 0)
|
|---|
| 193 | _WordQuit ($oWordApp, -1)
|
|---|
| 194 | ;MsgBox(0, "C:\Result.doc", "created",2)
|
|---|
| 195 | EndIf
|
|---|
| 196 |
|
|---|
| 197 | $oWordApp = _WordCreate ("")
|
|---|
| 198 | $oDoc = _WordDocOpen ($oWordApp, "C:\Result.doc",0)
|
|---|
| 199 | $oDoc.Range.insertAfter ("" & $report)
|
|---|
| 200 | _WordQuit ($oWordApp, -1)
|
|---|
| 201 |
|
|---|
| 202 | EndFunc
|
|---|
| 203 |
|
|---|
| 204 |
|
|---|
| 205 |
|
|---|
| 206 | ;======================================================================================================================================
|
|---|
| 207 | ;function fetching data from the array
|
|---|
| 208 | ;======================================================================================================================================
|
|---|
| 209 |
|
|---|
| 210 | func Path($key,$arry)
|
|---|
| 211 | For $i = 1 To $arry[0][0]
|
|---|
| 212 | if Not StringCompare($key,$arry[$i][0]) Then
|
|---|
| 213 | return $arry[$i][1]
|
|---|
| 214 | EndIf
|
|---|
| 215 | Next
|
|---|
| 216 | EndFunc
|
|---|