[Issue #539] Error: xFile is not installed yet


#1

Hi,

I am currently evaluating Kantu in order to use it for automating the download of dozens of transactions files every night from a corporate website.

On a brand new instance of Windows Server 2016, I installed Chrome, Kantu for Chrome and Kantu XMdolules.I created several macros that are stored on my local drive.I created a PowerShell script that calls the macro. Everything is working great, except that I get randomly this error:
xFile is not installed yet.

This is a random issue and I am not sure what to do here to solve it.

Thanks for your help. VinoVD.


[Fixed] [bug] xFile is not installed yet
#2

So somtimes it works, and sometimes not? => Can you please post a screenshot of this error?


#3

Here are some screenshots. First screenshot shows the list of macros when I run Kantu from the browser. Second screenshot displays the error message when I run the macro from Power Shell. After a few seconds, the error message disappears (3rd screenshot).

Screen3

It seems to me that the list of macros is not uploaded correctly when the browser and the macro are starting from Power Shell. Otherwise, it works great if it the macro is played manually directly from the browser.

Please advise on how to solve the issue. Thanks


#4

Thanks. What command line are you using in Powershell to start Kantu?


#5

Please find below the Power Shell Script that is used to run the macros.

##########################################################################
#Script to run Kantu macros and check on their result via the command line
#V1.0.5, Dec 3, 2018
###########################################################################

######################################################################
function PlayAndWait ([string]$macro, [int]$timeout_seconds = 10, [string]$var1 = “-”, [string]$var2 = “-”, [string]$var3 = “-”)
{
#This function opens Chrome or Firefox and runs the macro

#REQUIRED_ Define these two values
$path_downloaddir = “C:\Users\Administrator\Downloads” #where the kantu log file is stored (“downloaded”)
$path_autorun_html = “C:\Scripts\MainApp_Download.html” #Location and name of the exported HTML page. ANY exported html macro will do, since we overwrite the content with &macro=

#INPUT:

macro name

optional: timeout value, default is 60s

#OUTPUT

$status_int: 1 if all ok, negative if error

$status_text: error text

$status_runtime: macro runtime in seconds

#Optional: Kill Chrome instances (if any open)
#taskkill /F /IM chrome.exe /T

#Create log file. Here Kantu will store the result of the macro run
$log = macro + "_log_" + (get-date -f MM-dd-yyyy_HH_mm_ss) + “.txt”
$path_log = $path_downloaddir + $log

#Build command line
cmd = "{env:ProgramFiles(x86)}\Google\Chrome\Application\chrome.exe"
#For FIREFOX use: cmd = "{env:ProgramFiles}\Mozilla Firefox\firefox.exe"
$arg = “”“file:///”+ $path_autorun_html + “?macro=”+ $macro + “&cmd_var1=”+ $var1 + “&cmd_var2=”+ $var2 + “&cmd_var3=”+ $var3 + “&close=1&closeBrowser=1&direct=1&savelog=”+$log+""""

Start-Process -FilePath $cmd -ArgumentList $arg #Launch the browser and run the macro

#############Wait for macro to complete => Wait for log file to appear in download folder
$status_runtime = 0
Write-Host "Log file will show up at " + $path_log
while (!(Test-Path $path_log) -and ($status_runtime -lt $timeout_seconds))
{
Write-Host “Waiting for macro to finish, seconds=” $status_runtime
Start-Sleep 1
$status_runtime = $status_runtime + 1
}

#Macro done - or timeout exceeded:
if ($status_runtime -lt $timeout_seconds)
{
#Read FIRST line of log file, which contains the status of the last run
$status_text = Get-Content $path_log -First 1

#Check if macro completed OK or not
$status_int = -1     
If ($status_text -contains "Status=OK") {$status_int = 1}

}
else
{
$status_text = “Macro did not complete within the time given:” + $timeout_seconds
$status_int = -2
#Cleanup => Kill Chrome instance
#taskkill /F /IM chrome.exe /T
}

remove-item $path_log #clean up

$value = “” | Select-Object -Property ErrorNumber,ErrorText, Runtime
$value.ErrorNumber = $status_int
$value.ErrorText = $status_text
$value.Runtime = $status_runtime
return $value

}

###########################################################################

Main program starts here

###########################################################################

$Business_Name = $args[0];
$FileType = $args[1];

$MainLogFile = “C:\Scripts\MainLogFile.txt”
$Business_Directory = “C:\BusinessList”
$Download_Dir = “C:\Users\Administrator\Downloads”

$MacroName = “VD_” + $Business_Name + “_” + $FileType
$filename = $Business_Name +"-" + FileType + "-" + (get-date -f yyyyMMdd) + “.csv”

$r = PlayAndWait $MacroName 150 $filename

$report = $MacroName + " ("+$r.ErrorNumber + ") runtime: "+$r.Runtime+" seconds, result: "+ $r.ErrorText
Write-Host $report
Add-content $MainLogFile -value ($report)
Start-Sleep 1

#6

Thanks for the details. I confirmed the issue :frowning:

=> It happens if you use HardDrive FileAccess mode and Chrome is not yet started when you use the command line.

…then, it seems, the FileAccess XModule is loaded “too slow” and the error happens. Of course, this issue will be fixed ASAP.

=> The best workaround for now is to use the “Local Storage” method for macros that you want to start via command line.


#7

Hi, the issue is fixed with V4.2.6 (released today).