
DigDeep
Active Members-
Posts
430 -
Joined
-
Last visited
DigDeep's Achievements

Universalist (7/7)
2
Reputation
-
Hi, I have a Powershell script which I cannot capture output in any external format of text or any other file and I want AutoIT to read the Output ($Result). Is that doable? Powershell Output capture: if ($data -match $GetOps) { $Result = "True" } ELse{ $Result = "False" } AutoIT: Local $PScript = "C:\Test.ps1" Local $Txt = "", $sSTDout = "" Local $RunCMD = "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -command . '" & $PScript & "'" Local $pid = Run($RunCMD, @SystemDir, @SW_HIDE, $STDIN_CHILD + $STDOUT_CHILD + $STDERR_CHILD) StdinWrite($pid) $GetOutput = StdoutRead($pid) While 1 $GetOutput = StdoutRead($pid) If @error Then ExitLoop If $GetOutput <> "" Then MsgBox("", "", $GetOutput) EndIf WEnd Problem is running this, I am able to capture the Powershell PID but not the output. Please help...
-
I have a URL which directly gives the Save AS window as per in the attachment. Can anyone suggest how can I make the URL launch silent and then use the SEND key for SAVE AS to save on the Desktop?
-
PnD reacted to a post in a topic: Date Format change
-
ObjCreate error while performing on Excel Rows
DigDeep replied to DigDeep's topic in AutoIt General Help and Support
@water, not to rush but just wanted to check if anything was found on the error. Thanks again for checking. -
ObjCreate error while performing on Excel Rows
DigDeep replied to DigDeep's topic in AutoIt General Help and Support
@water AutoIT version: 3.3.14.5 Excel version: Excel 2016 Results.xls -
ObjCreate error while performing on Excel Rows
DigDeep replied to DigDeep's topic in AutoIt General Help and Support
@water My bad. I have that added already. Missed to provide that in the above code. The error happens at the below line when the Rows count happens. If $sTab7 = $ID Or $sTab7 = $Inst Then Local $iCountLines = $oWorkbook.ActiveSheet.UsedRange.Rows.Count @mLipok I made the change and ran twice and now it is giving the attached error at the line: Local $oSheet = $oWorkbook.ActiveSheet I am wondering, there is no issue with Local $ColNum = $oWorkbook.ActiveSheet.UsedRange.Columns.Count ; Get last column Number or any step prior it starts for Rows count. -
Hi, My code has been working with no issues since long years and I remember have not made any change to the below code but since past few months have started getting Object Create error always at line Local $iCountLines = $oWorkbook.ActiveSheet.UsedRange.Rows.Count. Can someone help me with the cause and if anything is not correctly aligned here? Func XLSCalc() Local $ID = '/Check/Detail/UpdateData/@ID' Local $Inst = '/Check/Detail/UpdateData/@IsInstalled' Local $Down = '/Check/Detail/UpdateData/References/DownloadURL' Local $Title = '/Check/Detail/UpdateData/Title' Local $Restart = '/Check/Detail/UpdateData/@RestartRequired' Local $KBID = '/Check/Detail/UpdateData/@KBID' Local $C_DIR = "C:\Test" Local $Src_DIR = $C_DIR & "\Source" Local $Files_DIR = $Src_DIR & "\Files" Local $ScanResults_DIR = $Files_DIR & "\ScanResults" DirCreate($ScanResults_DIR) Local $xml_result = $ScanResults_DIR & "\Results.xml" Local $oExcel = _Excel_Open(False) If @error Then _Excel_Close($oExcel) MsgBox(48, "", "Patch Status: An Error occured while opening Excel during XLSCalc." & @CRLF & @CRLF & "Please contact the administrator.") ; Error occurred while launching report. Exit EndIf Local $xls_result = $ScanResults_DIR & "\Results.xls" Local $oWorkbook = _Excel_BookOpen($oExcel, $xls_result) If @error Then _Excel_Close($oExcel) EndIf Local $XMLOut = _Excel_RangeRead($oWorkbook, Default, "A1") Select Case $XMLOut = "/XMLOut" _Excel_RangeDelete($oWorkbook.ActiveSheet, '1:1', 1) ; Delete 1st line as /XMLOut If @error Then Exit MsgBox(0, "Error", "ObjCreate returned @error = " & @error & " and @extended = " & @extended & @CRLF & "Line " & @ScriptLineNumber) _Excel_BookSave($oWorkbook) If @error Then Exit MsgBox(0, "Error", "ObjCreate returned @error = " & @error & " and @extended = " & @extended & @CRLF & "Line " & @ScriptLineNumber) EndSelect Local $ColNum = $oWorkbook.ActiveSheet.UsedRange.Columns.Count ; Get last column Number Local $sTab7 Local $ColName For $j = $ColNum To 1 Step -1 Local $ScanResults_DIR = $Files_DIR & "\ScanResults" Local $FilePath = $ScanResults_DIR & "\Output.txt" Local $Output_FileOpen = FileOpen($FilePath, 2) Local $FileWrite = FileWrite($Output_FileOpen, $j) FileClose($Output_FileOpen) Local $TotalCol = FileRead($FilePath) Local $ColName = _Excel_ColumnToLetter($TotalCol) ; Get last column Header Name Local $sTab7 = _Excel_RangeRead($oWorkbook, Default, $ColName & '1') If $sTab7 = $ID Or $sTab7 = $Inst Or $sTab7 = $Down Or $sTab7 = $Title Or $sTab7 = $Restart Or $sTab7 = $KBID Then ; Do nothing... Else _Excel_RangeDelete($oWorkbook.ActiveSheet, $ColName & ':' & $ColName) If @error Then Exit MsgBox(0, "Error", "ObjCreate returned @error = " & @error & " and @extended = " & @extended & @CRLF & "Line " & @ScriptLineNumber) _Excel_BookSave($oWorkbook) If @error Then Exit MsgBox(0, "Error", "ObjCreate returned @error = " & @error & " and @extended = " & @extended & @CRLF & "Line " & @ScriptLineNumber) EndIf Local $sTab8 = _Excel_RangeRead($oWorkbook, Default, $ColName & '2') Local $sTab9 = _Excel_RangeRead($oWorkbook, Default, $ColName & '3') If $sTab8 = '' And $sTab9 <> '' Then _Excel_RangeDelete($oWorkbook.ActiveSheet, '2:2', 1) ; Delete 1st line if blank but not If @error Then Exit MsgBox(0, "Error", "ObjCreate returned @error = " & @error & " and @extended = " & @extended & @CRLF & "Line " & @ScriptLineNumber) _Excel_BookSave($oWorkbook) If @error Then Exit MsgBox(0, "Error", "ObjCreate returned @error = " & @error & " and @extended = " & @extended & @CRLF & "Line " & @ScriptLineNumber) EndIf If $sTab7 = $ID Or $sTab7 = $Inst Then Local $iCountLines = $oWorkbook.ActiveSheet.UsedRange.Rows.Count If @error Then Exit MsgBox(0, "Error", "ObjCreate returned @error = " & @error & " and @extended = " & @extended & @CRLF & "Line " & @ScriptLineNumber) For $i = $iCountLines To 1 Step -1 Local $sTab10 = _Excel_RangeRead($oWorkbook, Default, $ColName & $i) If $sTab10 = 'True' Then _Excel_RangeDelete($oWorkbook.ActiveSheet, $i & ":" & $i, 1) If @error Then Exit MsgBox(0, "Error", "ObjCreate returned @error = " & @error & " and @extended = " & @extended & @CRLF & "Line " & @ScriptLineNumber) EndIf Local $sTab11 = _Excel_RangeRead($oWorkbook, Default, $ColName & $i) If $sTab11 = '123456' Then _Excel_RangeDelete($oWorkbook.ActiveSheet, $i & ":" & $i, 1) If @error Then Exit MsgBox(0, "Error", "ObjCreate returned @error = " & @error & " and @extended = " & @extended & @CRLF & "Line " & @ScriptLineNumber) EndIf Local $v_Return = Column_GetValues($Files_DIR & "\Exclude.xls", "B", "A") Local $ExcludeFilePath = $ScanResults_DIR & "\FinalExclusion.txt" Local $FinalExclusion_FileOpen = FileOpen($ExcludeFilePath, 1) For $f = 1 To _FileCountLines($ExcludeFilePath) $ExcludeFile = FileReadLine($ExcludeFilePath, $f) If $sTab11 = $ExcludeFile Then _Excel_RangeDelete($oWorkbook.ActiveSheet, $i & ":" & $i, 1) If @error Then Exit MsgBox(0, "Error", "ObjCreate returned @error = " & @error & " and @extended = " & @extended & @CRLF & "Line " & @ScriptLineNumber) EndIf Next FileClose($FinalExclusion_FileOpen) Next EndIf Next _Excel_BookClose($oExcel) Sleep(500) _Excel_Close($oExcel) EndFunc ;==>XLSCalc
-
@robertocm, This was an example one I had provided with few changes and my prod version is in 64-bit. But I will give a try with your other suggestions. @water, in my Prod there are error checks at every step I am taking if any issues while opening Excel or workbook. Also while deleting any lines. For other steps I'll take a look.
-
Hi, Out of 10 times I run the application I get atleast 5-6 times the error The requested action with this object has failed. I have tried to keep Excel open close after every action too but it does not help. This happens at line Local $iCountLines = $oWorkbook.ActiveSheet.UsedRange.Rows.Count Any suggestion on the cause and fix for this please? Test.au3
-
Unable to read FileGetVersion()
DigDeep replied to DigDeep's topic in AutoIt General Help and Support
@Jos, I am already running as #RequireAdmin. @AdamUL, it give the same False result. I have loads of other validations which are all correct. It is just this file which shows opposite result. 🤨 But when I change it as: If _VersionCompare($Test_LocalFile_Ver, $Test_SourceFile_Ver) = 0 Or _VersionCompare($Test_LocalFile_Ver, $Test_SourceFile_Ver) = 1 Then MsgBox(0, "", "True") Else MsgBox(0, "", "False") EndIf So _VersionCompare works in this case. But as per help file it as 3 validations which is why we can't put only = 0 and Else. 0 - Both versions equal 1 - Version 1 greater -1 - Version 2 greater End of the line, this works as per my need. Thank you. -
I am having a weird issue. Both my INI file and App1.exe properties version are 1.0.2345.17509 But when I validate, it gives me the msgbox "False". I also tried changing the Filegetversion() to RegRead but it is still the same. I am not sure but could it be a false reading of binary digits? Local $Test_LocalFile = "C:\Program Files\Test\App1.exe" Local $Test_LocalFile_Ver = FileGetVersion($Test_LocalFile, "ProductVersion") Local $Test_SourceFile_Ver = IniRead("c:\Test.ini", "Apps", "App1", "") If $Test_LocalFile_Ver = $Test_SourceFile_Ver Then MsgBox(0, "", "True") Else MsgBox(0, "", "False") EndIf
-
I used my own credentials which has admin rights to both local machine and Network path. That's why running the command line from Windows CMD works with no issues but I am not sure why it says "Incorrect User name and password" from AutoIT command line. The only reason I am using RunAsWait is my creds will not have admin rights to other users machines and eventually I will be using some elevated accounts. But the process and command line will be the same. Also to let you know, the destination path is a SharePoint site library. I tried looking for other solution to add / upload files from local to SP but there was not much found. Which is why I had to go via the RunAsWait command line to get it simply as File copy method.
-
Yes, the account has rights to both the local machine and network path. That's why command line parameter is able to copy files but not via the autoIT code.
-
Source is local machine. Destination is Internal Network location.
-
@Marc, I tried both of your solution too but still says "Incorrect User name or Password". Just to let you know the destination path is Intranet Destination.
-
It says "Incorrect Username or Password". But I know the credentials are correct.