Jump to content

Saving the Excel report file in specific location


Recommended Posts

By default CALYPSO always outputs excel to the default results folder. This can be set via Extras > Settings > Environment > Paths > Default Path for Result Files. 

However excel output files are a bit unique in that CALYPSO doesn't has a built in function to have only excel files go to a different directory other then the default (like say a PDF). Because of this the only way to have CALYPSO move excel files to a folder other than the default results folder is to use PCM or a batch file. PCM requires you to have the license where as batch files don't.

To learn how to use batch files to move excel outputs individually have a look at CALYPSO: Batch File Automation Guide. The code will end up looking something like this but I'm sure it can be improved as well:

@ECHO OFF 

timeout /t 10

taskkill /f /im Excel.exe

timeout /t 5

move "C:\Users\Public\Documents\Zeiss\CALYPSO 8.0\workarea\results\*.xlsx" "Z:\CALYPSO results\Excel Results"

I think it's based off the name of the Table Files, so yes you'd need to set this up in Resources - Name for Output Files.

Here are a couple of articles on changing the output paths/naming. 

https://portal.zeiss.com/knowledge-base?id=587888

https://portal.zeiss.com/knowledge-base?id=1668954

Please sign in to view this quote.

Please sign in to view this username.

 Use task scheduler and a PowerShell script to close all open instances of Excel and then move the files from the default XLS location to your servers once an hour/day/week. The script would look like this -

 

# First, stop all running Excel processes
Get-Process -Name "EXCEL" -ErrorAction SilentlyContinue | ForEach-Object { 
    try {
        Stop-Process -Id $_.Id -Force -ErrorAction SilentlyContinue
        Write-Host "Closed Excel process with ID $($_.Id)"
    } catch {
        Write-Warning "Failed to close Excel process with ID $($_.Id): $_"
    }
}

# Define the source directory to search for XLS files
$sourcePath = "C:\Path\To\Source\Folder"

# Define the destination directory on the server
$destinationPath = "\\ServerName\SharedFolder\Destination"

# Ensure the destination directory exists
if (!(Test-Path -Path $destinationPath)) {
    New-Item -ItemType Directory -Path $destinationPath -Force | Out-Null
}

# Get all .xls files in the source directory and its subdirectories
$xlsFiles = Get-ChildItem -Path $sourcePath -Filter *.xls -Recurse -File

foreach ($file in $xlsFiles) {
    try {
        # Construct the destination file path
        $destFile = Join-Path -Path $destinationPath -ChildPath $file.Name

        # Copy the file to the destination
        Copy-Item -Path $file.FullName -Destination $destFile -Force
        Write-Host "Copied: $($file.FullName) to $destFile"
    } catch {
        Write-Warning "Failed to copy $($file.FullName): $_"
    }
}

 

 

Edited
×
×
  • Create New...