Waiting for executied .exe and .ps scripts to finish

Hi,

So I created with AutoIT couple of automated scripts for some windows manipulation that I need for my tests and also couple of powershell scripts and I can execute them BUT
If I have more then one function in test that executes these scripts my steps start mixing up and execution is not waiting for these steps with scripts to be executed.

It just executed them all asynchronously now.

Do you know if it’s possible to make them execute synchronously or better yet to wait until these scripts are executed without using I.wait?

thanks

I tried async/await but that also didn’t help and now with 2.5 release it stopped executing it completely.
my sample:
let exec = require(‘child_process’).execFile;

uploadSebRates: async function (err, data) {
I.waitForVisible(this.locators.searchField,15);
I.click(‘Upload’);
await exec(‘scripts/uploadSebRates.exe’, function(){} );
if (err) console.log(err);
else
console.log(data);
},

anyone has any idea?

I use autoIt script more then two years. But not as usual… (not call exe files and au3 scripts).

Each autoit scripts i have writed as javascript by this https://www.npmjs.com/package/autoit - working good with async/await.

maybe you can use some trick. In auto it script on the end add function for write some file. In test you can add loop where you wait for exist this file. When File exist, start what you need.

thanks for the feedback…I already managed to solved this with async/await but also really nice to see that there is a library for AutoIt

library for autoit in javascript working very well. Only when you need use script where must import some other lib, you must use call run autoit exe with au3 script.

Hi,
Nice to see you that you are using autoIT package for windows manipulation.!!
I’m new to auotIT in JS stack and getting error while installing the npm install --save autoit package.
Seems to be package dependency ‘node-gyp’ required(installed node-gyp@7.0.0) but still throwing error as below.

gyp ERR! configure error
gyp ERR! stack Error: Could not find any Python installation to use
.
.
.
gyp ERR! node -v v12.16.3
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ref@1.3.5 install: node-gyp rebuild
npm ERR! Exit status 1

can you please help me on unblock installation issue specific to autoIT.

Thanks in advance!!

Hi,

So I gave up on using JS AutoIt library because of version incompatibilities but you can create script on your own and just call it in your tests:
just create async method and call it like
await exec(‘pathToYourAutoITScript.exe’);

works like a charm :slight_smile:

Officially autoit not working with nodejs v12.

BUT… Try this :grin:

Working werry well…