Jump to content

WMI ScriptOMatic tool for AutoIt


SvenP
 Share

Recommended Posts

This is the AutoIt's version of Microsoft Scriptomatic tool. Which took me some hours to rewrite (yes, yes, I'm not such a fast script writer).

If you don't know what Scriptomatic is, see:

http://www.microsoft.com/technet/scriptcen...s/scripto2.mspx

This version is written in AutoIt script AND it produces an AutoIt script !

Requirements:

- AutoIt version 3.1.1.8 (or higher)

- Some knowledge about WMI

Download at: http://www.autoitscript.com/forum/index.ph...amp;showfile=29

Have fun!

Regards,

-Sven

EDIT 17-APR-2005: Updated with suggestions from gafrost and some other bugfixes. Now REQUIRES AutoIt beta version 3.1.1.8 or higher !

EDIT 17-APR-2005 11PM: For the generated script you have now options for dialog, text or HTML output.

EDIT 14-MAY-2005: Fixed a tiny bug: If the output contained an array-variable, I incorrectly used the index 1. But arrays start from index 0. Thanks gafrost !

Edit: Uploaded JdeB's fixed version for the latest beta release. - Jon.

Edited by Jon
Link to comment
Share on other sites

Wow, this is gorgeous.

Excellent work... your code is beautiful!

Edited by Insolence
"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Link to comment
Share on other sites

...Hum...Now that VBScript works in AU3, anyone know how to pull an MD5 hash? I'm going crazy not being able to do it natively, without having to get an elephant to jump through a hoop.

Writing AutoIt scripts since

_DateAdd("d", -2, _NowCalcDate())
Link to comment
Share on other sites

Well you could be cool and use a PHP script to do it, but I suppose that's shoving an elephant through a hoop :)

"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Link to comment
Share on other sites

Pretty slick once I remembered to get the latest au3check

ran across a small problem

select the wmi for bios

saved the script

and tried to run it and got the following error:

C:\Documents and Settings\Gary\My Documents\bios.au3 (13) : ==> Expected a variable in user function call.: 
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_BIOS", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly) 
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_BIOS", "WQL", $wbemFlagReturnImmediately ^ ERROR
C:\Documents and Settings\Gary\My Documents\bios.au3 (13) : ==> Illegal text at the end of statement (one statement per line).: 
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_BIOS", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly) 
Incorrect parameters to object property !

original code lines produced:

$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_BIOS", "WQL", _ 
                                                    $wbemFlagReturnImmediately + $wbemFlagForwardOnly)

either of the following fixes the error:

$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_BIOS", "WQL", _
                                                    ($wbemFlagReturnImmediately + $wbemFlagForwardOnly))
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_BIOS", "WQL", _
                                                    BitOR($wbemFlagReturnImmediately,$wbemFlagForwardOnly))

Edit: downloaded your latest, that fixed that problem.

Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

Well you could be cool and use a PHP script to do it, but I suppose that's shoving an elephant through a hoop :)

<{POST_SNAPBACK}>

That's actually what I thought of originally, but my partner in crime (the other programmer for this script), pointed it to me that we need to do get an md5 offline...

Writing AutoIt scripts since

_DateAdd("d", -2, _NowCalcDate())
Link to comment
Share on other sites

Pretty slick once I remembered to get the latest au3check

ran across a small problem

select the wmi for bios

saved the script

and tried to run it and got the following error:

....

Edit: downloaded your latest, that fixed that problem.

<{POST_SNAPBACK}>

gaforst,

Yeah, that's the nast COM problem I was talking about. It doesn't accept mathematical expressions.

I've fixed that in my AutoIt.exe, but I am not allowed to release new AutoIt.exe's, so I made a dirty work-around in Scriptomatic.au3.

Regards,

-Sven

Link to comment
Share on other sites

found a but in the OpenScript

old code

;********************************************************************
;* OpenScript
;********************************************************************

Func OpenScript()

   $strTmpName=FileOpenDialog("Open Script",@DesktopDir,"AutoIt3 Scripts (*.au3)")

   If not @error and $strTmpName <> "" then
    If FileExists($strTmpName) then
        GUICtrlSetData($GUI_AST_ScriptCode,FileRead($strTmpName))
    EndIf
   EndIf
   
EndFunc

code that works

;********************************************************************
;* OpenScript
;********************************************************************

Func OpenScript()

   $strTmpName=FileOpenDialog("Open Script",@DesktopDir,"AutoIt3 Scripts (*.au3)")

   If not @error and $strTmpName <> "" then
    If FileExists($strTmpName) then
        GUICtrlSetData($GUI_AST_ScriptCode,FileRead($strTmpName,FileGetSize($strTmpName)))
    EndIf
   EndIf
   
EndFunc

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

Suggestion:

In SaveScript:

$strTmpName=FileSaveDialog("Save Script",@DesktopDir,"AutoIt3 Scripts (*.au3)",16)

I think it would be better to have a default name, for example:

$strTmpName=FileSaveDialog("Save Script",@DesktopDir,"AutoIt3 Scripts (*.au3)",16,GUICtrlRead ( $GUI_WMI_Classes ))

but then that's just my opinion

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

Suggestion:

..etc...

but then that's just my opinion

<{POST_SNAPBACK}>

gafrost,

Thanks for your feedback. I've added your suggestions to the program, and I did also some other minor bugfixes. I'll upload the new version.

Regards,

-Sven

Link to comment
Share on other sites

  • 2 weeks later...

running 3.1.1.8

i get the following error when running this script

line 200 (file "<my path here>\Scriptomatic.au3"):

If $objQualifierDictiionary.Exist("dynamic") Then

If $objQualifierDictiionary.E^ERROR

Error: Unable to parse line.

to avoid confusion <my path here> is not what it says.. i just didnt feel like typing out my path.

thanks

Link to comment
Share on other sites

running 3.1.1.8

i get the following error when running this script

line 200 (file "<my path here>\Scriptomatic.au3"):

If $objQualifierDictiionary.Exist("dynamic") Then

If $objQualifierDictiionary.E^ERROR

Error: Unable to parse line.

to avoid confusion <my path here> is not what it says.. i just didnt feel like typing out my path.

thanks

<{POST_SNAPBACK}>

Hmm, that's odd. Could you do another try with AutoIt beta version 3.1.1.18 ? (from: http://www.autoitscript.com/forum/index.php?showtopic=10256)

It *could* be a bug in the COM code, however I'm not sure.

I assume the double "ii" in the word "..Dictiionary" is a typo while typing out the error message ?

Regards,

-Sven

Link to comment
Share on other sites

  • 2 weeks later...

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...