Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/11/2021 in all areas

  1. You could look at _SQLite_GetTable2d in the helpfile. There are examples there.
    1 point
  2. Aye, the dos functions will be quicker, so for simple things it maybe worthwhile keeping those. I have done another function to fill the list which doesn't use a file write and read and runs diskpart directly. You can swap it with the DiskList and remove the 3 lines after DirCreate(GetCachePath()) Func GetDiskListings() Local $i_PID = Run('diskpart.exe', @SystemDir, @SW_HIDE, BitOR($STDIN_CHILD, $STDOUT_CHILD)) StdinWrite($i_PID, 'list disk') StdinWrite($i_PID) Local $s_STDOUT = '' Local $s_Ret = '' While 1 $s_STDOUT = StdoutRead($i_PID) If @error Then ExitLoop ; clean up the string and add it to the return if it has disk info If StringRegExp($s_STDOUT, '(?i)Disk [\d]+') Then $s_Ret &= StringReplace(StringRegExpReplace($s_STDOUT, '[\s|]*$', ''), @crlf, '') & '|' WEnd Return $s_Ret EndFunc
    1 point
  3. Jos

    Auto refresh label in GUI

    Nah, you don't want that assuming the GuiGetMsg() is still in that loop giving the 10msecs pause already.
    1 point
  4. Local $aLines = StringSplit($line, @CRLF) Local $sLastLine = $aLines[(UBound($aLines) - 1)]
    1 point
  5. The command is executed and once completed the console is read. You could split $line with @CRLF and loop through the return array?
    1 point
  6. Interesting that your only comment on the subject relates to copyright. But isn't the AutoIt help part of the AutoIt project? I think it is. And therefore the AutoIt copyright applies to it. Or do you see it differently? And with that your objection is invalid, isn't it?
    1 point
  7. Thank you to both of you! I continued with the recommendation from "bobomb" since my small brain understood that script better It seems to work just fine. It might lag a bit, but that's probably since the file I am reading from is only accessible with my VPN connected, so that might be why. Posting a part of the script down below Really appreciated both of you taking your time to help me! Global $AccessKnown = 0, $iniValue, $Label21 = GUICtrlCreateLabel("Checking access", 50, 10, 275, 20) GUICtrlSetFont(-1, 11, 800, 0, "Calibri") $IconAccess = GUICtrlCreateIcon("shell32.dll", 323, 10, 1) Sleep(500) #EndRegion ### END Koda GUI section ### While 1 Global $iniAccess = IniRead('\\z30ar1cfvs010\brandapp$\Installation\Brand.ini', 'Access', 'Connection', 'Missing') If $AccessKnown = 0 Then If Not ($iniAccess = 'Missing') Then GUICtrlSetData($Label21, "Access OK") GUICtrlSetColor($Label21, 0x32CD32) GUICtrlSetImage($IkonAccess, "shell32.dll", 16802) $AccessKnown = 1 EndIf EndIf If $AccessKnown = 1 Then If $iniAccess = 'Missing' Then GUICtrlSetData($Label21, "Access missing") GUICtrlSetColor($Label21, 0xFF0000) GUICtrlSetImage($IkonAccess, "shell32.dll", 200) $AccessKnown = 0 EndIf EndIf
    1 point
  8. @bobomb, does this work? Func CopyDataFilesD() Local $GoFiles = ($CachePath & $finaldirs), $StartProgAt, $xcopycmd, $line = "" FileOpen($GoFiles, 0) Local $aArray[1000] ReDim $aArray[_FileCountLines($GoFiles) + 1] For $i = 1 To _FileCountLines($GoFiles) $newline = FileReadLine($GoFiles, $i) $aArray[$i] = $newline Next _ArraySort($aArray) $StartProgAt = 65 For $i = 1 To UBound($aArray) - 1 $xcopycmd = Run('cmd /c xcopy ' & $MountedDrive & ':\' & $aArray[$i] & ' ' & $dataDrive & ':\' & $aArray[$i] & ' /i /s /e /h /r /v /y', @WorkingDir, @SW_HIDE, 2) ProcessWaitClose($xcopycmd) $line = StdoutRead($xcopycmd) If $aArray[$i] = "Programs" Then ProgressSet($StartProgAt & "%", "Copying " & $line) $StartProgAt = ($StartProgAt + 15) Else ProgressSet($StartProgAt & "%", "Copying " & $line) $StartProgAt = ($StartProgAt + 1) EndIf Next EndFunc ;==>CopyDataFilesD You may want to write $line to the Console to see what's been returned by StdoutRead.
    1 point
  9. spudw2k

    Robocopy

    I believe the robocopy /COPYALL parameter/flag should accommodate retaining the timestamps and permissions /COPYALL :: COPY ALL file info (equivalent to /COPY:DATSOU) /COPY:copyflag[s] :: what to COPY for files (default is /COPY:DAT). (copyflags : D=Data, A=Attributes, T=Timestamps, X=Skip alt data streams). (S=Security=NTFS ACLs, O=Owner info, U=aUditing info). As far as emailing, you could use the Run function of AutoIt to start the process and therefore see when it has completed, then trigger an email using other means. edit: this if just for the NTFS permissions, robocopy doesn't account for the share permissions.
    1 point
  10. Run("NET USE \\computername\IPC$ mypassword /USER:myuser") Run("shutdown /m \\computername /r /t 0") You could do it this way.
    1 point
×
×
  • Create New...