Jump to content

Recommended Posts

Posted

Hello, I found a VB snippet which I would love to use in AutoIt :)

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Process")
For Each objItem in colItems
     Wscript.Echo objItem.Name
     Wscript.Echo objItem.CommandLine
Next

Despite my best efforts, I am not able to understand a thing from that piece of code :(. All I know is that it outputs the Name and Commandline of all the processes currently running (Let's see if I am right).

Can anyone help me with convert this into AutoIt? Thanks in Advance! :D

EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time)

DcodingTheWeb Forum - Follow for updates and Join for discussion

  • Developers
Posted

Are you sure you even tried? ;)

$strComputer = "."
$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\cimv2")
$colItems = $objWMIService.ExecQuery("Select * from Win32_Process")
For $objItem in $colItems
     ConsoleWrite($objItem.Name & "-" & $objItem.CommandLine & @CRLF)
Next

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.
  :)

Posted

@Jos

$strComputer is just a period. Why did you store it in a variable instead of directly using ?

  Reveal hidden contents

 

Posted

Oh, I thought that there is any secret behind that variable. :) 

  Reveal hidden contents

 

Posted

@kcvinu He just converted to code to AutoIt, kept it as original as possible :).

 

P.S What are you doing in the middle of the night at 2 PM?

P.P.S I see that @Jos has replied before I finished typing this :P

EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time)

DcodingTheWeb Forum - Follow for updates and Join for discussion

Posted

@TheDcoder 

ha ha ha..  I am working now. I had a busy schedule in these days. But i can't resist me to look at the forum.  AutoIt is circulating in my head. :) By the by what are you doing here ? :) 

  Reveal hidden contents

 

Posted
  On 10/30/2016 at 8:34 PM, kcvinu said:

By the by what are you doing here ? :) 

Expand  

Currently on night shift mode, need to be on nights because of freelance work... most of my clients are from the US so this timezone is appropriate ;).

I am still trying to figure out WMI's database structure lol. @TheDcoder is trying to get the command line arguments of a process using its PID.

EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time)

DcodingTheWeb Forum - Follow for updates and Join for discussion

Posted

Have a look at Scriptomatic in the Example scripts forum.
It generates WMI-AutoIt code for you.

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted

@TheDcoder

Just read "Windows Scripting with WMI" from MS-Press. 

  Reveal hidden contents

 

  • 1 year later...
Posted

Isn't it exactly what @water said in post #10 of this very same thread (371 days before you)?

  Reveal hidden contents

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Posted

More than a year later I am no where better than I was at Post #1, lol :lol:. Still struggling to navigate through Microsoft's documentation for WMI COM API, I might try Script-o-matic, at the moment I cannot recall what I was looking to do with WMI.

EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time)

DcodingTheWeb Forum - Follow for updates and Join for discussion

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
×
×
  • Create New...