Copy link to clipboard
Copied
hi, it s possible to survey the % cpu during a script? if over xx%, put script in pause?
Actually you might check for CPU Usage. Here is a snippet from the IDS SDK but the same method can be found with InDesign Client :
// Get the process cpu usage and vm statistics
this.cpuTime = app.performanceMetric(PerformanceMetricOptions.CPU_TIME);
this.sysCpuTime = app.performanceMetric(PerformanceMetricOptions.OVERALL_SYSTEM_CPU);
this.userCpuTime = app.performanceMetric(PerformanceMetricOptions.OVERALL_USER_CPU);
this.initVMSize = app.performanceMetric(PerformanceMetricOptions.VIRTUAL_
...
Copy link to clipboard
Copied
I donāt think so. You can look at the ExtendScript $ object API here:
https://www.indesignjs.de/extendscriptAPI/indesign-latest/#$.html
Copy link to clipboard
Copied
Actually you might check for CPU Usage. Here is a snippet from the IDS SDK but the same method can be found with InDesign Client :
// Get the process cpu usage and vm statistics
this.cpuTime = app.performanceMetric(PerformanceMetricOptions.CPU_TIME);
this.sysCpuTime = app.performanceMetric(PerformanceMetricOptions.OVERALL_SYSTEM_CPU);
this.userCpuTime = app.performanceMetric(PerformanceMetricOptions.OVERALL_USER_CPU);
this.initVMSize = app.performanceMetric(PerformanceMetricOptions.VIRTUAL_MEMORY_SIZE);
this.resMemSize = app.performanceMetric(PerformanceMetricOptions.RESIDENT_MEMORY_SIZE);
But Pausing a script might not be possible. You can exit your script though if you see the CPU go wild.
HTH
Loic
Copy link to clipboard
Copied
hi my idea is create an alert() is cpu is over 50%
i would like do same with memory?
into your code wich value is % of cpu?
because after 1hour of script, indesign continue to "crash" without reason
Copy link to clipboard
Copied
I missed the application PerformanceMetricOptions. The full list is here:
https://www.indesignjs.de/extendscriptAPI/indesign-latest/#PerformanceMetricOptions.html
$.writeln(app.performanceMetric(PerformanceMetricOptions.CPU_TIME))
$.writeln(app.performanceMetric(PerformanceMetricOptions.OVERALL_SYSTEM_CPU))
$.writeln(app.performanceMetric(PerformanceMetricOptions.OVERALL_USER_CPU))