ScriptOMatic w/ArraySupport 0.2015.11.28

   (0 reviews)

argumentum

1 Screenshot

About This File

generates a function that returns all results as an array from the WMI query.

2015.11.28
added a StatusBar. ( was not easy to resize in win10 )
fixed COM handler in generated code

2015.06.11
added a "nice" COM error handler ( in Autoit v3.2 if there is a COM error it'll tell you and no more run,
  in v3.3 it will let it slide but you don't realize there was one. So I put together a COM error handler
  that will gather all the errors and show'em to you in an array displayed by _ArrayDisplay. It includes
  the line number and the line of code it self. nice. )
added the Scite lexer. ( There are code generated that is over 6000 lines long and that is a bit too much for
  the edit control, so, I decided that since is gonna run in a PC that most likely is to have ScITE, using
  the DLL just makes sense. Everything that is needed is taken from your installation, colors, fonts, etc.
  In case that ScITE is not there, then, the edit control would be used. )

2015.06.08
changed the CIMv2 button to switch between CIMv2 and WMI. ( is a more practical use of the button )
added some support for remote connections. ( executes remotely based in the classes discovered in local PC )
added Save to Disk for the filter by right-click the button. ( is anoying having to set it every time )
fix CPU usage was higher than needed in the main loop. ( ..less abuse on the PC )
added the position in the array to the "select properties". ( when an error pops up, the position is there,
 making it easier to find it in the listview )

