ni.com is currently experiencing unexpected issues.
Some services may be unavailable at this time.
06-15-2009 10:36 PM
Hi,
I am new in labview, and I am trying to search some Process id from a string:
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
c:\> tasklist /fi "imagename eq notepad.exe"
Image Name PID Session Name Session# Mem Usage
========================= ====== ================ ======== ============
notepad.exe 2964 Console 0 728 K
notepad.exe 2432 Console 0 1,044 K
what I want to get is these PID: 2964 and 2432. I have tried to use multiply string functions, but I think this one can make it.
Can someone help me set up the regular expression? Thanks in advance.
06-16-2009 12:30 AM
George,
The forum is not normaly devoted o doing a student's homework.
We like to share thoughts with fellow NI enthusiasts! Even those that are new to NI or (on this forum) LabVIEW. Reply with own question, your Prof's URL, or do your own homework!
06-16-2009 02:59 AM
Hello George_Z
Have you tried using array functions where you need to give the no.of column and can vary no. of rows to get what you want. Hope it helps...
I
06-16-2009 03:15 AM
Hi George,
Read your text from the line that looks like the header for the information contained below [Image Name PID Session Name Session# Mem Usage].
Put this data into a 2D Str Arr. Index the 1st column alone as a 1D Str Arr. Then take the word PID from its 0th element. In the same array look for the word ' Console' ['\sConsole] using the Match pattern function & take out the portion of the Str found before the match.
Look carefully that I have included a Space ('\s') character along with the pattern to be looked for and matched.
06-16-2009 05:48 AM
This assumes that you'll always have " Console" before the PID.
I have a suspicion that there's a better Regexp, but I can't do it.
06-16-2009 08:20 AM
06-16-2009 10:11 AM
06-16-2009 10:16 AM
06-16-2009 12:09 PM
Coq rouge wrote:
Did it not work?
Well, it doesn't do what the poster originally asked for, and it also does not place a tab between the process ID and the Session Name. Other than that, it works just fine.
06-16-2009 12:27 PM