Jump to content

mikiutama

Active Members
  • Posts

    70
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

mikiutama's Achievements

Wayfarer

Wayfarer (2/7)

1

Reputation

  1. ........... post deleted..........
  2. MsgBox(0,"",'"This is an example!"')
  3. 1. read the attached help file!! 2. motherboard and cdrom can be retrieved from registry... again read the help file!! all examples are included in there...
  4. that Application Tab is for open windows... just use winlist from help file to display.. here written in help file.. $var = WinList() For $i = 1 to $var[0][0] ; Only display visble windows that have a title If $var[$i][0] <> "" AND IsVisible($var[$i][1]) Then MsgBox(0, "Details", "Title=" & $var[$i][0] & @LF & "Handle=" & $var[$i][1]) EndIf Next Func IsVisible($handle) If BitAnd( WinGetState($handle), 2 ) Then Return 1 Else Return 0 EndIf EndFunc
  5. taken from this site... somewhere by PsaltyDS... #include <array.au3> ; for _ArrayDisplay() $avRET = _ProcessListProperties() _ArrayDisplay($avRET, "Debug: $avProcs, @error = " & @error) ;=============================================================================== ; Function Name: _ProcessListProperties() ; Description: Get various properties of a process, or all processes ; Call With: _ProcessListProperties( [$Process [, $sComputer]] ) ; Parameter(s): (optional) $Process - PID or name of a process, default is all ; (optional) $sComputer - remote computer to get list from, default is local ; Requirement(s): AutoIt v3.2.4.9+ ; Return Value(s): On Success - Returns a 2D array of processes, as in ProcessList() ; with additional columns added: ; [0][0] - Number of processes listed (can be 0 if no matches found) ; [1][0] - 1st process name ; [1][1] - 1st process PID ; [1][2] - 1st process Parent PID ; [1][3] - 1st process owner ; [1][4] - 1st process priority (0 = low, 31 = high) ; [1][5] - 1st process executable path ; [1][6] - 1st process CPU usage ; [1][7] - 1st process memory usage ; ... ; [n][0] thru [n][7] - last process properties ; On Failure: Returns array with [0][0] = 0 and sets @Error to non-zero (see code below) ; Author(s): PsaltyDS at http://www.autoitscript.com/forum ; Notes: If a numeric PID or string process name is provided and no match is found, ; then [0][0] = 0 and @error = 0 (not treated as an error, same as ProcessList) ; This function requires admin permissions to the target computer. ; All properties come from the Win32_Process class in WMI. ;=============================================================================== Func _ProcessListProperties($Process = "", $sComputer = ".") Local $sUserName, $sMsg, $sUserDomain, $avProcs If $Process = "" Then $avProcs = ProcessList() Else $avProcs = ProcessList($Process) EndIf ; Return for no matches If $avProcs[0][0] = 0 Then Return $avProcs ; ReDim array for additional property columns ReDim $avProcs[$avProcs[0][0] + 1][8] ; Connect to WMI and get process objects $oWMI = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & $sComputer & "\root\cimv2") If IsObj($oWMI) Then ; Get collection of all processes from Win32_Process $colProcs = $oWMI.ExecQuery ("select * from win32_process") If IsObj($colProcs) Then ; For each process... For $oProc In $colProcs ; Find it in the array For $n = 1 To $avProcs[0][0] If $avProcs[$n][1] = $oProc.ProcessId Then ; [n][2] = Parent PID $avProcs[$n][2] = $oProc.ParentProcessId ; [n][3] = Owner If $oProc.GetOwner ($sUserName, $sUserDomain) = 0 Then $avProcs[$n][3] = $sUserDomain & "\" & $sUserName ; [n][4] = Priority $avProcs[$n][4] = $oProc.Priority ; [n][5] = Executable path $avProcs[$n][5] = $oProc.ExecutablePath ExitLoop EndIf Next Next Else SetError(2) ; Error getting process collection from WMI EndIf ; Get collection of all processes from Win32_PerfFormattedData_PerfProc_Process ; Have to use an SWbemRefresher to pull the collection, or all Perf data will be zeros Local $oRefresher = ObjCreate("WbemScripting.SWbemRefresher") $colProcs = $oRefresher.AddEnum ($oWMI, "Win32_PerfFormattedData_PerfProc_Process" ).objectSet $oRefresher.Refresh ; Time delay before calling refresher Local $iTime = TimerInit() Do Sleep(10) Until TimerDiff($iTime) > 100 $oRefresher.Refresh ; Get PerfProc data For $oProc In $colProcs ; Find it in the array 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) ; Error connecting to WMI EndIf ; Return array Return $avProcs EndFunc ;==>_ProcessListProperties
  6. this depends on the program that opens the file if you're using notepad++ (and make it the default for opening text), it has tabbed setting that can open simultaneous files in one .exe just use shellexecute..
  7. i found an old version here in this forum... which is very fast compare to yours... tested with 25.6kb file: yours take >>1.93s the old one is >>0.16s (maybe because it doesnt have a progress bar...) here's the source: $Reg = FileOpenDialog("Choose a registry file", @ScriptDir, "Registry Files (*.reg)", 1) If @error = 1 Then Exit $Dir = StringLeft($Reg, StringInStr($Reg, '\', 0, -1) - 1) $NewReg = FileSaveDialog("Choose a file name", $Dir, "Scripts (*.au3)", 16) If StringRight($NewReg, 4) <> ".au3" Then $NewReg &= ".au3" If @error = 1 Then Exit $timer = TimerInit() RunWait(@ComSpec & ' /c TYPE "' & $Reg & '" > "%TEMP%\' & GetFilename($Reg) & '"', @SystemDir, @SW_HIDE) $Reg = @TempDir & "\" & GetFilename($Reg) $OpenReg = FileOpen($Reg, 0) $OpenNewReg = FileOpen($NewReg, 2) MsgBox(0, "Complete!", "Process completed in " & Round(TimerDiff($timer) / 1000, 2) & " seconds") Dim $Key Dim $valuename Global $Oldvalue = "" $value = "" $Type = "" $Write = "Yes" $Continue1 = "No" $Continue2 = "No" $Continue3 = "No" $Line = FileReadLine($OpenReg, 2) $Line = "" While 1 $Line = FileReadLine($OpenReg) If @error Then ExitLoop If StringLeft($Line, 1) = ' ' Then $value = $Line If $Continue1 = "Yes" Then $Type = "REG_BINARY" If StringRight($value, 1) = "\" Then $value = StringTrimRight($value, 1) $Oldvalue = $Oldvalue & $value $Continue1 = "Yes" $Write = "No" Else $Oldvalue = $Oldvalue & $Line $Match1 = StringInStr($Oldvalue, ":") If $Match1 >= 1 Then $Oldvalue = StringTrimLeft($Oldvalue, $Match1) $value = StringReplace($Oldvalue, ",", "") $value = Chr(34) & StringStripWS($value, 8) & Chr(34) $Oldvalue = "" $Continue1 = "No" $Write = "Yes" EndIf ElseIf $Continue2 = "Yes" Then $Type = "REG_EXPAND_SZ" If StringRight($value, 1) = "\" Then $value = StringTrimRight($value, 1) $Oldvalue = $Oldvalue & $value $Continue2 = "Yes" $Write = "No" Else $Oldvalue = $Oldvalue & $Line $value = Chr(34) & CharsToString (StringStripWS($Oldvalue, 8)) & Chr(34) $Oldvalue = "" $Continue2 = "No" $Write = "Yes" EndIf ElseIf $Continue3 = "Yes" Then $Type = "REG_MULTI_SZ" If StringRight($value, 1) = "\" Then $value = StringTrimRight($value, 1) $Oldvalue = $Oldvalue & $value $Continue3 = "Yes" $Write = "No" Else $Oldvalue = $Oldvalue & $Line $value = Chr(34) & CharsToString (StringStripWS($Oldvalue, 8)) & Chr(34) $Oldvalue = "" $Continue3 = "No" $Write = "Yes" EndIf EndIf If $Write = "Yes" Then FileWrite($OpenNewReg, 'RegWrite("' & $Key & '", ' & $valuename & ', "' & $Type & '", ' & $value & ')' & @CRLF) EndIf If $Line <> "" Then Select Case StringLeft($Line, 1) = ";" FileWrite($OpenNewReg, $Line & @CRLF) Case StringLeft($Line, 1) = "[" If StringRight($Line, 1) = " " Then $Key = StringTrimRight($Line, 2) Else $Key = StringTrimRight($Line, 1) EndIf $Key = StringTrimLeft($Key, 1) If StringLeft($Key, 1) = "-" Then FileWrite($OpenNewReg, 'RegDelete("' & StringTrimLeft($Key, 1) & '")' & @CRLF) Case StringLeft($Line, 1) = '@' $value = StringTrimLeft($Line, 2) $value = StringReplace($value, '\\', '\') If Not StringLen($value) = 2 Then $value = StringReplace($value, '""', '"') If StringLeft($value, 1) = "-" Then FileWrite($OpenNewReg, 'RegDelete("' & $Key & '", "")' & @CRLF) Else FileWrite($OpenNewReg, 'RegWrite("' & $Key & '", "", "REG_SZ", ' & $value & ')' & @CRLF) EndIf Case StringLeft($Line, 1) = '"' $line_split = StringSplit($Line, "=") $valuename = $line_split[1] $value = $line_split[2] If StringInStr($value, 'hex:') >= 1 Then $Type = "REG_BINARY" If StringRight($value, 1) = "\" Then $value = StringTrimRight($value, 1) $Oldvalue = $value $Continue1 = "Yes" $Write = "No" Else $value = StringReplace($value, ",", "") $Match1 = StringInStr($value, ":") If $Match1 >= 1 Then $value = StringTrimLeft($value, $Match1) $value = Chr(34) & StringStripWS($value, 8) & Chr(34) $Continue1 = "No" $Write = "Yes" EndIf $Match1 = StringInStr($value, ":") If $Match1 >= 1 Then $value = StringTrimLeft($value, $Match1) ElseIf StringInStr($value, "hex(2):") >= 1 Then $Type = "REG_EXPAND_SZ" If StringRight($value, 1) = "\" Then $value = StringTrimRight($value, 1) $Oldvalue = $value $Continue2 = "Yes" $Write = "No" Else $value = Chr(34) & CharsToString (StringStripWS($value, 8)) & Chr(34) $Continue2 = "No" $Write = "Yes" EndIf ElseIf StringInStr($value, "hex(7)") >= 1 Then $Type = "REG_MULTI_SZ" If StringRight($value, 1) = "\" Then $value = StringTrimRight($value, 1) $Oldvalue = $value $Continue3 = "Yes" $Write = "No" Else $value = Chr(34) & CharsToString (StringStripWS($value, 8)) & Chr(34) $Continue3 = "No" $Write = "Yes" EndIf ElseIf StringLeft($value, 5) = "dword" Then $Type = "REG_DWORD" $value = StringTrimLeft($value, 6) If StringLeft($value, 1) = "0" Then For $i = 1 To StringLen($value) $Char = StringMid($value, $i, 1) If $Char <> "0" Then ExitLoop Next $value = StringTrimLeft($value, ($i - 1)) If $value = "" Then $value = "0" EndIf If StringLeft($value, 1) <> '"' And StringRight($value, 1) <> '"' Then $value = '"' & $value & '"' Else $Type = "REG_SZ" EndIf $value = StringReplace($value, '\\', '\') If Not StringLen($value) = 2 Then $value = StringReplace($value, '""', '"') If StringLeft($value, 1) = "-" Then FileWrite($OpenNewReg, 'RegDelete("' & $Key & '", ' & $valuename & ')' & @CRLF) Else If $Write = "Yes" Then FileWrite($OpenNewReg, 'RegWrite("' & $Key & '", ' & $valuename & ', "' & $Type & '", ' & $value & ')' & @CRLF) EndIf EndSelect Else FileWrite($OpenNewReg, @CRLF) EndIf Wend FileClose($OpenNewReg) Exit Func CharsToString ($Instring) Local $Match1 Local $Type $Match1 = StringInStr($Instring, ":") If $Match1 >= 1 Then $Instring = StringTrimLeft($Instring, $Match1) Dim $Temparray, $Count $Instring = StringReplace($Instring, " ", "") ;Remove trailing nulls While StringRight($Instring, 3) = ",00" $Instring = StringTrimRight($Instring, 3) Wend ;Create an array of character values and build string $Temparray = StringSplit($Instring, ",") $Instring = "" $x = 0 For $Count = 1 To $Temparray[0] If $Temparray[$Count] <> "00" Then $Instring = $Instring & Chr(Dec($Temparray[$Count])) ;convert hex to dec then get character value and append to return string $x = 0 Else $x = $x + 1 If $x = 3 Then $x = 0 $Instring = $Instring & '" & @LF & "' EndIf EndIf Next Return $Instring EndFunc Func Debug ($message) Select Case $message = "#open" Opt ("WinTitleMatchMode", 2) Run("notepad") WinWait("Untitled", "") WinSetTitle("Untitled", "", "Debug Window") Case Else ControlSend("Debug Window", "", "Edit1", $message) EndSelect EndFunc ;==>Debug Func GetFilename($Path) Local $TempArr Local $Filename $TempArr = StringSplit($Path, "\") If @error Then $Filename = $Path Else $Filename = $TempArr[UBound($TempArr) - 1] EndIf Return $Filename EndFunc
  8. maybe left any passwords for the https? or maybe thru ftp? any firewalls/AV blocking?
  9. use fileexist.. If FileExist(@ScriptDir & '\TN\company\Auto\filename.pdf') then ShellExecute (@ScriptDir & '\TN\company\Auto\filename.pdf') Else InetGet('https://website/webform/PDFs/filename.pdf', @ScriptDir & '\TN\company\Auto\filename.pdf') EndIf
  10. i tried this and yes it works... but it did gave error about variable not declared.. just click "Continue Anyway" and it works..
  11. yes, the file can be renamed while its running... i just did.. but it cannot be deleted... try it yourself... run the file i attached then drag that file into list view and click "Start Shredding" you'll see... or if you dont trust the .exe, here's the source... (the file is working but not yet finished...)
  12. i get this error using v3.2.10.0 why?
  13. or if you really want to know how it's script looks like... just open string.au3 inside include folder...
×
×
  • Create New...