Jump to content

FastHelper

Active Members
  • Posts

    59
  • Joined

  • Last visited

Everything posted by FastHelper

  1. ok, i tried Shutdown(5) but no result like i want. i think only some expert or Developer can help me. am i right?
  2. @ jiim i think this is the right place/section/Area because i need help relaeted to autoit script.
  3. i am in search of way to shutdown computer very fast. i have a program which can do it for me. it can shutdown the computer in one second only after clicking the link on desktop without loosing any of my data. here is some information about this program. "The fastest way way to shutdown Windows 2000/XP/2003." Have you ever wished there was a faster way to shutdown your Windows 2000/XP/2003 computer system? I mean instantly shut it down! Now you can! Just install Super Fast Shutdown and click on one of the desktop icons created to reboot or shutdown you can free download SuperFast Shutdown 1.0 now. link: http://www.xp-smoker.com/installations/superfast.zip official web: http://www.xp-smoker.com/freeware.html i want to do like this program works by using autoit. is it possible to create some aap like this program in autoit? or can anyone tell me about the procedure of how this program works. a example would be better to understand for me because i am newbie. thanks
  4. i am just learning it and you are thinking wrong about me. i am not trying to create such thing because i also don't like it. please don't give a false colouring to what i posts. my purpose is not bad. believe me.
  5. @weaponx sorry for that i was just trying to help him. next time i will care of it.
  6. can i zip (Compress) a file or folder by autoit? how? what about Rar?
  7. @ d4rk as i told before i can unhide and delete it but the same files exists in all drives. i want to unhide them all and delete them but i want to do it in all drives but i dont know how many drives may exists i other pcs. the problem is how can i unhide and delete that file in all drives. i think it would be better if you can provide a example. if still could not understand then kindly tell me which part of my post was not clear for you. thanks.
  8. i have two files in my all root drives. 1- SR.exe 2- autorun.inf both files are super hidden and read only ( +SHR ). how can i delete all of them without changing file properties for each file and delete it? another thing is i want to get the file handle of SR.exe which is also in all root drives like in E:\ and F:\ after getting file handle of SR.exe i want to close all its running process and after that delete the file. i know i can try like this: Example: ProcessClose("SR.exe") FileSetAttrib("E:\SR.exe", "-RSH+N") FileDelete("E:\SR.exe") same method for autorun.inf file will work without closing its process. but i want some other way because i can not count drives for all pcs. i want to work my script on all pcs. both files are hidden+System+ReadOnly hope anyone will understand my problem and help me out.
  9. @ d4rk can you tell me how to get the first Dir of a drive and copy a file into it?
  10. i want to create the whole log of my program. can you give me a example?
  11. please update to latest version of autoit (Beta)
  12. Please update it to new version of autoit. so newbies can also learn about it.
  13. @ bam5 ya problem solved thanks
  14. is there any script available to check ram usage percentage? or can anyone create it? i am in search of it. and want to learn about it.
  15. Miniz & Zozel are the same Person. i think so...
  16. can i add getting ram usage percentage information in this?
  17. i want to run this code: $array = ProcessList("AutoIt3.exe") $iPID = $array[1][1] $sProcess = $iPID ;PID number for test process name ;~ $sProcess = "Idle" ;Other test process names ;~ $sProcess = "_Total" ;funny one ;~ $sProcess = "ntvdm" ;DOS process ;~ $sProcess = "AutoIt3" ;do not assign .exe to process name While 1 $iProcessCPU = _ProcessGetCPU($sProcess, 300 ) $sTip = "Process " & $sProcess & " CPU: " & $iProcessCPU & "%" traytip("", $sTip ,1) ;~ sleep(1000) ;set your own sleep time for LOOP mode WEnd Func _ProcessGetCPU($strProcess = "Idle", $iSampleTime = 500, $sComputerName = @ComputerName) ;~ All Parameters are optional: ;~ - Idle process will be measured if first parameter is not set ;~ - 500 ms is default sample time ;~ - This computer will be measured by default ;~ Process could be string ("Name") or PID number (1234) ;~ When more processes are runing with identical name, then the last opened is measured (use PID for other) ;~ For NORMAL MODE(one time measuring): set Sample value to more than 0 ms ;~ ( average CPU usage will be measured during sleep time within function) ;~ For LOOP MODE (continuous measuring): set Sample value to 0 ms ;~ ( average CPU usage will be measured between two function calls ) ;~ Total CPU usage is: ( 100 - _ProcessGetCPU()) ;~ Success: Returns process CPU usage in percent ;~ (Sample times below 100ms may return inaccurate results) ;~ (First result in Loop Mode may be inaccurate, ;~ because first call in Loop Mode is only used to trigger counters) ;~ Failure: Returns -1 ( wrong process name or PID ) ;~ : Returns -2 ( WMI service not found or Computer not found) if $strProcess = "" then $strProcess = "Idle" if $iSampleTime = "" AND IsString($iSampleTime) then $iSampleTime = 500 if $sComputerName = "" then $sComputerName = @ComputerName if not IsDeclared("iP1") AND $iSampleTime = 0 then ;first time in loop mode $bFirstTimeInLoopMode = 1 else $bFirstTimeInLoopMode = 0 endif if not IsDeclared("iP1") then assign("iP1", 0, 2) ;forced global declaration first time assign("iT1", 0, 2) endif $objWMIService = ObjGet("winmgmts:\\" & $sComputerName & "\root\CIMV2") if @error then return -2 if number($strProcess) then $strProcess = " WHERE IDProcess = '" & $strProcess & "'" else $strProcess = " WHERE Name = '" & $strProcess & "'" endif if $iSampleTime OR $bFirstTimeInLoopMode = 1 then ;skip if Loop Mode, but not First time $colItems = $objWMIService.ExecQuery ("SELECT * FROM Win32_PerfRawData_PerfProc_Process" & $strProcess) For $objItem In $colItems $iT1 = $objItem.TimeStamp_Sys100NS $iP1 = $objItem.PercentProcessorTime next if $objItem = "" then return -1 ;process not found sleep($iSampleTime) endif $colItems = $objWMIService.ExecQuery ("SELECT * FROM Win32_PerfRawData_PerfProc_Process" & $strProcess) For $objItem In $colItems $iP2 = $objItem.PercentProcessorTime $iT2 = $objItem.TimeStamp_Sys100NS next if $objItem = "" then return -1 ;process not found $iPP = ($iP2 - $iP1) $iTT = ($iT2 - $iT1) if $iTT = 0 Then return 100 ;do not divide by 0 $iCPU = round( ($iPP/$iTT) * 100, 0) $iP1 = $iP2 $iT1 = $iT2 Return $iCPU EndFunc ;==>_ProcessGetCPU() by novaTek ...ver 0.11 but got this error: Line -1: Error: Array variable has incorrect number of subscripts or subscript dimension range exceeded. please tell me what is wrong in it.
  18. It works for all optical drives (SCSI, IDE/ATA/PATA, SATA, Firewire, USB) that I have tested, though success via USB may be limited by the bridge chipset in use at the time. Here's a snippet you could combine with the above approach for locking/unlocking the drive: CODEFunc PopulateCDB_LockTray(ByRef $cdb) $fname = "PopulateCDB_LockTray" $CDBCOMMAND = 0x1E ;Prevent/Allow Medium Removal DllStructSetData($cdb, 1, $CDBCOMMAND, 1) DllStructSetData($cdb, 1, 0x00, 2) DllStructSetData($cdb, 1, 0x00, 3) DllStructSetData($cdb, 1, 0x00, 4) DllStructSetData($cdb, 1, 0x01, 5); Lock = Set bit 0 to 1 DllStructSetData($cdb, 1, 0x00, 6) DllStructSetData($cdb, 1, 0x00, 7) DllStructSetData($cdb, 1, 0x00, 8) DllStructSetData($cdb, 1, 0x00, 9) DllStructSetData($cdb, 1, 0x00, 10) DllStructSetData($cdb, 1, 0x00, 11) DllStructSetData($cdb, 1, 0x00, 12) ;The next four are not used for ATAPI compatibility, but should be set to zero anyway. DllStructSetData($cdb, 1, 0x00, 13) DllStructSetData($cdb, 1, 0x00, 14) DllStructSetData($cdb, 1, 0x00, 15) DllStructSetData($cdb, 1, 0x00, 16) EndFunc ;==>PopulateCDB_LockTray Func PopulateCDB_UnLockTray(ByRef $cdb) $fname = "PopulateCDB_UnLockTray" $CDBCOMMAND = 0x1E ;Prevent/Allow Medium Removal DllStructSetData($cdb, 1, $CDBCOMMAND, 1) DllStructSetData($cdb, 1, 0x00, 2) DllStructSetData($cdb, 1, 0x00, 3) DllStructSetData($cdb, 1, 0x00, 4) DllStructSetData($cdb, 1, 0x00, 5); Unlock = Set bit 0 to 0 DllStructSetData($cdb, 1, 0x00, 6) DllStructSetData($cdb, 1, 0x00, 7) DllStructSetData($cdb, 1, 0x00, 8) DllStructSetData($cdb, 1, 0x00, 9) DllStructSetData($cdb, 1, 0x00, 10) DllStructSetData($cdb, 1, 0x00, 11) DllStructSetData($cdb, 1, 0x00, 12) ;The next four are not used for ATAPI compatibility, but should be set to zero anyway. DllStructSetData($cdb, 1, 0x00, 13) DllStructSetData($cdb, 1, 0x00, 14) DllStructSetData($cdb, 1, 0x00, 15) DllStructSetData($cdb, 1, 0x00, 16) EndFunc ;==>PopulateCDB_UnLockTray
  19. also try this: it will work 100% for you. Purpose - Query optical drive(s) directly via SCSI or SCSI-emulation (ATAPI,USB,Firewire) to find out if their tray/door is open or closed instead of the standard methods which really query whether or not media is loaded (all of the microsoft API calls do) ;TODO - parse returned sense info from 0xBD before assuming data is OK ;TODO - support for non-drive-letter optical drives ;TODO - support for changers (both one LUN and multi-lun ones) ;----------------------------------------------------- ; Setup Globals Environment ;----------------------------------------------------- Global Const $INVALID_HANDLE_VALUE = 0xFFFFFFFF Global Const $GENERIC_READ = 0x80000000 Global Const $GENERIC_WRITE = 0x40000000 Global Const $FILE_SHARE_READ = 0x00000001 Global Const $FILE_SHARE_WRITE = 0x00000002 Global Const $OPEN_EXISTING = 3 Global Const $IOCTL_SCSI_PASS_THROUGH = 0x0004D004 ; (0x00000004 << 16) | ((0x0001 | 0x0002) << 14) | (0x0401 << 2) | 0 [from CTL_CODE macro] Global Const $SCSI_IOCTL_DATA_IN = 0x01 Global Const $SCSI_IOCTL_DATA_OUT = 0x00 Global Const $SCSI_IOCTL_DATA_UNSPECIFIED = 0x02 Global Const $SPTCDBSIZE = 0x10 ; always sixteen, IOCTL_SCSI_PASS_THROUGH requires this - windows checks to make sure the size of $spt = 44. Global Const $REALCDBSIZE = 0x0c ; twelve - more compatible than sixteen for ATAPI drives Global Const $SENSEBUFFERSIZE = 0xF0 ;240 is max (was 32, then 255, which was stupid for byte alignment reasons) Global Const $DATABUFFERSIZE = 0x0400 ;1024 should handle most calls, except IO, firmware and large changers. Increase? (was 512) ;Global Const $FSCTL_LOCK_VOLUME = 0x00090018 ;Global Const $FSCTL_UNLOCK_VOLUME = 0x00090022 ;Global Const $IOCTL_STORAGE_EJECT_MEDIA = 0x002D0808 Global $cdb Global $spt Global $sptwb ;----------------------------------------------------- ; Main Routine ;----------------------------------------------------- ;Call routine to create structures to use with DLLs CreateDLLStructures() ;Call routine to set up the CDB of this SCSI transaction's SRB, in this case 0xBD - Mechanism Status PopulateCDB() ;Call routine to set up the SCSI_PASS_THROUGH_WITH_BUFFERS stucture - this is general purpose, though the sizes of globals might need to be adjusted for certain SRBs PopulateSPTWB() ;Call routine to iterate through all of the Optical drives in the system and report on the tray status (now calls PopulateSPTWB again after each run) ShowTrayInfoForAllOpticals() Exit (0) ;----------------------------------------------------- ; Top-level Function Definitions ;----------------------------------------------------- Func CreateDLLStructures() $CDB_STRUCT = ("ubyte[" & String($SPTCDBSIZE) & "]") $SCSI_PASS_THROUGH = "ushort;ubyte;ubyte;ubyte;ubyte;ubyte;ubyte;ubyte;ubyte[3];uint;uint;uint;uint;ubyte[" & String($SPTCDBSIZE) & "]" $SCSI_PASS_THROUGH_WITH_BUFFERS = $SCSI_PASS_THROUGH & ";ubyte[" & String($SENSEBUFFERSIZE) & "];ubyte[" & String($DATABUFFERSIZE) & "]" $cdb = DllStructCreate($CDB_STRUCT) $spt = DllStructCreate($SCSI_PASS_THROUGH);used only for length calculations $sptwb = DllStructCreate($SCSI_PASS_THROUGH_WITH_BUFFERS) EndFunc ;==>CreateDLLStructures Func PopulateCDB() $CDBCOMMAND = 0xBD ;Mechanism Status in hex DllStructSetData($cdb, 1, $CDBCOMMAND, 1) DllStructSetData($cdb, 1, 0x00, 2) DllStructSetData($cdb, 1, 0x00, 3) DllStructSetData($cdb, 1, 0x00, 4) DllStructSetData($cdb, 1, 0x00, 5) DllStructSetData($cdb, 1, 0x00, 6) DllStructSetData($cdb, 1, 0x00, 7) DllStructSetData($cdb, 1, 0x00, 8) DllStructSetData($cdb, 1, 0x00, 9) DllStructSetData($cdb, 1, 0x08, 10) ;Request that the device returns only 08 bytes, which is the defined size of the header We could do more if we had a changer, which would want to give more info, but by setting 8 here, we tell the device not to send more than the header anyway. DllStructSetData($cdb, 1, 0x00, 11) DllStructSetData($cdb, 1, 0x00, 12) ;The next four are not used for ATAPI compatibility, but should be set to zero anyway. DllStructSetData($cdb, 1, 0x00, 13) DllStructSetData($cdb, 1, 0x00, 14) DllStructSetData($cdb, 1, 0x00, 15) DllStructSetData($cdb, 1, 0x00, 16) EndFunc ;==>PopulateCDB Func PopulateSPTWB() $Len_spt = DllStructGetSize($spt) ;Are these necessary if the optical drive is at a drive letter and we pass the handle, right? ;docs seem to suggest that the port driver fills these in if we are using an enumerated device $Bus = 0x00 $ID = 0x00 $Lun = 0x00 DllStructSetData($sptwb, 1, $Len_spt);Length of pre-filler to be set before making call DllStructSetData($sptwb, 2, 0x00);Checked on return from call DllStructSetData($sptwb, 3, $Bus);SCSI bus # - I believe the port driver fills this in DllStructSetData($sptwb, 4, $ID);SCSI ID # - I believe the port driver fills this in DllStructSetData($sptwb, 5, $Lun);SCSI Lun # -I believe the port driver fills this in DllStructSetData($sptwb, 6, $REALCDBSIZE);Length of CDB to be set before making call (12 for ATAPI compatibility)? DllStructSetData($sptwb, 7, $SENSEBUFFERSIZE);Length of Sense buffer to be set before making call - or always 32? DllStructSetData($sptwb, 8, $SCSI_IOCTL_DATA_IN);Flag for Data Transfer direction to be set before making call ;item #9 is simple a placehold for byte alignment, so ignore it DllStructSetData($sptwb, 10, $DATABUFFERSIZE);Length of Data buffer to be set before making call - or always 512 DllStructSetData($sptwb, 11, 0x05);Timeout for call - to be set before making call DllStructSetData($sptwb, 12, $Len_spt + $SENSEBUFFERSIZE);Offset from first byte to beginning of data buffer DllStructSetData($sptwb, 13, $Len_spt);Offset from first byte to beginning of sense buffer For $i = 1 To $SPTCDBSIZE DllStructSetData($sptwb, 14, DllStructGetData($cdb, 1, $i), $i);12 bytes of data representing the CDB Next DllStructSetData($sptwb, 15, 0x00, 1);Sense Buffer - leave alone before call DllStructSetData($sptwb, 16, 0x00, 1);Data Buffer - leave alone before call EndFunc ;==>PopulateSPTWB Func ShowTrayInfoForAllOpticals() $var = DriveGetDrive("cdrom") If Not @error Then MsgBox(4096, "Found 'em!", "Found " & $var[0] & " optical drive(s)!") For $j = 1 To $var[0] $hVolume = OpenVolume($var[$j]) If $hVolume = $INVALID_HANDLE_VALUE Then MsgBox(4096, $var[$j] & " is not a valid Optical drive", "There was no optical drive at that drive letter, or you do not have high enough access to talk to it directly.") Else MsgBox(1, "Drive found", "Hey, drive " & $var[$j] & " (" & String($hVolume) & ") is a good optical drive - let's check the tray...") If IsTrayOpen($hVolume, $var[$j]) Then MsgBox(1, "Tray Status", "The Tray for drive " & $var[$j] & " is open.") Else MsgBox(1, "Tray Status", "The Tray for drive " & $var[$j] & " is closed.") EndIf EndIf PopulateCDB() PopulateSPTWB() ; to ensure a fresh SRB each time ConsoleWrite("Closed? " & _CloseVolume($hVolume) & @LF) Next Else MsgBox(4096, "No optical drives", "There were no optical drives found in your system") EndIf EndFunc ;==>ShowTrayInfoForAllOpticals ;----------------------------------------------------- ; Lower-level Function Definitions ;----------------------------------------------------- Func IsTrayOpen(ByRef $hVolume, $drive) $LONG_type = ("ptr") $returnvalue = DllStructCreate($LONG_type) ;!!! DeviceIOControl expects ptr;long;ptr;long;ptr;long;ptr;ptr !!! $ret = DllCall( _ "kernel32.dll", "int", _ "DeviceIoControl", _ "hwnd", $hVolume, _ "int", $IOCTL_SCSI_PASS_THROUGH, _ "ptr", DllStructGetPtr($sptwb), _ "int", DllStructGetSize($spt), _ "ptr", DllStructGetPtr($sptwb), _ "int", DllStructGetSize($sptwb), _ "int_ptr", $returnvalue, _ "ptr", 0 _ ) If @error Then MsgBox(1, "EXITING...", "DeviceIoControl DLLCall failed with error level: " & String(@error) & "!") Exit (1) EndIf If $ret[0] = 0 Then _GetLastErrorMessage("Error in DeviceIoControl call to IOCTL_SCSI_PASS_THROUGH:") Exit (1) EndIf ;check the sense buffer first, otherwise the data buffer is undefined? ;guess I should learn how to do that. ;For $i = 1 To $SENSEBUFFERSIZE ; $temp = DllStructGetData($sptwb, 15, $i) ; If $temp = 0x00 Then ; Else ; MsgBox(1, "Sense Buffer Data Found", "Non zero value found at sense buffer byte [" & $i & "]: [" & $temp & "]") ; EndIf ;Next ;For $i = 1 To $DATABUFFERSIZE ; $temp = DllStructGetData($sptwb, 16, $i) ; If $temp = 0x00 Then ; Else ; MsgBox(1, "Data Buffer Data Found", "Non zero value found at data buffer byte [" & $i & "]: [" & $temp & "]") ; EndIf ;Next $second_byte = DllStructGetData($sptwb, 16, 2) ;should be the second byte ;now we need the bit here 00010000 $traystatus = BitAND($second_byte, 0x10) If $traystatus = 0x10 Then Return (True) ;MsgBox(1, "Tray Status", "The Tray for drive " & $drive & " is open.") Else Return (False) ;MsgBox(1, "Tray Status", "The Tray for drive " & $drive & " is closed.") EndIf EndFunc ;==>IsTrayOpen Func OpenVolume($cDriveLetter) ; From AUTOIT forums Local $hVolume, $uDriveType, $szVolumeName, $dwAccessFlags If StringLen($cDriveLetter) = 1 Then $cDriveLetter = $cDriveLetter & ":" ElseIf StringLen($cDriveLetter) = 2 Then ;do nothing ElseIf StringLen($cDriveLetter) = 3 Then $cDriveLetter = StringLeft($cDriveLetter, 2) Else Return $INVALID_HANDLE_VALUE EndIf Local $szRootName = $cDriveLetter & "\" $uDriveType = DriveGetType($szRootName) Select Case $uDriveType == "Removable" $dwAccessFlags = BitOR($GENERIC_READ, $GENERIC_WRITE) Case $uDriveType == "CDROM" ;We need write access in order to send scsi commands. $dwAccessFlags = BitOR($GENERIC_READ, $GENERIC_WRITE) ;$dwAccessFlags = $GENERIC_READ Case Else Return $INVALID_HANDLE_VALUE EndSelect $szVolumeName = "\\.\" & $cDriveLetter & "" ;$szVolumeName = "\\.\CdRom0" ;in addition to getting the handle, the following also verifies write access, which is required to use the scsi pass through $hVolume = DllCall( _ "kernel32.dll", "hwnd", _ "CreateFile", _ "str", $szVolumeName, _ "long", $dwAccessFlags, _ "long", BitOR($FILE_SHARE_READ, $FILE_SHARE_WRITE), _ "ptr", 0, _ "long", $OPEN_EXISTING, _ "long", 0, _ "long", 0 _ ) If @error Then MsgBox(1, "EXITING...", "CreateFile DLLCall failed!") Exit (1) EndIf Return $hVolume[0] EndFunc ;==>OpenVolume Func _CloseVolume($hVolume) Local $rVal = DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hVolume) If @error Then Return SetError(-1, -1, 0) Return $rVal[0] EndFunc ;==>_CloseVolume ;=============================================== ; _GetLastErrorMessage($DisplayMsgBox="") ; Format the last windows error as a string and return it ; if $DisplayMsgBox <> "" Then it will display a message box w/ the error ; Return Window's error as a string ;=============================================== Func _GetLastErrorMessage($DisplayMsgBox = "") Local $ret, $s Local $p = DllStructCreate("char[4096]") Local Const $FORMAT_MESSAGE_FROM_SYSTEM = 0x00001000 If @error Then Return "" $ret = DllCall("Kernel32.dll", "int", "GetLastError") $LastError = $ret[0] $ret = DllCall("kernel32.dll", "int", "FormatMessage", _ "int", $FORMAT_MESSAGE_FROM_SYSTEM, _ "ptr", 0, _ "int", $LastError, _ "int", 0, _ "ptr", DllStructGetPtr($p), _ "int", 4096, _ "ptr", 0) $s = DllStructGetData($p, 1) If $DisplayMsgBox <> "" Then MsgBox(0, "_GetLastErrorMessage", $DisplayMsgBox & @CRLF & String($LastError) & "-" & $s) Return $s EndFunc ;==>_GetLastErrorMessage maybe you will need to update it but i hope it is the last solution which will work for you. is it helpful for you?
  20. This might be the answer : If drive is open or empty it returns 0 otherwise -1 in autoit , "True " in delphi & others $strComputer = "." $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") $colItems = $objWMIService.ExecQuery( _ "SELECT * FROM Win32_CDROMDrive") For $objItem in $colItems MsgBox(4096, "","Loaded "& $objItem.MediaLoaded&@CRLF _ &" Drive: "&$objItem.Drive&@CRLF _ &" CD/DVD: "&$objItem.MediaType) Next
  21. just a idea not a working code: $DISK = DriveGetDrive("CDROM") $var = DriveStatus($DISK) For $I = 1 To $DISK[0] $STATS = DriveStatus($DISK[$I]) If $STATS = "READY" Then MsgBox(4096,"Status",$var) Else MsgBox(4096,"Status", "Drive not ready") EndIf you need to work on it to work properly. i am just giving you idea that how can you do it. for more help see help file and find and see DriveGetDrive DriveStatus
  22. @ PlastyDs can we write the whole log of a program without adding for every line to write the log.
  23. if you can tell what this program "Deep Freeze" is and what it can do. then everyone will be able to help you. because only a few people may know about this program.
  24. thanks buddy, its working perfect.
  25. its very simple: FileDelete("C:\*.doc") you should start learning it by creating some simple GUI and reading the help file.
×
×
  • Create New...