Jump to content
bbc

How can i add the following script to autoit

Recommended Posts

I am trying to grab all the chrome process ids . So I am using the script for /f "tokens=2" %a in ('tasklist /nh /fi "imagename eq chrome.exe"') do echo %a in command prompt and I am able to see all the process ids for chrome . But i wanted to run this script with autoit  during my webautomation . Here is the code .

var au = require('autoit');
                 au.Init();
                au.Run('for /f "tokens=2" %a in ('tasklist /nh /fi "imagename eq chrome.exe"') do echo %a');
             Console.log("Chrome browser sessions: " + a1);
 

When I ran the code , I am unable to see any output in console. Please help me

 

Thank you 

 

 

Share this post


Link to post
Share on other sites

Moved to the appropriate forum, as the Developer General Discussion forum very clearly states:

Quote

General development and scripting discussions. If it's super geeky and you don't know where to put it - it's probably here.


Do not create AutoIt-related topics here, use the AutoIt General Help and Support or AutoIt Technical Discussion forums.

Moderation Team


SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

I am trying to grab all the chrome process ids . So I am using the script for /f "tokens=2" %a in ('tasklist /nh /fi "imagename eq chrome.exe"') do echo %a in command prompt and I am able to see all the process ids for chrome . But i wanted to run this script with autoit  during my webautomation . Here is the code .

var au = require('autoit');
                 au.Init();
                au.Run('for /f "tokens=2" %a in ('tasklist /nh /fi "imagename eq chrome.exe"') do echo %a');
             Console.log("Chrome browser sessions: " + a1);
 

When I ran the code , I am unable to see any output in console. Please help me

 

Thank you 

Share this post


Link to post
Share on other sites

I am trying to grab all the chrome process ids . So I am using the script for /f "tokens=2" %a in ('tasklist /nh /fi "imagename eq chrome.exe"') do echo %a in command prompt and I am able to see all the process ids for chrome . But i wanted to run this script with autoit  during my webautomation . Here is the code .

var au = require('autoit');
                 au.Init();
                au.Run('for /f "tokens=2" %a in ('tasklist /nh /fi "imagename eq chrome.exe"') do echo %a');
             Console.log("Chrome browser sessions: " + a1);
 

When I ran the code , I am unable to see any output in console. Please help me

 

Thank you 

Share this post


Link to post
Share on other sites

How often are you planning to create a thread with the same question?
I have merged the 3 you have created into the correct forum, so let's stick to this one please!

Jos


SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Can you let me know  the link of correct forum that you are referring to ?

 

Thanks

Share this post


Link to post
Share on other sites
Posted (edited)

It is already moved to the correct forum as the move post also states and I guess you can see for yourself which forum you are in now. ;)

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

You could just use ProcessList("Chrome.exe") which will return an array of all Chrome processes.

Share this post


Link to post
Share on other sites

Yes , i didn't see the processlist . I am only able to see WinGetProcess 

Share this post


Link to post
Share on other sites
3 hours ago, Danp2 said:

he is using AutoitX,

Mmm.. guess I moved it to the wrong place initially. It is now in the support forum for AutoitX.


SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...