Jump to content

Recommended Posts

  • Replies 111
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

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, drive

There was an error in the WMI query, fixed now (please download the updated file) Yes, you have to use the share name for remote shared printers (I added a remarks in the function header)

I got it to work, but you have to use the FQDN of the print server i.e \\Servername.domain.com\Printer name.

Posted Images

@jguinch I download your UDF from OP and chceck them ... little refactor to be compilant with:

#AutoIt3Wrapper_Run_AU3Check=Y
#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7

There is one problem in:

Func _PrintMgr_AddTCPIPPrinterPort($sPortName, $sPortIP, $sPortNumber)
    Local $oWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
    If Not IsObj($oWMIService) Then Return SetError(1, 0, 0)
    Local $oNewPort = $oWMIService.Get("Win32_TCPIPPrinterPort").SpawnInstance _
            If Not IsObj($oNewPort) Then Return SetError(1, 0, 0)
    $oNewPort.Name = $sPortName
    $oNewPort.Protocol = 1
    $oNewPort.HostAddress = $sPortIP
    $oNewPort.PortNumber = $sPortNumber
    $oNewPort.SNMPEnabled = True
    Local $ret = $oNewPort.Put_
    #forceref $ret
    Return 1
EndFunc   ;==>_PrintMgr_AddTCPIPPrinterPort
Quote

"C:\Users\Szef\Downloads\PrintMgr.au3"(169,4) : error: syntax error
            If
            ^
