Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/23/2024 in all areas

  1. Try this : #include <Excel.au3> Local $oExcel = _Excel_Open() Local $oWorkBook = _Excel_BookOpen($oExcel, @ScriptDir & "\Test1.xlsx") Local $oRange = $oWorkBook.Sheets(1).Range("A1:A8") Local $aList[$oRange.count], $i = 0, $oComment For $oCell in $oRange $aList[$i] = $oCell.value $oComment = $oCell.comment $aList[$i] &= "|" & (IsObj($oComment) ? $oComment.text : "") $i += 1 Next _ArrayDisplay($aList)
    2 points
  2. Glad you like it. I will sure use it from time to time. It is simple and fast.
    1 point
  3. Another approach would be to create a map of array where each key is the folder name and the array is the list of file names within that folder...Would be kind of nice to have it. Well, it seems I found my idea too tempting : #include <Array.au3> Opt("MustDeclareVars", True) Global $mList[] FileListRecToMap($mList, "C:\Apps\AutoIt\Files\") For $sKey In MapKeys($mList) _ArrayDisplay($mList[$sKey], $sKey) Next Func FileListRecToMap(ByRef $mList, $sFolder) Local Static $oShell = ObjCreate("Shell.Application") Local $oFolder = $oShell.NameSpace($sFolder) If Not IsObj($oFolder) Then Return 1 Local $oFolderItems = $oFolder.Items() $oFolderItems.Filter(0x40, "*") Local $aList[$oFolderItems.count], $i = 0 For $oFile In $oFolderItems $aList[$i] = $oFile.name $i += 1 Next $mList[$sFolder] = $aList $oFolderItems.Filter(0x20, "*") For $oFolderItem In $oFolderItems FileListRecToMap($mList, $oFolderItem.path) Next EndFunc ;==>FileListRecToMap
    1 point
  4. queensoft, Back before I wrote the _FileListToArrayRec function, people were clamouring for a single function to return a single listing (with suitable filters) rather than having to recursively list each subfolder and then list the files within them. So the recursive function was added to the standard library (after a fair amount of, at times, heated discussion) to return the consolidated list. As a matter of interest the sorting part of the recursive function internally splits the single returned list into separate folders to help in sorting - the recursively found folders and files within them are not necessarily returned in the expected order and so need to be extracted and reordered. You might well be able to modify that code to return an "array of arrays" where each element holds the content of a single subfolder - but forget the standard function itself being modified to do that! M23
    1 point
  5. It isn't complicated using WD_Demo. Here's a modified version of the UserTesting function that demonstrates the minimal code required -- Func UserTesting() ; if necessary, you can modify the following function content by replacing, adding any additional function required for testing within this function Local $vResult $vResult = _WD_Navigate($sSession, 'https://www.msn.com/en-us/weather/maps/temperature/in-Fastov,Kyiv') If @error Then Return SetError(@error, @extended, $vResult) $vResult = _WD_LoadWait($sSession, 10, Default, Default, $_WD_READYSTATE_Interactive) If @error Then Return SetError(@error, @extended, $vResult) ; Pause to allow page to fully load ; You could use _WD_WaitElement here instead Sleep(5000) $sHTML = _WD_GetSource($sSession) If @error Then Return SetError(@error, @extended, $vResult) FileWrite(@ScriptDir & "\source.html", $sHTML) EndFunc ;==>UserTesting
    1 point
  6. faustf, I'm pretty sure your life will be much easier if you find yourself a job where you can use your hands. And neither on a mouse nor a keyboard.
    1 point
  7. Something like this: #include <Array.au3> Global $sFileToCheck = "C:\temp\test.txt" Global $bFileChanged = False Global $sFileDateTime = _ArrayToString(FileGetTime($sFileToCheck)) AdlibRegister("_CheckFile", 250) ; GUI creation etc goes here GUISetState(@SW_SHOW, $Form) While 1 If $bFileChanged Then MsgBox(0, "Info", "File has changed") $sFileDateTime = _ArrayToString(FileGetTime($sFileToCheck)) $bFileChanged = False EndIf $nMsg = GUIGetMsg() Switch $nMsg Case... Case... Case... EndSwitch WEnd Func _CheckFile() If $sFileDateTime <> _ArrayToString(FileGetTime($sFileToCheck)) Then $bFileChanged = True EndFunc ;==>_CheckFile
    1 point
×
×
  • Create New...