Jump to content
Sign in to follow this  
ripdad

_WMI_TranslateValue

Recommended Posts

ripdad

Description: Returns a translated string for properties that have a "Values" Qualifier.

After browsing through some WMI scripts on the forum, I thought, there's gotta be a simple and direct way to get value strings from ReturnValues other than Case Statements and writing each one in manually.

;Example
Local $RtnVal = _WMI_Function()

Switch $RtnVal
    Case 0
         $RtnVal = 'success'
    Case 1
         $RtnVal = 'name does not exist'
    Case 2
         $RtnVal = 'unknown failure'
    Case 3; etc, etc. (some have over 20 of them)
         $RtnVal = 'etc'
    Case Else
         Return
EndSwitch

So, after playing with it some, I came up with this solution...

_WMI_TranslateValue.au3

Please let me know if any problems.

Edited by ripdad

"The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward

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
Sign in to follow this  

×