"C:\Users\Szef\Downloads\PrintMgr.au3"(169,52) : error: Statement cannot be just an expression.
            If Not IsObj($oNewPort) Then Return SetError(1, 0
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\Szef\Downloads\PrintMgr.au3"(169,55) : error: Statement cannot be just an expression.
            If Not IsObj($oNewPort) Then Return SetError(1, 0, 0
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\Szef\Downloads\PrintMgr.au3"(169,57) : error: Statement cannot be just an expression.
            If Not IsObj($oNewPort) Then Return SetError(1, 0, 0)
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

 

Could you please check it ?

EDIT:
Here are my modifed/refactored/reviewed scripts:

PrintMgr.au3 PrintMgr_Example.au3

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * for other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE *

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2021-10-18

Link to post
Share on other sites
On 9/22/2020 at 11:16 AM, mLipok said:

Could you please check it ?

Will you be able to look on this ?

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * for other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE *

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2021-10-18

Link to post
Share on other sites

Sorry, @mLipok I didn't take enough time to correct all.

I just downloaded your corrected version (and also added corrections) + updated/corrected the example code.

 

Link to post
Share on other sites

New version:

Quote

#CS
    HISTORY and RELASE NOTES
    2013/10/17-2020/09/21 @jguinch and other..... I @mLipok do not know the story @jguinch must to rewrite it :)

    2020/09/22 @mlipok
    * changed - little refactor to be compilant with Au3Check

    2020/09/24 @jguinch
    * fixed - issue which @mLipok found thanks to Au3Check - .SpawnInstance _
    * fixed - in _PrintMgr_RemoveLPRPort() function header/documentation _AddLocalPrinterPort >> _PrintMgr_AddLPRPort


    2020/09/25 @mlipok
    * added - HISTORY and RELASE NOTES
    * fixed - in _PrintMgr_RemoveLocalPort() function header/documentation _AddLocalPrinterPort >> _PrintMgr_AddLocalPort
    * changed - proper functions name _Printmgr_* >> _PrintMgr_*
    * changed - modified example - fixed for Au3Check compilance and fixed function names

#CE
 

@jguinch please check when you will have some spare time.

 

PrintMgr.au3 PrintMgr_Example.au3

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * for other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE *

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2021-10-18

Link to post
Share on other sites
  • 1 month later...

@maniootek : well, I thought  about it but didn't really know how.

Here is a new version (-see first message- ). Please, give me your advice

PrintMgr.au3

Edited by jguinch
Link to post
Share on other sites
10 minutes ago, jguinch said:

@maniootek : well, I thought  about it but didn't really know how.

Here is a new version. Please, give me your advice : PrintMgr.au3

Yes, this is it. Please also note that if you have some constants with value starting from 0 and increase by 1+ you can use Enum instead of declaring each variable.

This piece of code:

Global Const $PRINTMGR_PROPERTY_ATTRIBUTES = 0
Global Const $PRINTMGR_PROPERTY_AVAILABILITY = 1
Global Const $PRINTMGR_PROPERTY_AVAILABLEJOBSHEETS = 2
Global Const $PRINTMGR_PROPERTY_AVERAGEPAGESPERMINUTE = 3

Do the same job as this one:

Global Enum $PRINTMGR_PROPERTY_ATTRIBUTES, $PRINTMGR_PROPERTY_AVAILABILITY, $PRINTMGR_PROPERTY_AVAILABLEJOBSHEETS, $PRINTMGR_PROPERTY_AVERAGEPAGESPERMINUTE

But anyway, the first version even looks better.

Link to post
Share on other sites

yes, I know, but I find it more readable like it. 🙂

... and "some constants with value starting from 0" => it can start with another value (ex Global Const $val = 50, $val2 ...

@maniootek : the downloaded link is updated. Thanks for your advice.
Edit : I added your name in the HISTORY 😉

Edited by jguinch
Link to post
Share on other sites

I tweaked the function to get more options!

Global $_PrintMgr_ObjError=0, $_ObjError = ObjEvent("AutoIt.Error", "_ObjError")   ; Initialize a COM error handler
; This is custom defined error handler
Func _ObjError()
    $_PrintMgr_ObjError=1
    Return SetError(1, 0, 0)
EndFunc   ;==>_ObjError

Func _PrintMgr_AddTCPIPPrinterPort($sPortName, $sPortIP, $sPortNumber, $sProtocol = 1, $sSNMPEnabled = True, $sLPRQueue = Default, $sByteCount = Default, $sDisableBidi = False,$sPrinterName="" ) ; Protocol 1=RAW, 2=LPR
    Local $oWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
    If Not IsObj($oWMIService) Then Return SetError(1, 0, 0)
    Local $oNewPort = $oWMIService.Get("Win32_TCPIPPrinterPort").SpawnInstance_
    If Not IsObj($oNewPort) Then Return SetError(1, 0, 0)
    $oNewPort.Name = $sPortName
    $oNewPort.Protocol = $sProtocol
    $oNewPort.HostAddress = $sPortIP
    $oNewPort.PortNumber = $sPortNumber
    If $sByteCount <> Default Then $oNewPort.ByteCount = $sByteCount
    If $sLPRQueue <> Default Then $oNewPort.Queue = $sLPRQueue
    If Not $sLPRQueue Then $oNewPort.SNMPEnabled = $sSNMPEnabled
    Local $ret = $oNewPort.Put_
    #forceref $ret
    If $sDisableBidi And ($sPrinterName<>"") Then Run('"' & @ComSpec & '" /c rundll32 printui.dll,PrintUIEntry /Xs /n "' & $sPrinterName & '" attributes -EnableBidi', @WindowsDir & "\System32", @SW_HIDE)
    If $_PrintMgr_ObjError=1 Then 
        $_PrintMgr_ObjError=0
        Return SetError(1, 0, $ret)
    EndIf
    Return 1
EndFunc   ;==>_PrintMgr_AddTCPIPPrinterPort

 

Edited by VIP
iRet

Regards,
 

Link to post
Share on other sites
  • 1 month later...

@VIP

Sorry fot the delay. I just checked the behaviour that you pointed out, and I didn't manage to reproduce the issue.

The printer was removed in both the Printer management and the Printers standard GUI

I think it's a display issue due to the use of #RequireAdmin in a non-admin user session.

 

 

 

 

 

Link to post
Share on other sites
  • 7 months later...

Hi all 

My Script  or Script to EXE works fine on my PC , but not on others. Could any one help review my code and give me some advice ?

#include <Array.au3>
#include "PrintMgr\PrintMgr.au3"


DriveMapAdd("P:", "\\192.168.2.78\Driver\Printer Driver")
_PrintMgr_AddPrinterDriver("Canon Generic Plus UFR II", "Windows NT x64", "P:\\GPlus_UFRII_Driver_V220_W64_2011\Driver","P:\\GPlus_UFRII_Driver_V220_W64_2011\Driver\CNLB0MA64.INF")
_PrintMgr_AddTCPIPPrinterPort("SDD-CANON-IR-ADV-C5550", "SDD-CANON-IR-ADV-C5550", 9100)
_PrintMgr_AddPrinter("iR-ADV C5550", "Canon Generic Plus UFR II", "SDD-CANON-IR-ADV-C5550")

_PrintMgr_SetDefaultPrinter("iR-ADV C5550")
DriveMapDel("P:")

here is the error message

I saw someone got the error too, I'm sure it's not about the permission. 

>"C:\Users\Administrator\Desktop\AutoIT\AutoIT\autoit-v3\install\SciTe\..\AutoIt3.exe" "C:\Users\Administrator\Desktop\AutoIT\AutoIT\autoit-v3\install\SciTe\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "C:\Users\Administrator\Desktop\AutoIT\AutoIT\GUI\MetroUDF-v5.1\MetroUDF-v5.1\MetroPrintinstall_Test.au3" /UserParams    
+>14:56:18 Starting AutoIt3Wrapper (19.1127.1402.0} from:SciTE.exe (3.5.4.0)  Keyboard:00000404  OS:WIN_10/  CPU:X64 OS:X64  Environment(Language:0404)  CodePage:950  utf8.auto.check:4
+>         SciTEDir => C:\Users\Administrator\Desktop\AutoIT\AutoIT\autoit-v3\install\SciTe   UserDir => C:\Users\Administrator\Desktop\AutoIT\AutoIT\autoit-v3\install\SciTe\AutoIt3Wrapper
>Running AU3Check (3.3.14.4)  from:C:\Users\Administrator\Desktop\AutoIT\AutoIT\autoit-v3\install  input:C:\Users\Administrator\Desktop\AutoIT\AutoIT\GUI\MetroUDF-v5.1\MetroUDF-v5.1\MetroPrintinstall_Test.au3
+>14:56:19 AU3Check ended.rc:0
>Running:(3.3.14.4):C:\Users\Administrator\Desktop\AutoIT\AutoIT\autoit-v3\install\autoit3_x64.exe "C:\Users\Administrator\Desktop\AutoIT\AutoIT\GUI\MetroUDF-v5.1\MetroUDF-v5.1\MetroPrintinstall_Test.au3"    
+>Setting Hotkeys...--> Press Ctrl+Alt+Break to Restart or Ctrl+BREAK to Stop.
"C:\Users\Administrator\Desktop\AutoIT\AutoIT\GUI\MetroUDF-v5.1\MetroUDF-v5.1\PrintMgr\PrintMgr.au3" (312) : ==> The requested action with this object has failed.:
$oPrinter.Put_
$oPrinter^ ERROR

->14:56:19 AutoIt3.exe ended.rc:1
+>14:56:19 AutoIt3Wrapper Finished.

>Process failed to respond; forcing abrupt termination...>Exit code: 2    Time: 4.491

 

Edited by aaronhunter
more information
Link to post
Share on other sites

 

This error could be related to Au3Check, so I do some review here:

https://docs.microsoft.com/en-us/windows/win32/cimwin32prov/win32-printer#methods

and I do not see such method property ".Put_"
 

Of coruse my investigation could be wrong.

 

EDIT:
running PrintMgr_Example.au3 without Au3Check
 

Quote

OK
Line 312  (File "Z:\!!!_SVN_AU3\UDF_Forum\_Not_Used_Yet\PrintMgr\PrintMgr.au3"):

$oPrinter.Put_
$oPrinter^ ERROR

Error: The requested action with this object has failed.

So this object doesn't have such a method property.

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * for other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE *

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2021-10-18

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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By hek
      Hey everyone,
      Was wondering how I would be able to implement this on a local computer instead of using connectserver? 
      Any suggestions or help would be appreciated. Thanks. 
    • By DirtyJohny
      Hi everyone.Need rewrite this function how in еxample.
      Original:
      #RequireAdmin #NoTrayIcon Opt("MustDeclareVars",1) Func _a() Local $sls=ObjGet("winmgmts:{impersonationLevel=impersonate," _ &"authenticationLevel=Pkt}!\\"& _ @ComputerName&'\root\wmi'),$lss=$sls.ExecQuery _ ('SELECT * FROM WmiMonitorID'), _ $lll,$sll,$sss="",$lsl,$lls,$i,$z For $z In $lss $lsl=$z.UserFriendlyName For $i=0 To Ubound($lsl)-1 if ($lsl[$i]) Then $lll&=Chr($lsl[$i]) Next $lls=$z.SerialNumberID For $i=0 To Ubound($lls)-1 if ($lls[$i]) Then $sll&=Chr($lls[$i]) Next $sss&="Model"&@TAB&@TAB&": "&$lll&@CR&"Serial Number"&@TAB&": "&$sll&@CR&@CR $lll="" $sll="" Next MsgBox(262144,'Monitors '&$lss.Count,$sss&" "&@CR) $lss=Null $sls=Null EndFunc _a() Example:
      Func _InfoPC() Local $ObjService = ObjGet('winmgmts:{impersonationLevel = impersonate}!\\' & @ComputerName & '\root\cimv2') Local $ObjMB = $ObjService.ExecQuery('SELECT * FROM Win32_BaseBoard', 'WQL', 0x30) If IsObj($ObjService) Then For $objItemMB In $ObjMB $sInfo &= @TAB & 'Motherboard: ...... ' & $objItemMB.Product & @CRLF I'm beginner in this sphere and need  you all speak easy and simply because i'm Russian.Thanks)
    • By shital
      #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseX64=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** RunAs(test", @ComputerName, "testinng",2,"wmic product where ""name= '%notepadexamples%'"" call uninstall", @SystemDir & "\wbem", @SW_MAXIMIZE)  it not working 
       
    • By Colduction
      Hi AutoIt Programmers!

      I've seen a code that gives Name of Group by writing it's group's SID, but this one response very slower than Windows Command-Line WMIC
       
      Func _GetLocalGroupName($sSID = 'S-1-5-18') $objWMIService = ObjGet ("winmgmts:\\" & @ComputerName & "\root\cimv2") $colItems = $objWMIService.ExecQuery('SELECT Name FROM Win32_Group where SID="' & $sSID & '"') For $GroupNames in $colItems MsgBox (0,"",$GroupNames.Name) ExitLoop Next EndFunc I don't want call and use any third-party programs even CMD, i just want use from Windows API, netapi32.dll or AutoIt Functions (Standalone).
      Do you have any idea to improve speed/performance of this code? I'll happy of your comments
       
       
       
      ====================== SOLOUTION by @Subz ======================
       
    • By jresine
      Hello, is it possible to know via a script or command, to have the percentage of disk usage of a process? thank you in advance.
      ps: see image

×
×
  • Create New...