
Stretch
Active Members-
Posts
28 -
Joined
-
Last visited
Stretch's Achievements

Seeker (1/7)
0
Reputation
-
I had to do this in a project I did. With some help from ChrisL at work, I used this. #include <Date.au3> $aTSB = DllCall ("kernel32.dll", "long", "GetTickCount") $ticksSinceBoot = $aTSB[0] dim $iHours, $iMins, $iSecs _TicksToTime ( $ticksSinceBoot, $iHours, $iMins, $iSecs ) $iDays = int($iHours / 24) $iHours = $iHours - ($iDays * 24) $uptime = ($iDays& " days, "&$iHours &" hours, "&$iMins & " Minutes, and "&$iSecs& " Seconds" ) msgbox(0,"Computer Uptime",$uptime) Hope it helps.
-
Cock on Thank you very much.
-
Hiya I need to convert a decimal time, eg 3.7 into real time eg 3:42. I have not a clue where to start on this. Any ideas?
-
Could do, but speed is the issue here to reduce down time.... Its a full 600mb cd and would take a while to copy to the hard drive. There must be another way....
-
Hey Ive got an update that runs from a CD. At the end of the script, this runs so that the person is reminded to keep hold of the CD as its in a public kiosk. If @Compiled Then CDTray(StringLeft(@ScriptFullPath, 2), "open") Windows errors because the exe thats running has been ejected. Any ideas of a neat way to overcome this?
-
Its just a plain text file, called autorun.inf that has to be on the root of the device. It has to have the layout of an ini file. [autorun] open=setup.exe icon=icon.ico
-
This is my version, with some help from ChrisL You have the same problem as me - Getting the name of the actual network card. My script is designed to run on 2 different types of touch screen computer - hence the keypad, but i have no way of getting the name of the card from windows. It also relies on the NetSh being in the same directory as the scrpit, as im not sure of the legality of fileinstalling it. SetIP.au3
-
Moving a tree using FileMove or DirMove
Stretch replied to c.haslam's topic in AutoIt General Help and Support
Works for me... -
#include <Array.au3> #include <GuiConstants.au3> $var = DriveGetDrive( "all" ) Dim $avArray[1] If NOT @error Then For $i = 1 to $var[0] $type=DriveGettype($var[$i]) $ready = DriveStatus($var[$i]) ;$name=DriveGetLabel($var[$i]) if $type = "Removable" and $ready = "Ready" then ;DirCreate("d:\cardtest\" & StringTrimRight($var[$i],1)) ProgressCopy($var[$i] & "\","d:\cardtest\" & StringTrimRight($var[$i],1)) $before = DirGetSize($var[$i] & "\",1) $after = DirGetSize("d:\cardtest\" & StringTrimRight($var[$i],1) & "\",1) Msgbox(0,"Files on media " & $var[$i] & "\" ,$before[1],1) Msgbox(0,"Files Copied from " & $var[$i] & "\",$after[1],1) If $before[1] = $after[1] then _ArrayAdd( $avArray,$var[$i]) Else msgbox(0,"","Issue with Drive " & $var[$i]) EndIf EndIf Next EndIf _ArraySort($avArray) $string="" For $i = 1 to Ubound ($avArray) -1 $String = $String & $avArray[$i] & @crlf Next msgbox(0,"","The were "&($i-1)&" media successfully copied!"&@CRLF&@CRLF&$String) msgbox(0,"","Press to run exit and remove copied data.") DirRemove("d:\cardtest\",1) Func ProgressCopy($current, $destination, $UseMultiColour=0, $attrib = "-R", $overwrite = 1 ,$createDir = 1 ,$Run1 = 0 ) ;FirstTimeRun Get original DirSize and set up Gui If $Run1 = 0 Then If $createDir > 0 then $createDir = 8 Global $OverallQty, $Overall, $source, $overallpercent, $Progress0Text, $progressbar1, $Progress1Text, $progressbar2, $Progress2Text, $LocalPercent, $mustRestart=0 DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", 0) If not FileExists ($Destination) then DirCreate ($Destination); This is why it was failing, the dir did not exist $source = $current If StringRight($current, 1) = '\' Then $current = StringTrimRight($current, 1) If StringRight($destination, 1) <> '\' Then $destination = $destination & "\" $tosearch = $current $Overall = DirGetSize($tosearch, 1) $OverallQty = $Overall[1] Global $PrCopyGui = GUICreate("Copying Files", 420, 100, -1, -1, -1, $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST) $Progress0Text = GUICtrlCreateLabel("Please Wait", 10, 5, 400, 20, $SS_LEFTNOWORDWRAP) $progressbar1 = GUICtrlCreateProgress(10, 20, 400, 20) GUICtrlSetColor(-1, 32250) $Progress1Text = GUICtrlCreateLabel("", 10, 44, 400, 20, $SS_LEFTNOWORDWRAP) $progressbar2 = GUICtrlCreateProgress(10, 60, 400, 20, $PBS_SMOOTH) $Progress2Text = GUICtrlCreateLabel("", 10, 82, 400, 20, $SS_LEFTNOWORDWRAP) GUISetFont(10, 600) GUICtrlSetColor(-1, 32250); not working with Windows XP Style if not using windows classic style or dllcall above GUISetState(@SW_SHOW) GUICtrlSetData($Progress1Text, "Working Directory " & $tosearch) $Run1 = 1 EndIf $Size = DirGetSize($current, 3) $Qty = $Size[1] Local $search = FileFindFirstFile($current & "\*.*") While 1 Dim $file = FileFindNextFile($search) If @error Or StringLen($file) < 1 Then ExitLoop If Not StringInStr(FileGetAttrib($current & "\" & $file), "D") And ($file <> "." Or $file <> "..") Then $Qty -= 1 $LocalPercent = 100 - (($Qty / $Size[1]) * 100) $OverallQty -= 1 $overallpercent = 100 - (($OverallQty / $Overall[1]) * 100) GUICtrlSetData($Progress0Text, "Total Progress " & Int($overallpercent) & "% completed") GUICtrlSetData($progressbar1, $overallpercent) GUICtrlSetData($progressbar2, $LocalPercent) GUICtrlSetData($Progress2Text, "Copying File " & $file) If $useMultiColour then GUICtrlSetColor($Progressbar2, _ChangeColour($LocalPercent)) GUICtrlSetColor($Progressbar1, _ChangeColour($OverallPercent)) EndIf $success = FileCopy($current & "\" & $file, $destination & StringTrimLeft($current, StringLen($source)) & "\" & $file,$overwrite + $createDir) FileSetAttrib($destination & StringTrimLeft($current, StringLen($source)) & "\" & $file, $attrib) If $success = 0 Then FileCopy($current & "\" & $file, @tempdir & StringTrimLeft($current, StringLen($source)) & "\" & $file,9) _CopyAfterRestart(@tempdir & StringTrimLeft($current, StringLen($source)) & "\" & $file,$destination & StringTrimLeft($current, StringLen($source)) & $file) $mustRestart=1 EndIf EndIf If StringInStr(FileGetAttrib($current & "\" & $file), "D") And ($file <> "." Or $file <> "..") Then DirCreate($destination & StringTrimLeft($current, StringLen($source)) & "\" & $file) FileSetAttrib($destination & StringTrimLeft($current, StringLen($source)) & "\" & $file, $attrib) GUICtrlSetData($Progress1Text, $current & "\" & $file) ProgressCopy($current & "\" & $file, $destination, $UseMultiColour, $attrib, $createDir, $overwrite,1) EndIf WEnd FileClose($search) ;when overall percent = 100 set end gui text, delete gui and reset run1 to 0 If $overallpercent = 100 Then GUICtrlSetData($Progress0Text, "Total Progress 100% completed") GUICtrlSetData($progressbar1, 100) GUICtrlSetData($progressbar2, 100) GUICtrlSetData($Progress2Text, "Done!") Sleep(2000) GUIDelete($PRCopyGui) $Run1 = 0 If $mustRestart = 1 then Msgbox (0,"Warning","You must restart your computer for all the copied files to take effect",10) EndIf EndFunc ;==>ProgressCopy
-
I've got a script that copies images from various removable media drives. It checks all drives in my computer, and if it is removable and ready, then it checks to see how many images are on the media, copies them to a temp directory and checks how many were copied. It is designed to check if multi media card readers work on all slots. Problem is, if a media card is removed mid copy, then the script bombs. What kind of error handling can i do on it, so that if the media is removed, the script continues. Stretch.
-
Read 1 word from a couple of lines?
Stretch replied to Illusion's topic in AutoIt General Help and Support
Try using StringInStr to search for a specific word in $text -
Hello Really simple question im sure - I cant think of how to do this. I have a program that has some message boxes pop up with user questions. I want to put an image covering the desktop, but have my boxes apear ontop. Ive got this - SplashImageOn ("" , "DPC6.jpg ",1024,768, -1 , -1 , 3 ) But it goes as soon as a message box appears... Any ideas how i can make it stay on? MArk.
-
Thanks, Worked like a dream! mark.
-
Im trying to get some code together to show how long a system has been up for... So far have this - $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $colItems = "" $strComputer = "localhost" $Output="" ;$Output = $Output & "Computer: " & $strComputer & @CRLF ;$Output = $Output & "==========================================" & @CRLF $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_OperatingSystem", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) then For $objItem In $colItems $Output = $Output & WMIDateStringToDate($objItem.LastBootUpTime) & @CRLF ;if Msgbox(1,"WMI Output",$Output) = 2 then ExitLoop ;$Output="" Next Else ;Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_OperatingSystem" ) Endif Func WMIDateStringToDate($dtmDate) Return (StringLeft($dtmDate, 4) & "/" & _ StringMid($dtmDate, 5, 2) & "/" & StringMid($dtmDate,7,2 ) _ & " " & StringMid($dtmDate, 9, 2) & ":" & StringMid($dtmDate, 11, 2) & ":" & StringMid($dtmDate,13, 2)) EndFunc ;============================================================================================ $now=@CRLF & @YEAR&"/" & @MON&"/" &@MDAY &" "&@HOUR &":" &@MIN &":" &@SEC MsgBox(0,"",_DateDiff('h',$Output,$now)) Which gives me 18 at the moment. I want someting like - System on for Xdays, Xhours and Xmins. Any ideas?