2015.05.25
fixed "Send to ScITE" ( wasn't working well )
added the ability to remove fields/properties from the generated arrays

2015.05.16
fixed the combobox not working everywhere.
added setting to, in addition to Dynamic Classes, to include Abstract Classes.
added a filter ( easyer to look for what you need ).

2015.05.15
added custom default setting for display array limit.
added custom GoogleIt search ( @SelectedClass is the macro word ).
added cache for the Class too ( since is much faster and there is no
 need to discover every time it runs ).
change cache from an entry in the ini to a file of its own and
 created a subfolder for them when in portable mode ( cleaner that way ).
changed the function generation to not have to pass an integer.
changed function names when longer than 60 characters
 ( Au3Check don't like infinitely long names ).
changed how F5 works. Now F5 runs and ESC stops.
changed code generation from "$Output = $Output &" to $sReturn &=".
added \root\namespace:class to the title bar.
added a class description above the list of methods ( it just makes sense ).
change the default spacing of Array_Join() ( to better identify it was joined ).
added a watcher for "Autoit error", to move it to the current screen ( ANSI version ).
fixed "Send To ScITE" incomplete send ( it was too much at once ).
added to "Send To ScITE" the option to send to a new tab or cursor position.
added to the ini, Editor='@ScriptDir & "\..\..\SciTE\SciTE.exe"' , to use in a portable
 setup, it will normally use ShellExecute(,,,"Edit")
added the settings of the editor to the settings GUI.
added a button to move the settings and cache from @AppDataDir to @ScriptDir
 ( to carry your settings and cache as portable ) and back again, if so you want to.
added a ScITE "installer", to add this app. to the tools menu.

2015.05.12
fixed the way it returns a value when it, is an array.
changed the Google it string ( added "example" ).
added for all Properties and Methods with a ValueMap,
 functions to return value ( descriptions ).
added cache of namespaces to the ini file ( it was annoyingly slow ).
added full help. ( well, a list of all class, property and method Qualifiers ),
 to be found at the end of the code.

2015.05.11
added refresh after closing the settings GUI to make 
 the changes reflect in the code already in the editbox

2015.05.10
added preferred monitor to display _ArrayDisplay on
 the ANSI compile
changed internal works for Topmost and Multi-monitor
 so the code shown in the editbox is always clean
 of extraneous variables to both compiles.

2015.05.09  ( ANSI compile only )
added multi-monitor support to the ANSI compiled,
 just in case it fails, that's why not both compiles,
 so no change in the source code.
 In any case the code it generates is the same.

2015.05.08
added option to Edit after save file ( why else would you save it )
added save path of saved file to ini, when ini file exists.
added Send to ScITE ( easier than copy and paste )
changed the default TAB width to 4 ( looks better in ScITE )

2015.05.07
added keyboard shortcuts
 Ctrl-F11 to change font size
 Ctrl-T to change tab sizes
 the others are the underscore letter with Ctrl instead of Alt key
 ( but those should work with Alt. by default too )
added settings saving.
 default is @AppDataDir & '\ScriptOMaticForAutoIt3\ScriptOMatic.ini'
 but if one is found in @ScriptDir & '\ScriptOMatic.ini'
 that is the one to be used.
changed in the ANSI version to a more useful _ArrayDisplay version.
added cleanup on exit.
added tab adjustment.
added font choosing.
added font background color choosing.
added User or Admin mode info. to the title bar.
added option to set the string inside the cell (<td 'your string'>)
 for the user to change the default color and style
changed the debug info. to ToolTip, to be better aware of running status.
changed the way it writes TEXT and HTML to be so every 100 records.
added the ability to open the files from failed or prior runs
 by double-clicking the radio button.
changed file creation naming format
 to better identify them.

2015.05.06
Better readability for HTML and Text outputs.
Left the state of the source code ready for the current version.
Added a v3.3.12.0 compiled version ( better behavior under Win 8.1 and 10 )
and renamed the ANSI version.

2015.05.05
Fix a logic that would say fail when it was a limited listing of Namespaces,
it now tells that the listing is limited.

2015.05.04
Added announcement of Admin. rights ( user might not know )
rethought the "_Array2D_toHtml.au3" to be an #include ( as it should have been )
reworked the Namespace combobox loading
went from MsgBox and ToolTip to TrayTip and TrayIconDebug ( less intrusive )
www search now "Google it" ( MSDN change the links format )
Fixed the compiled _ArrayDisplay from displaying off center

2015.05.03
Added an array rotator ( at times I'd rather see it rotated )
Added an array to html ( to see the array on the browser ),
that also can be rotated ( it uses the array rotator )

2015.05.02
Enable Ctrl-A, C, V, X, Z to use the keyboard
Prettified the output a bit more and corrected some typos.

2015.05.01
And added press F5 like in ScITE, ( my finger just goes there ) to the Run button.
Also a "STOP" to the run ( at times I mess up and need to ProcessClose )
And set $MB_TOPMOST to the MsgBox ( so I don't loose them from sight )
And made the output of the array to be a function ( easier to use in a script ) 
And prettified the GUI a bit, not much.

==== EoF ====

In the zip is the source code for the current version and an AutoIt v3.2.12.1 ANSI compiled file that should run on any Windows version.

uc?export=view&id=0B4wbNI5yp94SdU5KWDZHY


What's New in Version 0.2015.11.28

Released

added a StatusBar. ( was not easy to resize in win10 )
fixed COM handler in generated code





User Feedback

You may only provide a review once you have downloaded the file.

There are no reviews to display.

  • Similar Content

    • AndyS19
      By AndyS19
      I have code that does a WMI SQL query to find all defined printers, and I want to parse the returned object in several places.  However, after parsing it the first time, all other times fail to find any printer objects.
      Here is my test code:
      test() Func test() Local $oPrinters, $oPrinter, $err, $cnt, $oP, $query $query = "SELECT * FROM Win32_Printer" $oPrinters = doQuery($query) $err = @error LogMsg("+++: $err = " & $err & ", isObj($oPrinters) = " & IsObj($oPrinters)) If ($err == 0) Then LogMsg("FIRST LOOP") ; <=== FIRST LOOP $cnt = 0 $oP = $oPrinters LogMsg("+++: isObj($oP) = " & IsObj($oP)) For $oPrinter In $oP $cnt += 1 LogMsg("+++: isObj($oPrinter): " & IsObj($oPrinter) & ", $oPrinter.Name ==>" & $oPrinter.Name & "<==") Next LogMsg("+++: Found " & $cnt & " printers") LogMsg("SECOND LOOP") ; <== SECOND LOOP $cnt = 0 $oP = $oPrinters LogMsg("+++: isObj($oP) = " & IsObj($oP)) For $oPrinter In $oP $cnt += 1 LogMsg("+++: isObj($oPrinter): " & IsObj($oPrinter) & ", $oPrinter.Name ==>" & $oPrinter.Name & "<==") Next LogMsg("+++: Found " & $cnt & " printers") EndIf EndFunc ;==>test Func doQuery($sQuery, $lnum = @ScriptLineNumber) #forceref $lnum LogMsg("+++:" & $lnum & ": doQuery(" & '"' & $sQuery & '"' & ") entered") Local $oWMIService, $oResults, $errstr Local $wbemFlags = BitOR(0x20, 0x10) ; $wbemFlagReturnImmediately and wbemFlagForwardOnly $oWMIService = ObjGet("winmgmts:\\" & "localhost" & "\root\CIMV2") If (IsObj($oWMIService)) Then $oResults = $oWMIService.ExecQuery($sQuery, "WQL", $wbemFlags) If (IsObj($oResults)) Then LogMsg("+++: doQuery() returns @error = 0, Good: returning the object") Return (SetError(0, 0, $oResults)) ;;; Good: return the object Else $errstr = "" _ & "WMI Query failed." & @CRLF _ & "This is the query:" & @CRLF _ & " " & $sQuery LogMsg("+++: ====>" & $errstr & "<===") LogMsg("+++: doQuery() returns @error = 1") Return (SetError(1, 0, $errstr)) ; Error: Query faled EndIf Else $errstr = "" _ & "WMI Output" & @CRLF _ & "No WMI Objects Found for class: " & @CRLF _ & "Win32_PrinterDriver" & @CRLF _ & "using this query:" & @CRLF _ & " " & $sQuery LogMsg("+++: ====>" & $errstr & "<===") MsgBox(0, "ERROR", $errstr) ; Error: Cannot get $oWMIService object Exit (1) EndIf EndFunc ;==>doQuery Func LogMsg($msg, $lnum = @ScriptLineNumber) ConsoleWrite("+++:" & $lnum & ": " & $msg & @CRLF) EndFunc ;==>LogMsg Parsing the returned $oPrinters object shows 5 printers:
      +++:15: FIRST LOOP +++:18: +++: isObj($oP) = 1 +++:22: +++: isObj($oPrinter): 1, $oPrinter.Name ==>Microsoft XPS Document Writer<== +++:22: +++: isObj($oPrinter): 1, $oPrinter.Name ==>Microsoft Office Document Image Writer<== +++:22: +++: isObj($oPrinter): 1, $oPrinter.Name ==>Fax<== +++:22: +++: isObj($oPrinter): 1, $oPrinter.Name ==>Canon MG7100 series Printer WS<== +++:22: +++: isObj($oPrinter): 1, $oPrinter.Name ==>Canon MG6100 series Printer WS<== +++:24: +++: Found 5 printers Parsing it again, shows no printers:
      +++:26: SECOND LOOP +++:29: +++: isObj($oP) = 1 +++:35: +++: Found 0 printers  
    • jguinch
      By jguinch
      Hello.
      I did create these few functions several months ago. I post here, if it can interest someone.
      These functions based on WMI queries allow you to manage printers : add / delete printer, driver, port, or obtain configuration, set default printer ... I let you discover it with the code.

       
      Here is the list of the available functions :
      _Printmgr_AddLocalPort
      _Printmgr_AddLPRPort
      _PrintMgr_AddPrinter
      _PrintMgr_AddPrinterDriver
      _PrintMgr_AddTCPIPPrinterPort
      _PrintMgr_AddWindowsPrinterConnection
      _PrintMgr_CancelAllJobs
      _Printmgr_EnumPorts
      _PrintMgr_EnumPrinter
      _PrintMgr_EnumPrinterConfiguration
      _PrintMgr_EnumPrinterDriver
      _PrintMgr_EnumPrinterProperties
      _PrintMgr_EnumTCPIPPrinterPort
      _Printmgr_Pause
      _Printmgr_PortExists
      _Printmgr_PrinterExists
      _Printmgr_PrinterSetComment
      _Printmgr_PrinterSetDriver
      _Printmgr_PrinterSetPort
      _Printmgr_PrinterShare
      _Printmgr_PrintTestPage
      _PrintMgr_RemoveLocalPort
      _PrintMgr_RemoveLPRPort
      _PrintMgr_RemovePrinter
      _PrintMgr_RemovePrinterDriver
      _PrintMgr_RemoveTCPIPPrinterPort
      _PrintMgr_RenamePrinter
      _Printmgr_Resume
      _PrintMgr_SetDefaultPrinter
       
      And some examples :
      #Include "PrintMgr.au3" ; Remove a printer called "My old Lexmark printer" : _PrintMgr_RemovePrinter("My old Lexmark printer") ; Remove the driver called "Lexmark T640" : _PrintMgr_RemovePrinterDriver("Lexmark T640") ; Remove the TCP/IP printer port called "TCP/IP" _PrintMgr_RemoveTCPIPPrinterPort("MyOLDPrinterPort") ; Add a driver, called "Samsung ML-451x 501x Series", and driver inf file is ".\Samsung5010\sse2m.inf" _PrintMgr_AddPrinterDriver("Samsung ML-451x 501x Series", "Windows NT x86", @scriptDir & "\Samsung5010", @scriptDir & "\Samsung5010\sse2m.inf") ; Add a TCP/IP printer port, called "MyTCPIPPrinterPort", with IPAddress = 192.168.1.10 and Port = 9100 _PrintMgr_AddTCPIPPrinterPort("MyTCPIPPrinterPort", "192.168.1.10", 9100) ; Add a printer, give it the name "My Printer", use the driver called "Samsung ML-451x 501x Series" and the port called "MyTCPIPPrinterPort" _PrintMgr_AddPrinter("My Printer", "Samsung ML-451x 501x Series", "MyTCPIPPrinterPort") ; Set the printer called "My Printer" as default printer _PrintMgr_SetDefaultPrinter("My Printer") ; Connect to the shared printer "\\192.168.1.1\HPDeskjetColor") _PrintMgr_AddWindowsPrinterConnection("\\192.168.1.1\HPDeskjetColor") ; List all installed printers #Include <Array.au3> $aPrinterList = _PrintMgr_EnumPrinter() _ArrayDisplay($aPrinterList) ; List all printers configuration #Include <Array.au3> $aPrinterConfig = _PrintMgr_EnumPrinterConfiguration() _ArrayDisplay($aPrinterConfig) ; List all installed printer drivers #Include <Array.au3> $aDriverList = _EnumPrinterDriver() _ArrayDisplay($aDriverList) ; Retrieve the printer configuration for the printer called "Lexmark T640" #Include <Array.au3> $aPrinterConfig = _PrintMgr_EnumPrinterConfiguration("Lexmark T640") _ArrayDisplay($aPrinterConfig) ; Add a local printer port (for a file output) _AddLocalPrinterPort("c:\temp\output.pcl") ; Remove the local port _RemoveLocalPrinterPort("c:\temp\output.pcl") Download link :  PrintMgr.au3
    • jguinch
      By jguinch
      Here is an UDF for managing printers.
      Features are :
       - add, remove or rename a printer
       - add or remove a driver
       - add or remove a TCP/IP printer port
       - add or remove a LPR printer port
       - connect to a remote printer
       - enum printers and there configuration and properties
       - pause resume or cancel all jobs of a printer
       - checks if a printer exists
       - print a test page
       - set the default printer
    • ripdad
      By ripdad
      This function (version 1), was developed solely for applications I needed it for.
      It was only tested with Class names that was needed in those scripts.
      And so, I didn't want to release it by itself because I knew it needed some more
      work before I did that.
      Recently, I delved back into it after several years and am now releasing version 2,
      which was mostly rewritten over the past several weeks.
      What does it do? It retrieves the properties and values pertaining to your computer,
      operating system and devices. All you need is a valid Win32 Class Name.
      So, here it is -- let me know if you have any issues!
      Updated to v2.25, January 14, 2017
      Download: _WMI_InstancesOf_v2.25.au3
       
    • TMelanson
      By TMelanson
      Hi folks,
      I'm hoping someone can help me out here.
      Background:
      I have the need to run a program with admin credentials (#RequireAdmin), and then get the SID of the locally logged in account. Not the admin account.
      If you look at the attached script, Line 16 uses the @UserName variable and returns the SID for the admin account I used to launch the app.
      I want to use line 17 which passes the result of the _GetUsername function which is a username using  ($UserName) to the WMIService.
      I'm getting " The requested action with this object has failed.:" error message.
      Any suggestions would be appreciated!
       
      test1.au3