<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.autoitscript.com/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=232showtime</id>
	<title>AutoIt Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://www.autoitscript.com/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=232showtime"/>
	<link rel="alternate" type="text/html" href="https://www.autoitscript.com/wiki/Special:Contributions/232showtime"/>
	<updated>2026-04-22T14:04:05Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.6</generator>
	<entry>
		<id>https://www.autoitscript.com/w/index.php?title=Snippets_(_Windows_Information_)&amp;diff=13488</id>
		<title>Snippets ( Windows Information )</title>
		<link rel="alternate" type="text/html" href="https://www.autoitscript.com/w/index.php?title=Snippets_(_Windows_Information_)&amp;diff=13488"/>
		<updated>2016-07-10T09:05:43Z</updated>

		<summary type="html">&lt;p&gt;232showtime: /* _PathSplitEx */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
[[category:Snippets]]&lt;br /&gt;
&lt;br /&gt;
{{Snippet Credit Header}}&lt;br /&gt;
&lt;br /&gt;
== _ComputerGetStartup ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
 | AuthorURL = 35302-guinness&lt;br /&gt;
 | AuthorName = guinness&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;Array.au3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Local $aArray = _ComputerGetStartup()&lt;br /&gt;
_ArrayDisplay($aArray)&lt;br /&gt;
&lt;br /&gt;
Func _ComputerGetStartup()&lt;br /&gt;
    Local $aReturn[2][6] = [[0, 6]], $oColItems, $oObjectItem, $oWMIService&lt;br /&gt;
&lt;br /&gt;
    $oWMIService = ObjGet(&amp;quot;winmgmts:\\&amp;quot; &amp;amp; @ComputerName &amp;amp; &amp;quot;\root\CIMV2&amp;quot;)&lt;br /&gt;
    $oColItems = $oWMIService.ExecQuery(&amp;quot;Select * From Win32_StartupCommand&amp;quot;, &amp;quot;WQL&amp;quot;, 0x30)&lt;br /&gt;
&lt;br /&gt;
    If IsObj($oColItems) Then&lt;br /&gt;
        For $oObjectItem In $oColItems&lt;br /&gt;
            If ($aReturn[0][0] + 1) &amp;gt;= $aReturn[0][2] Then&lt;br /&gt;
                $aReturn[0][2] = ($aReturn[0][0] + 1) * 2&lt;br /&gt;
                ReDim $aReturn[$aReturn[0][2]][$aReturn[0][1]]&lt;br /&gt;
            EndIf&lt;br /&gt;
            $aReturn[0][0] += 1&lt;br /&gt;
            $aReturn[$aReturn[0][0]][0] = $oObjectItem.Name&lt;br /&gt;
            $aReturn[$aReturn[0][0]][1] = $oObjectItem.User&lt;br /&gt;
            $aReturn[$aReturn[0][0]][2] = $oObjectItem.Location&lt;br /&gt;
            $aReturn[$aReturn[0][0]][3] = $oObjectItem.Command&lt;br /&gt;
            $aReturn[$aReturn[0][0]][4] = $oObjectItem.Description&lt;br /&gt;
            $aReturn[$aReturn[0][0]][5] = $oObjectItem.SettingID&lt;br /&gt;
        Next&lt;br /&gt;
        ReDim $aReturn[$aReturn[0][0] + 1][$aReturn[0][1]]&lt;br /&gt;
        Return $aReturn&lt;br /&gt;
    EndIf&lt;br /&gt;
    Return SetError(1, 0, $aReturn)&lt;br /&gt;
EndFunc   ;==&amp;gt;_ComputerGetStartup&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== DriveInfo ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
 | AuthorName = Unknown&lt;br /&gt;
 | ModifierURL = 60350-chimaera&lt;br /&gt;
 | ModifierName = Chimaera&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
Example()&lt;br /&gt;
&lt;br /&gt;
Func Example()&lt;br /&gt;
	Local $aDriveArray = DriveGetDrive(&amp;quot;ALL&amp;quot;)&lt;br /&gt;
	If @error = 0 Then&lt;br /&gt;
		Local $sDriveInfo = &amp;quot;&amp;quot;&lt;br /&gt;
		For $i = 1 To $aDriveArray[0]&lt;br /&gt;
			$sDriveInfo &amp;amp;= StringUpper($aDriveArray[$i]) &amp;amp; &amp;quot;\&amp;quot; &amp;amp; @CRLF&lt;br /&gt;
			$sDriveInfo &amp;amp;= @TAB &amp;amp; &amp;quot;File System = &amp;quot; &amp;amp; DriveGetFileSystem($aDriveArray[$i]) &amp;amp; @CRLF&lt;br /&gt;
			$sDriveInfo &amp;amp;= @TAB &amp;amp; &amp;quot;Label = &amp;quot; &amp;amp; DriveGetLabel($aDriveArray[$i]) &amp;amp; @CRLF&lt;br /&gt;
			$sDriveInfo &amp;amp;= @TAB &amp;amp; &amp;quot;Serial = &amp;quot; &amp;amp; DriveGetSerial($aDriveArray[$i]) &amp;amp; @CRLF&lt;br /&gt;
			$sDriveInfo &amp;amp;= @TAB &amp;amp; &amp;quot;Type = &amp;quot; &amp;amp; DriveGetType($aDriveArray[$i]) &amp;amp; @CRLF&lt;br /&gt;
			$sDriveInfo &amp;amp;= @TAB &amp;amp; &amp;quot;Free Space = &amp;quot; &amp;amp; DriveSpaceFree($aDriveArray[$i]) &amp;amp; @CRLF&lt;br /&gt;
			$sDriveInfo &amp;amp;= @TAB &amp;amp; &amp;quot;Total Space = &amp;quot; &amp;amp; DriveSpaceTotal($aDriveArray[$i]) &amp;amp; @CRLF&lt;br /&gt;
			$sDriveInfo &amp;amp;= @TAB &amp;amp; &amp;quot;Status = &amp;quot; &amp;amp; DriveStatus($aDriveArray[$i]) &amp;amp; @CRLF&lt;br /&gt;
			$sDriveInfo &amp;amp;= @CRLF&lt;br /&gt;
		Next&lt;br /&gt;
		MsgBox(4096, &amp;quot;&amp;quot;, $sDriveInfo)&lt;br /&gt;
	EndIf&lt;br /&gt;
EndFunc   ;==&amp;gt;Example&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== Find If An Application Is Hung ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
 | AuthorURL = 10247-neogia&lt;br /&gt;
 | AuthorName = neogia&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
; Find If An Application Is Hung&lt;br /&gt;
&lt;br /&gt;
If _NotResponding(&amp;quot;TITLE HERE&amp;quot;, &amp;quot;TEXT HERE[OPTIONAL]&amp;quot;, 1) Then ; The last parameter indicates whether you want to close the hung app or not.&lt;br /&gt;
    MsgBox(0,&amp;quot;&amp;quot;, &amp;quot;Hung Application, closing app now.&amp;quot;)&lt;br /&gt;
Else&lt;br /&gt;
    MsgBox(0,&amp;quot;&amp;quot;, &amp;quot;Application running as intended.&amp;quot;)&lt;br /&gt;
EndIf&lt;br /&gt;
&lt;br /&gt;
Func _NotResponding($title, $text, $closeIfHung = 0)&lt;br /&gt;
    $hWnd = WinGetHandle($title, $text)&lt;br /&gt;
    If $hWnd == &amp;quot;&amp;quot; Then&lt;br /&gt;
        MsgBox(0,&amp;quot;Error&amp;quot;,&amp;quot;Could not find window&amp;quot;)&lt;br /&gt;
        Exit&lt;br /&gt;
    EndIf&lt;br /&gt;
    $retArr = DllCall(&amp;quot;user32.dll&amp;quot;, &amp;quot;int&amp;quot;, &amp;quot;IsHungAppWindow&amp;quot;, &amp;quot;hwnd&amp;quot;, $hWnd)&lt;br /&gt;
    If @error == 0 Then&lt;br /&gt;
        If $retArr[0] == 1 Then&lt;br /&gt;
            If $closeIfHung Then&lt;br /&gt;
                ProcessClose(WinGetProcess($title, $text))&lt;br /&gt;
            EndIf&lt;br /&gt;
            Return 1&lt;br /&gt;
        EndIf&lt;br /&gt;
    Else&lt;br /&gt;
        Return 0&lt;br /&gt;
    EndIf&lt;br /&gt;
EndFunc&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _GetDefBrowser ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
 | AuthorURL = 44525-jscript&lt;br /&gt;
 | AuthorName = JScript&lt;br /&gt;
 | Desc = Check to see which browser is the default.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
; Check to see which browser is the default.&lt;br /&gt;
&lt;br /&gt;
MsgBox(4096, &amp;quot;Default browser&amp;quot;, &amp;quot;My default browser is: &amp;quot; &amp;amp; _GetDefBrowser())&lt;br /&gt;
&lt;br /&gt;
Func _GetDefBrowser()&lt;br /&gt;
    Local $sRegRead = RegRead(&amp;quot;HKCR\http\shell\open\command&amp;quot;, &amp;quot;&amp;quot;)&lt;br /&gt;
    Return StringRegExpReplace($sRegRead, &amp;quot;(.*?\x22)(.*?[\\/])*(.*?)(\x22.*?\z)&amp;quot;, &amp;quot;$3&amp;quot;) ; &amp;lt;&amp;lt; Credits to SmOke_N&lt;br /&gt;
EndFunc   ;==&amp;gt;_GetDefBrowser&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _GetDefaultBrowser ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
 | AuthorURL = 35302-guinness&lt;br /&gt;
 | AuthorName = guinness&lt;br /&gt;
 | Desc = Get the default browser of the system.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
; Get the default browser of the system.&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;APIConstants.au3&amp;gt; ; Download from http://www.autoitscript.com/forum/topic/98712-winapiex-udf/ by Yashied.&lt;br /&gt;
#include &amp;lt;WinAPIEx.au3&amp;gt; ; Download from http://www.autoitscript.com/forum/topic/98712-winapiex-udf/ by Yashied.&lt;br /&gt;
&lt;br /&gt;
ConsoleWrite(_GetDefaultBrowser() &amp;amp; @CRLF)&lt;br /&gt;
&lt;br /&gt;
Func _GetDefaultBrowser()&lt;br /&gt;
  Return _WinAPI_AssocQueryString(&amp;quot;.html&amp;quot;, $ASSOCSTR_EXECUTABLE)&lt;br /&gt;
EndFunc   ;==&amp;gt;_GetDefaultBrowser&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _GetDefaultPrinter ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
 | AuthorURL = 35302-guinness&lt;br /&gt;
 | AuthorName = guinness&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
; Check to see which printer is the default.&lt;br /&gt;
&lt;br /&gt;
ConsoleWrite(_GetDefaultPrinter() &amp;amp; @CRLF)&lt;br /&gt;
&lt;br /&gt;
; Get the default printer.&lt;br /&gt;
Func _GetDefaultPrinter()&lt;br /&gt;
    Local $sResult = &#039;None&#039;, $oWMIService = ObjGet(&#039;winmgmts:\\&#039; &amp;amp; &#039;.&#039; &amp;amp; &#039;\root\cimv2&#039;)&lt;br /&gt;
    Local $oColItems = $oWMIService.ExecQuery(&#039;Select * From Win32_Printer Where Default = True&#039;)&lt;br /&gt;
    If IsObj($oColItems) Then&lt;br /&gt;
        For $oObjectItem In $oColItems&lt;br /&gt;
            $sResult = $oObjectItem.DeviceID&lt;br /&gt;
        Next&lt;br /&gt;
    EndIf&lt;br /&gt;
    Return $sResult&lt;br /&gt;
EndFunc   ;==&amp;gt;_GetDefaultPrinter&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _GetDesktopArea ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
 | AuthorURL = 35302-guinness&lt;br /&gt;
 | AuthorName = guinness&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;Array.au3&amp;gt;&lt;br /&gt;
#include &amp;lt;WinAPI.au3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Local $aArray = _GetDesktopArea()&lt;br /&gt;
_ArrayDisplay($aArray)&lt;br /&gt;
&lt;br /&gt;
; Get the working visible area of the desktop, this doesn&#039;t include the area covered by the taskbar.&lt;br /&gt;
Func _GetDesktopArea()&lt;br /&gt;
    Local Const $SPI_GETWORKAREA = 48&lt;br /&gt;
    Local $tWorkArea = DllStructCreate($tagRECT)&lt;br /&gt;
    _WinAPI_SystemParametersInfo($SPI_GETWORKAREA, 0, DllStructGetPtr($tWorkArea))&lt;br /&gt;
    Local $aReturn[4] = [DllStructGetData($tWorkArea, &amp;quot;Left&amp;quot;), DllStructGetData($tWorkArea, &amp;quot;Top&amp;quot;), _&lt;br /&gt;
            DllStructGetData($tWorkArea, &amp;quot;Right&amp;quot;) - DllStructGetData($tWorkArea, &amp;quot;Left&amp;quot;), DllStructGetData($tWorkArea, &amp;quot;Bottom&amp;quot;) - DllStructGetData($tWorkArea, &amp;quot;Top&amp;quot;)]&lt;br /&gt;
    Return $aReturn&lt;br /&gt;
EndFunc   ;==&amp;gt;_GetDesktopArea&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _GetDriveBySerial ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
 | AuthorURL = 35302-guinness&lt;br /&gt;
 | AuthorName = guinness&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
ConsoleWrite( _GetDriveBySerial(&amp;quot;S3Ri41&amp;quot;) &amp;amp; @LF)&lt;br /&gt;
&lt;br /&gt;
Func _GetDriveBySerial($sSerial)&lt;br /&gt;
    Local $aDriveList[25] = [24, &amp;quot;C:&amp;quot;, &amp;quot;D:&amp;quot;, &amp;quot;E:&amp;quot;, &amp;quot;F:&amp;quot;, &amp;quot;G:&amp;quot;, &amp;quot;H:&amp;quot;, &amp;quot;I:&amp;quot;, &amp;quot;J:&amp;quot;, &amp;quot;K:&amp;quot;, &amp;quot;L:&amp;quot;, &amp;quot;M:&amp;quot;, &amp;quot;N:&amp;quot;, &amp;quot;O:&amp;quot;, &amp;quot;P:&amp;quot;, _&lt;br /&gt;
            &amp;quot;Q:&amp;quot;, &amp;quot;R:&amp;quot;, &amp;quot;S:&amp;quot;, &amp;quot;T:&amp;quot;, &amp;quot;U:&amp;quot;, &amp;quot;V:&amp;quot;, &amp;quot;W:&amp;quot;, &amp;quot;X:&amp;quot;, &amp;quot;Y:&amp;quot;, &amp;quot;Z:&amp;quot;]&lt;br /&gt;
    For $A = 1 To $aDriveList[0]&lt;br /&gt;
        If (DriveGetSerial($aDriveList[$A]) = $sSerial And DriveStatus($aDriveList[$A]) = &amp;quot;READY&amp;quot;) Then&lt;br /&gt;
            Return $aDriveList[$A]&lt;br /&gt;
        EndIf&lt;br /&gt;
    Next&lt;br /&gt;
    Return SetError(1, 0, &amp;quot;(Unknown)&amp;quot;)&lt;br /&gt;
EndFunc   ;==&amp;gt;_GetDriveBySerial&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _GetDriveMediaType ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
 | AuthorURL = 35302-guinness&lt;br /&gt;
 | AuthorName = guinness&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
MsgBox(4096, &#039;&#039;, &#039;The media type of the E:\ drive is: &#039; &amp;amp; _GetDriveMediaType(&#039;E:&#039;))&lt;br /&gt;
&lt;br /&gt;
Func _GetDriveMediaType($sDrive)&lt;br /&gt;
    Local $oWMIService = ObjGet(&#039;winmgmts:\\&#039; &amp;amp; &#039;.&#039; &amp;amp; &#039;\root\cimv2&#039;)&lt;br /&gt;
    Local $oColItems = $oWMIService.ExecQuery(&#039;Select * From Win32_CDROMDrive Where Drive = &amp;quot;&#039; &amp;amp; StringLeft($sDrive, 2) &amp;amp; &#039;&amp;quot;&#039;, &#039;WQL&#039;, 0x30), $sReturn = &#039;&#039;&lt;br /&gt;
    If IsObj($oColItems) Then&lt;br /&gt;
        For $oObjectItem In $oColItems&lt;br /&gt;
            $sReturn &amp;amp;= $oObjectItem.MediaType&lt;br /&gt;
        Next&lt;br /&gt;
        Return $sReturn&lt;br /&gt;
    EndIf&lt;br /&gt;
    Return SetError(1, 0, &#039;&#039;)&lt;br /&gt;
EndFunc   ;==&amp;gt;_GetDriveMediaType&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _GetFileDrive ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
 | AuthorURL = 35302-guinness&lt;br /&gt;
 | AuthorName = guinness&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
ConsoleWrite(_GetFileDrive(@ScriptFullPath) &amp;amp; @CRLF)&lt;br /&gt;
&lt;br /&gt;
; Get the drive letter of a filepath. Idea from _PathSplit.&lt;br /&gt;
Func _GetFileDrive($sFilePath)&lt;br /&gt;
    Return StringLeft($sFilePath, StringInStr($sFilePath, &amp;quot;:&amp;quot;, 2, 1) + 1)&lt;br /&gt;
EndFunc   ;==&amp;gt;_GetFileDrive&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _GetFileExtension ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
 | AuthorURL = 35302-guinness&lt;br /&gt;
 | AuthorName = guinness&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
ConsoleWrite(_GetFileExtension(@ScriptFullPath) &amp;amp; @CRLF)&lt;br /&gt;
&lt;br /&gt;
; Get the file extension including the dot of a filepath. Idea from _PathSplit.&lt;br /&gt;
Func _GetFileExtension($sFilePath)&lt;br /&gt;
    Return StringTrimLeft($sFilePath, StringInStr($sFilePath, &amp;quot;.&amp;quot;, 2, -1) - 1)&lt;br /&gt;
EndFunc   ;==&amp;gt;_GetFileExtension&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _GetFileName ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
 | AuthorURL = 35302-guinness&lt;br /&gt;
 | AuthorName = guinness&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
ConsoleWrite(_GetFileName(@ScriptFullPath) &amp;amp; @CRLF)&lt;br /&gt;
&lt;br /&gt;
; Get the filename including the extension of a filepath. Idea from _PathSplit.&lt;br /&gt;
Func _GetFileName($sFilePath)&lt;br /&gt;
    Return StringTrimLeft($sFilePath, StringInStr($sFilePath, &amp;quot;\&amp;quot;, 2, -1))&lt;br /&gt;
EndFunc   ;==&amp;gt;_GetFileName&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _GetFilePath ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
 | AuthorURL =  35302-guinness&lt;br /&gt;
 | AuthorName = guinness&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
ConsoleWrite(_GetFilePath(@ScriptFullPath) &amp;amp; @CRLF)&lt;br /&gt;
&lt;br /&gt;
; Get the directory part of a filepath. Idea from _PathSplit.&lt;br /&gt;
Func _GetFilePath($sFilePath)&lt;br /&gt;
    Return StringLeft($sFilePath, StringInStr($sFilePath, &amp;quot;\&amp;quot;, 2, -1) - 1)&lt;br /&gt;
EndFunc   ;==&amp;gt;_GetFilePath&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _GetFullPath ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
 | AuthorURL = 35302-guinness&lt;br /&gt;
 | AuthorName = guinness&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
; Creates a path based on the relative path you provide. Similar to _PathFull.&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;WinAPIEx.au3&amp;gt; ; Download from http://www.autoitscript.com/forum/topic/98712-winapiex-udf/ by Yashied.&lt;br /&gt;
&lt;br /&gt;
ConsoleWrite(_GetFullPath(&amp;quot;.\&amp;quot; &amp;amp; @ScriptName) &amp;amp; @CRLF)&lt;br /&gt;
&lt;br /&gt;
Func _GetFullPath($sRelativePath, $sBasePath = @WorkingDir)&lt;br /&gt;
    Local $sWorkingDir = @WorkingDir&lt;br /&gt;
    FileChangeDir($sBasePath)&lt;br /&gt;
    $sRelativePath = _WinAPI_GetFullPathName($sRelativePath)&lt;br /&gt;
    FileChangeDir($sWorkingDir)&lt;br /&gt;
    Return $sRelativePath&lt;br /&gt;
EndFunc   ;==&amp;gt;_GetFullPath&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _GetInstalledPath ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
 | AuthorURL = 42391-storme&lt;br /&gt;
 | AuthorName = storme&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7&lt;br /&gt;
;#AutoIt3Wrapper_Run_Debug_Mode=y&lt;br /&gt;
Func example()&lt;br /&gt;
Local $installedPath&lt;br /&gt;
$installedPath = _GetInstalledPath(&amp;quot;Adobe Reader&amp;quot;)&lt;br /&gt;
ConsoleWrite(&#039;@@ Debug(&#039; &amp;amp; @ScriptLineNumber &amp;amp; &#039;) : $installedPath = &#039; &amp;amp; $installedPath &amp;amp; &#039; &amp;gt;Error code: &#039; &amp;amp; @error &amp;amp; @crlf) ;### Debug Console&lt;br /&gt;
$installedPath = _GetInstalledPath(&amp;quot;KB2482017&amp;quot;)&lt;br /&gt;
ConsoleWrite(&#039;@@ Debug(&#039; &amp;amp; @ScriptLineNumber &amp;amp; &#039;) : $installedPath = &#039; &amp;amp; $installedPath &amp;amp; &#039; &amp;gt;Error code: &#039; &amp;amp; @error &amp;amp; @crlf) ;### Debug Console&lt;br /&gt;
$installedPath = _GetInstalledPath(&amp;quot;EASEUS Todo Backup Free&amp;quot;)&lt;br /&gt;
ConsoleWrite(&#039;@@ Debug(&#039; &amp;amp; @ScriptLineNumber &amp;amp; &#039;) : $installedPath = &#039; &amp;amp; $installedPath &amp;amp; &#039; &amp;gt;Error code: &#039; &amp;amp; @error &amp;amp; @crlf) ;### Debug Console&lt;br /&gt;
$installedPath = _GetInstalledPath(&amp;quot;InCD!UninstallKey&amp;quot;)&lt;br /&gt;
ConsoleWrite(&#039;@@ Debug(&#039; &amp;amp; @ScriptLineNumber &amp;amp; &#039;) : $installedPath = &#039; &amp;amp; $installedPath &amp;amp; &#039; &amp;gt;Error code: &#039; &amp;amp; @error &amp;amp; @crlf) ;### Debug Console&lt;br /&gt;
EndFunc   ;==&amp;gt;example&lt;br /&gt;
; #FUNCTION# ====================================================================================================================&lt;br /&gt;
; Name...........: _GetInstalledPath&lt;br /&gt;
; Description ...: Returns the installed path for specified program&lt;br /&gt;
; Syntax.........: GetInstalledPath($sProgamName)&lt;br /&gt;
; Parameters ....: $sProgamName - Name of program to seaach for&lt;br /&gt;
;          - Must be exactly as it appears in the registry unless extended search is used&lt;br /&gt;
;      $fExtendedSearchFlag - True - Search for $sProgamName in &amp;quot;DisplayName&amp;quot; Key&lt;br /&gt;
;      $fSlidingSearch - True - Find $sProgamName anywhere in &amp;quot;DisplayName&amp;quot; Key&lt;br /&gt;
;                                   False - Must be exact match&lt;br /&gt;
; Return values .: Success - returns the install path&lt;br /&gt;
;                 Failure - 0&lt;br /&gt;
;                 [email=&amp;quot;|@Error&amp;quot;]|@Error[/email]  - 1 = Unable to find entry in registry&lt;br /&gt;
;                 [email=&amp;quot;|@Error&amp;quot;]|@Error[/email]  - 2 = No &amp;quot;InstalledLocation&amp;quot; key&lt;br /&gt;
; Author ........: John Morrison aka Storm-E&lt;br /&gt;
; Remarks .......: V1.5 Added scan for $sProgamName in &amp;quot;DisplayName&amp;quot; Thanks to JFX for the idea&lt;br /&gt;
; Related .......:&lt;br /&gt;
; Link ..........:&lt;br /&gt;
; Example .......:&lt;br /&gt;
; AutoIT link ...; [url=&amp;quot;http://www.autoitscript.com/forum/topic/139761-getinstalledpath-from-uninstall-key-in-registry/&amp;quot;]http://www.autoitscript.com/forum/topic/139761-getinstalledpath-from-uninstall-key-in-registry/[/url]&lt;br /&gt;
; ===============================================================================================================================&lt;br /&gt;
Func _GetInstalledPath($sProgamName, $fExtendedSearchFlag = True, $fSlidingSearch = True)&lt;br /&gt;
Local $sBasePath = &amp;quot;HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\&amp;quot;&lt;br /&gt;
Local $sCurrentKey ; Holds current key during search&lt;br /&gt;
Local $iCurrentKeyIndex ; Index to current key&lt;br /&gt;
Local $sInstalledPath = RegRead($sBasePath &amp;amp; $sProgamName, &amp;quot;InstallLocation&amp;quot;)&lt;br /&gt;
If @error Then&lt;br /&gt;
  If @error = -1 Then&lt;br /&gt;
   ;Unable To open InstallLocation so unable to find path&lt;br /&gt;
   Return SetError(2, 0, &amp;quot;&amp;quot;) ; Path Not found&lt;br /&gt;
  EndIf&lt;br /&gt;
  ;Key not found&lt;br /&gt;
  If $fExtendedSearchFlag Then&lt;br /&gt;
   $iCurrentKeyIndex = 1&lt;br /&gt;
   While 1&lt;br /&gt;
    $sCurrentKey = RegEnumKey($sBasePath, $iCurrentKeyIndex)&lt;br /&gt;
    If @error Then&lt;br /&gt;
     ;No keys left&lt;br /&gt;
     Return SetError(1, 0, &amp;quot;&amp;quot;) ; Path Not found&lt;br /&gt;
    EndIf&lt;br /&gt;
    If ($fSlidingSearch And StringInStr(RegRead($sBasePath &amp;amp; $sCurrentKey, &amp;quot;DisplayName&amp;quot;), $sProgamName)) Or (RegRead($sBasePath &amp;amp; $sCurrentKey, &amp;quot;DisplayName&amp;quot;) = $sProgamName) Then&lt;br /&gt;
     ;Program name found in DisplayName&lt;br /&gt;
     $sInstalledPath = RegRead($sBasePath &amp;amp; $sCurrentKey, &amp;quot;InstallLocation&amp;quot;)&lt;br /&gt;
     If @error Then&lt;br /&gt;
      ;Unable To open InstallLocation so unable to find path&lt;br /&gt;
      Return SetError(2, 0, &amp;quot;&amp;quot;) ; Path Not found&lt;br /&gt;
     EndIf&lt;br /&gt;
     ExitLoop&lt;br /&gt;
    EndIf&lt;br /&gt;
    $iCurrentKeyIndex += 1&lt;br /&gt;
   WEnd&lt;br /&gt;
  Else&lt;br /&gt;
   Return SetError(1, 0, &amp;quot;&amp;quot;) ; Path Not found&lt;br /&gt;
  EndIf&lt;br /&gt;
EndIf&lt;br /&gt;
Return $sInstalledPath&lt;br /&gt;
EndFunc   ;==&amp;gt;_GetInstalledPath&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _GetRelativePath ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
 | AuthorURL = 35302-guinness&lt;br /&gt;
 | AuthorName = guinness&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
; Returns the relative path to a directory or file. Similar to _PathGetRelative.&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;WinAPIEx.au3&amp;gt; ; Download from http://www.autoitscript.com/forum/topic/98712-winapiex-udf/ by Yashied.&lt;br /&gt;
&lt;br /&gt;
ConsoleWrite(_GetRelativePath(@ScriptDir, @ProgramFilesDir) &amp;amp; @CRLF) ; Pass the script&#039;s directory.&lt;br /&gt;
ConsoleWrite(_GetRelativePath(@ScriptFullPath, @ProgramFilesDir) &amp;amp; @CRLF) ; Pass the entire file path including the filename.&lt;br /&gt;
&lt;br /&gt;
Func _GetRelativePath($sFrom, $sTo)&lt;br /&gt;
    Local $iIsFolder = Number(_WinAPI_PathIsDirectory($sTo) &amp;gt; 0), $sRelativePath = &#039;&#039;&lt;br /&gt;
    If $iIsFolder Then&lt;br /&gt;
        $sTo = _WinAPI_PathAddBackslash($sTo)&lt;br /&gt;
    EndIf&lt;br /&gt;
    If _WinAPI_PathIsDirectory($sFrom) = 0 Then&lt;br /&gt;
        $sFrom = _WinAPI_PathRemoveFileSpec($sFrom)&lt;br /&gt;
    EndIf&lt;br /&gt;
    $sRelativePath = _WinAPI_PathRelativePathTo(_WinAPI_PathAddBackslash($sFrom), 1, $sTo, $iIsFolder) ; Retrieve the relative path.&lt;br /&gt;
    If @error Then&lt;br /&gt;
        Return SetError(1, 0, $sTo)&lt;br /&gt;
    EndIf&lt;br /&gt;
    If $sRelativePath = &amp;quot;.&amp;quot; Then&lt;br /&gt;
        $sRelativePath &amp;amp;= &amp;quot;\&amp;quot; ; This is used when the source and destination are the same directory.&lt;br /&gt;
    EndIf&lt;br /&gt;
    Return $sRelativePath&lt;br /&gt;
EndFunc   ;==&amp;gt;_GetRelativePath&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _IsActive ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
 | AuthorURL = 35302-guinness&lt;br /&gt;
 | AuthorName = guinness&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
Example()&lt;br /&gt;
&lt;br /&gt;
Func Example()&lt;br /&gt;
    ; Run Notepad&lt;br /&gt;
    Run(&amp;quot;notepad.exe&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    ; Wait 10 seconds for the Notepad window to appear.&lt;br /&gt;
    Local $hWnd = WinWait(&amp;quot;[CLASS:Notepad]&amp;quot;, &amp;quot;&amp;quot;, 10)&lt;br /&gt;
&lt;br /&gt;
    ; Check if the Notepad window is active and display the appropriate message box.&lt;br /&gt;
    If _IsActive($hWnd) Then&lt;br /&gt;
        MsgBox(4096, &amp;quot;&amp;quot;, &amp;quot;Notepad is active.&amp;quot;)&lt;br /&gt;
    Else&lt;br /&gt;
        MsgBox(4096, &amp;quot;&amp;quot;, &amp;quot;Notepad isn&#039;t active.&amp;quot;)&lt;br /&gt;
    EndIf&lt;br /&gt;
&lt;br /&gt;
    ; Close the Notepad window using the handle returned by WinWait.&lt;br /&gt;
    WinClose($hWnd)&lt;br /&gt;
EndFunc   ;==&amp;gt;Example&lt;br /&gt;
&lt;br /&gt;
; Check if the window is active.&lt;br /&gt;
Func _IsActive($hWnd)&lt;br /&gt;
    Return BitAND(WinGetState($hWnd), 8) = 8&lt;br /&gt;
EndFunc   ;==&amp;gt;_IsActive&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _IsEnvExists ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
 | AuthorURL = 35302-guinness&lt;br /&gt;
 | AuthorName = guinness&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
ConsoleWrite(_IsEnvExists(&amp;quot;SciTE_HOME&amp;quot;) &amp;amp; @CRLF)&lt;br /&gt;
ConsoleWrite(_IsEnvExists(&amp;quot;PATH&amp;quot;) &amp;amp; @CRLF)&lt;br /&gt;
&lt;br /&gt;
; Checks if an environment variable exists.&lt;br /&gt;
Func _IsEnvExists($sVariable)&lt;br /&gt;
    Return EnvGet($sVariable) &amp;lt;&amp;gt; &amp;quot;&amp;quot;&lt;br /&gt;
EndFunc   ;==&amp;gt;_IsEnvExists&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _IsClassicTheme ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
 | AuthorURL = 35302-guinness&lt;br /&gt;
 | AuthorName = guinness&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;WinAPIEx.au3&amp;gt; ; Download From http://www.autoitscript.com/forum/topic/98712-winapiex-udf/ by Yashied.&lt;br /&gt;
&lt;br /&gt;
ConsoleWrite(_IsClassicTheme() &amp;amp; @LF)&lt;br /&gt;
&lt;br /&gt;
Func _IsClassicTheme() ; By guinness 2011. Returns True or False.&lt;br /&gt;
   _WinAPI_GetCurrentThemeName()&lt;br /&gt;
   Return @error &amp;gt; 0&lt;br /&gt;
EndFunc   ;==&amp;gt;_IsClassicTheme&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _IsExtensionSupported ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
 | AuthorURL = 35302-guinness&lt;br /&gt;
 | AuthorName = guinness&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;APIConstants.au3&amp;gt; ; Download from http://www.autoitscript.com/forum/topic/98712-winapiex-udf/ by Yashied.&lt;br /&gt;
#include &amp;lt;WinAPIEx.au3&amp;gt; ; Download from http://www.autoitscript.com/forum/topic/98712-winapiex-udf/ by Yashied.&lt;br /&gt;
&lt;br /&gt;
ConsoleWrite(_IsExtensionSupported(&#039;.html&#039;) &amp;amp; @CRLF) ; With the dot.&lt;br /&gt;
ConsoleWrite(_IsExtensionSupported(&#039;html&#039;) &amp;amp; @CRLF) ; Without the dot.&lt;br /&gt;
ConsoleWrite(_IsExtensionSupported(&#039;.AuProj&#039;) &amp;amp; @CRLF) ; With the dot.&lt;br /&gt;
&lt;br /&gt;
; Check if a file extension is supported on the system.&lt;br /&gt;
Func _IsExtensionSupported($sExtension)&lt;br /&gt;
    Return FileExists(_WinAPI_AssocQueryString(&#039;.&#039; &amp;amp; StringRegExpReplace($sExtension, &#039;\A\.+&#039;, &#039;&#039;), $ASSOCSTR_EXECUTABLE)) = 1&lt;br /&gt;
EndFunc   ;==&amp;gt;_IsExtensionSupported&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _IsFocused ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
 | AuthorURL = 66273-delstone&lt;br /&gt;
 | AuthorName = DelStone&lt;br /&gt;
 | ModifierURL = 35302-guinness&lt;br /&gt;
 | ModifierName = guinness&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
; Check to see if a window / control has focus or not.&lt;br /&gt;
&lt;br /&gt;
Example()&lt;br /&gt;
&lt;br /&gt;
Func Example()&lt;br /&gt;
    ; Run Notepad&lt;br /&gt;
    Run(&amp;quot;notepad.exe&amp;quot;)&lt;br /&gt;
    ; Wait 10 seconds for the Notepad window to appear.&lt;br /&gt;
    Local $hWnd = WinWait(&amp;quot;[CLASS:Notepad]&amp;quot;, &amp;quot;&amp;quot;, 10)&lt;br /&gt;
    Local $iEdit = ControlGetHandle($hWnd, &amp;quot;&amp;quot;, &amp;quot;[CLASS:Edit; INSTANCE:1]&amp;quot;)&lt;br /&gt;
    ; Check if the Notepad window&#039;s edit control has focus and display the appropriate message box.&lt;br /&gt;
    If _IsFocused($hWnd, $iEdit) Then&lt;br /&gt;
        MsgBox(4096, &amp;quot;&amp;quot;, &amp;quot;The edit control has keyboard focus. Select the Notepad title to see the caret.&amp;quot;)&lt;br /&gt;
    Else&lt;br /&gt;
        MsgBox(4096, &amp;quot;&amp;quot;, &amp;quot;The edit control doesn&#039;t have keyboard focus.&amp;quot;)&lt;br /&gt;
    EndIf&lt;br /&gt;
    ; Close the Notepad window using the handle returned by WinWait.&lt;br /&gt;
    WinClose($hWnd)&lt;br /&gt;
EndFunc   ;==&amp;gt;Example&lt;br /&gt;
&lt;br /&gt;
; Check if a control is focused.&lt;br /&gt;
Func _IsFocused($hWnd, $iControlID)&lt;br /&gt;
    Return ControlGetHandle($hWnd, &amp;quot;&amp;quot;, $iControlID) = ControlGetHandle($hWnd, &amp;quot;&amp;quot;, ControlGetFocus($hWnd))&lt;br /&gt;
EndFunc   ;==&amp;gt;_IsFocused&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _IsFullPath ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
 | AuthorURL = 35302-guinness&lt;br /&gt;
 | AuthorName = guinness&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
ConsoleWrite(_IsFullPath(@ScriptFullPath) &amp;amp; @CRLF)&lt;br /&gt;
ConsoleWrite(_IsFullPath(@ScriptName) &amp;amp; @CRLF)&lt;br /&gt;
&lt;br /&gt;
Func _IsFullPath($sFilePath)&lt;br /&gt;
    Return StringInStr($sFilePath, &amp;quot;:\&amp;quot;, 2) &amp;gt; 0&lt;br /&gt;
EndFunc   ;==&amp;gt;_IsFullPath&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _IsOnTop ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
 | AuthorURL = 35302-guinness&lt;br /&gt;
 | AuthorName = guinness&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
; Check to see if a window is on top.&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;Constants.au3&amp;gt;&lt;br /&gt;
#include &amp;lt;WindowsConstants.au3&amp;gt;&lt;br /&gt;
#include &amp;lt;WinAPI.au3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example()&lt;br /&gt;
&lt;br /&gt;
Func Example()&lt;br /&gt;
    Local $hGUI = GUICreate(&#039;&#039;)&lt;br /&gt;
    GUISetState(@SW_SHOW, $hGUI)&lt;br /&gt;
    ; Set the GUI as being on top using the handle returned by GUICreate.&lt;br /&gt;
    WinSetOnTop($hGUI, &#039;&#039;, 1)&lt;br /&gt;
    MsgBox(4096, &#039;&#039;, &#039;Is the GUI on top: &#039; &amp;amp; _IsOnTop($hGUI) &amp;amp; &#039;, this should be True&#039;)&lt;br /&gt;
    GUIDelete($hGUI)&lt;br /&gt;
EndFunc   ;==&amp;gt;Example&lt;br /&gt;
&lt;br /&gt;
; Check if a window is on top.&lt;br /&gt;
Func _IsOnTop($sTitle, $sText = &#039;&#039;)&lt;br /&gt;
    Return BitAND(_WinAPI_GetWindowLong(WinGetHandle($sTitle, $sText), $GWL_EXSTYLE), $WS_EX_TOPMOST) = $WS_EX_TOPMOST&lt;br /&gt;
EndFunc   ;==&amp;gt;_IsOnTop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _IsReadOnly ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
 | AuthorURL = 35302-guinness&lt;br /&gt;
 | AuthorName = guinness&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
ConsoleWrite(_IsReadOnly(@ScriptFullPath) &amp;amp; @CRLF)&lt;br /&gt;
&lt;br /&gt;
Func _IsReadOnly($sFilePath)&lt;br /&gt;
    Return StringInStr(FileGetAttrib($sFilePath), &amp;quot;R&amp;quot;) &amp;gt; 0&lt;br /&gt;
EndFunc   ;==&amp;gt;_IsReadOnly&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _IsMaximized ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
 | AuthorURL = 35302-guinness&lt;br /&gt;
 | AuthorName = guinness&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
; Check if the window is maximised.&lt;br /&gt;
&lt;br /&gt;
Example()&lt;br /&gt;
&lt;br /&gt;
Func Example()&lt;br /&gt;
    ; Run Notepad&lt;br /&gt;
    Run(&amp;quot;notepad.exe&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    ; Wait 10 seconds for the Notepad window to appear.&lt;br /&gt;
    Local $hWnd = WinWait(&amp;quot;[CLASS:Notepad]&amp;quot;, &amp;quot;&amp;quot;, 10)&lt;br /&gt;
&lt;br /&gt;
    ; Set the state of the Notepad window to &amp;quot;maximized&amp;quot;.&lt;br /&gt;
    WinSetState($hWnd, &#039;&#039;, @SW_MAXIMIZE)&lt;br /&gt;
&lt;br /&gt;
    ; Check if the Notepad window is maximized and display the appropriate message box.&lt;br /&gt;
    If _IsMaximized($hWnd) Then&lt;br /&gt;
        MsgBox(4096, &amp;quot;&amp;quot;, &amp;quot;Notepad is maximized.&amp;quot;)&lt;br /&gt;
    Else&lt;br /&gt;
        MsgBox(4096, &amp;quot;&amp;quot;, &amp;quot;Notepad isn&#039;t maximized.&amp;quot;)&lt;br /&gt;
    EndIf&lt;br /&gt;
&lt;br /&gt;
    ; Close the Notepad window using the handle returned by WinWait.&lt;br /&gt;
    WinClose($hWnd)&lt;br /&gt;
EndFunc   ;==&amp;gt;Example&lt;br /&gt;
&lt;br /&gt;
Func _IsMaximized($hWnd)&lt;br /&gt;
    Return BitAND(WinGetState($hWnd), 32) = 32&lt;br /&gt;
EndFunc   ;==&amp;gt;_IsMaximized&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _IsMinimized ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
 | AuthorURL = 35302-guinness&lt;br /&gt;
 | AuthorName = guinness&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
; Check if the window is minimized.&lt;br /&gt;
&lt;br /&gt;
Example()&lt;br /&gt;
&lt;br /&gt;
Func Example()&lt;br /&gt;
    ; Run Notepad&lt;br /&gt;
    Run(&amp;quot;notepad.exe&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    ; Wait 10 seconds for the Notepad window to appear.&lt;br /&gt;
    Local $hWnd = WinWait(&amp;quot;[CLASS:Notepad]&amp;quot;, &amp;quot;&amp;quot;, 10)&lt;br /&gt;
&lt;br /&gt;
    ; Set the state of the Notepad window to &amp;quot;minimized&amp;quot;.&lt;br /&gt;
    WinSetState($hWnd, &#039;&#039;, @SW_MINIMIZE)&lt;br /&gt;
&lt;br /&gt;
    ; Check if the Notepad window is minimized and display the appropriate message box.&lt;br /&gt;
    If _IsMinimized($hWnd) Then&lt;br /&gt;
        MsgBox(4096, &amp;quot;&amp;quot;, &amp;quot;Notepad is minimized.&amp;quot;)&lt;br /&gt;
    Else&lt;br /&gt;
        MsgBox(4096, &amp;quot;&amp;quot;, &amp;quot;Notepad isn&#039;t minimized.&amp;quot;)&lt;br /&gt;
    EndIf&lt;br /&gt;
&lt;br /&gt;
    ; Close the Notepad window using the handle returned by WinWait.&lt;br /&gt;
    WinClose($hWnd)&lt;br /&gt;
EndFunc   ;==&amp;gt;Example&lt;br /&gt;
&lt;br /&gt;
Func _IsMinimized($hWnd)&lt;br /&gt;
    Return BitAND(WinGetState($hWnd), 16) = 16&lt;br /&gt;
EndFunc   ;==&amp;gt;_IsMinimized&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _IsProcess64Bit ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
 | AuthorURL = 35302-guinness&lt;br /&gt;
 | AuthorName = guinness&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;WinAPIEx.au3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Local $aArray = ProcessList()&lt;br /&gt;
For $i = 1 To $aArray[0][0]&lt;br /&gt;
    ConsoleWrite(&#039;[&#039; &amp;amp; $i &amp;amp; &#039;] &#039; &amp;amp; $aArray[$i][0] &amp;amp; &#039; =&amp;gt; &#039; &amp;amp; _Ternary(_IsProcess64Bit($aArray[$i][1]), &#039;Is a 64-bit application.&#039;, &#039;Is a 32-bit application.&#039;) &amp;amp; @CRLF)&lt;br /&gt;
Next&lt;br /&gt;
&lt;br /&gt;
; Version: 1.00. AutoIt: V3.3.8.1&lt;br /&gt;
; Check if a process is a 64-bit executable. Returns 1 is natively 64-bit or 0 if 32-bit.&lt;br /&gt;
Func _IsProcess64Bit($iPID = 0)&lt;br /&gt;
    If $iPID &amp;lt; 1 Then&lt;br /&gt;
        $iPID = ProcessExists($iPID)&lt;br /&gt;
    EndIf&lt;br /&gt;
    Return Number(_WinAPI_IsWow64Process($iPID) = 0)&lt;br /&gt;
EndFunc   ;==&amp;gt;_IsProcess64Bit&lt;br /&gt;
&lt;br /&gt;
Func _Ternary($iValue, $vTrue, $vFalse) ; Like _Iif.&lt;br /&gt;
    Local $aArray[2] = [$vFalse, $vTrue]&lt;br /&gt;
    Return $aArray[Number(Number($iValue) &amp;gt; 0)]&lt;br /&gt;
EndFunc   ;==&amp;gt;_Ternary&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _IsServiceRunning ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
 | AuthorURL = 35302-guinness&lt;br /&gt;
 | AuthorName = guinness&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
ConsoleWrite(_IsServiceRunning(&#039;wuauserv&#039;) &amp;amp; @CRLF)&lt;br /&gt;
ConsoleWrite(_IsServiceRunning(&#039;Themes&#039;) &amp;amp; @CRLF)&lt;br /&gt;
ConsoleWrite(_IsServiceRunning(&#039;winmgmt&#039;) &amp;amp; @CRLF)&lt;br /&gt;
ConsoleWrite(_IsServiceRunning(&#039;AutoItService&#039;) &amp;amp; @CRLF)&lt;br /&gt;
&lt;br /&gt;
; Check if a service is running.&lt;br /&gt;
Func _IsServiceRunning($sService)&lt;br /&gt;
    Local $oShell = ObjCreate(&#039;shell.application&#039;)&lt;br /&gt;
    If @error Then&lt;br /&gt;
        Return SetError(1, 0, False)&lt;br /&gt;
    EndIf&lt;br /&gt;
    Return $oShell.IsServiceRunning($sService)&lt;br /&gt;
EndFunc   ;==&amp;gt;_IsServiceRunning&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _IsTaskbarHidden ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
 | AuthorURL = 35302-guinness&lt;br /&gt;
 | AuthorName = guinness&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
ConsoleWrite(_IsTaskbarHidden() &amp;amp; @CRLF)&lt;br /&gt;
&lt;br /&gt;
; Detect whether the taskbar is hidden or not.&lt;br /&gt;
Func _IsTaskbarHidden()&lt;br /&gt;
    Local Const $ABS_AUTOHIDE = 0x01, $ABM_GETSTATE = 0x00000004&lt;br /&gt;
    Local $aReturn = DllCall(&#039;shell32.dll&#039;, &#039;uint&#039;, &#039;SHAppBarMessage&#039;, &#039;dword&#039;, $ABM_GETSTATE, &#039;ptr*&#039;, 0)&lt;br /&gt;
    If @error Then&lt;br /&gt;
        Return SetError(1, 0, 0)&lt;br /&gt;
    EndIf&lt;br /&gt;
    Return BitAND($aReturn[0], $ABS_AUTOHIDE) = $ABS_AUTOHIDE&lt;br /&gt;
EndFunc   ;==&amp;gt;_IsTaskbarHidden&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _PathSplitEx ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
 | AuthorURL = 35302-guinness&lt;br /&gt;
 | AuthorName = guinness&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
; A different approach to _PathSplit(), in which it returns a 1D array, it also uses faster comparison for StringInStr.&lt;br /&gt;
; Note: This is for fullpaths only e.g. C:\Test\Text.exe&lt;br /&gt;
&lt;br /&gt;
Local $aPathSplit = _PathSplitEx(@ScriptFullPath)&lt;br /&gt;
_ArrayDisplay($aPathSplit)&lt;br /&gt;
&lt;br /&gt;
Func _PathSplitEx($sFilePath)&lt;br /&gt;
    Local $aReturn[5] = [$sFilePath], $iPosition = StringInStr($sFilePath, &amp;quot;\&amp;quot;, 2, -1)&lt;br /&gt;
    $aReturn[1] = StringLeft($sFilePath, 2)&lt;br /&gt;
    $aReturn[2] = StringTrimLeft($sFilePath, 2)&lt;br /&gt;
    $aReturn[3] = StringTrimLeft($sFilePath, StringInStr($sFilePath, &amp;quot;.&amp;quot;, 2, -1) - 1)&lt;br /&gt;
    $aReturn[4] = StringTrimRight(StringTrimLeft($sFilePath, $iPosition), StringLen($aReturn[4]))&lt;br /&gt;
    Return $aReturn&lt;br /&gt;
EndFunc   ;==&amp;gt;_PathSplitEx&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _PidGetPath ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
 | AuthorURL = 4813-smoke-n&lt;br /&gt;
 | AuthorName = SmOke_N&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
$PID = Run(&amp;quot;notepad.exe&amp;quot;)&lt;br /&gt;
WinWaitActive(&amp;quot;&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
MsgBox(0x0,&amp;quot;PID/Path&amp;quot;, _PidGetPath($PID))&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Func _PidGetPath($pid = &amp;quot;&amp;quot;, $strComputer = &#039;localhost&#039;)&lt;br /&gt;
    If $pid = &amp;quot;&amp;quot; Then $pid = WinGetProcess(WinGetTitle(&amp;quot;&amp;quot;))&lt;br /&gt;
    $wbemFlagReturnImmediately = 0x10&lt;br /&gt;
    $wbemFlagForwardOnly = 0x20&lt;br /&gt;
    $colItems = &amp;quot;&amp;quot;&lt;br /&gt;
    $objWMIService = ObjGet(&amp;quot;winmgmts:\\&amp;quot; &amp;amp; $strComputer &amp;amp; &amp;quot;\root\CIMV2&amp;quot;)&lt;br /&gt;
    $colItems = $objWMIService.ExecQuery (&amp;quot;SELECT * FROM Win32_Process WHERE ProcessId = &amp;quot; &amp;amp; $pid, &amp;quot;WQL&amp;quot;, $wbemFlagReturnImmediately + $wbemFlagForwardOnly)&lt;br /&gt;
    If IsObj($colItems) Then&lt;br /&gt;
        For $objItem In $colItems&lt;br /&gt;
            If $objItem.ExecutablePath Then Return $objItem.ExecutablePath&lt;br /&gt;
        Next&lt;br /&gt;
    EndIf&lt;br /&gt;
EndFunc   ;==&amp;gt;_PidGetPath&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== QuickInfo ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
 | AuthorURL = 71671-dasttann777&lt;br /&gt;
 | AuthorName = Dasttann777&lt;br /&gt;
 | ModifiedURL = 60350-chimaera&lt;br /&gt;
 | ModifiedName = Chimaera&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
#region ;**** Directives created by AutoIt3Wrapper_GUI ****&lt;br /&gt;
#AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker&lt;br /&gt;
#endregion ;**** Directives created by AutoIt3Wrapper_GUI ****&lt;br /&gt;
&lt;br /&gt;
MsgBox(0, &amp;quot;Welcome&amp;quot;, &amp;quot;Scanning System&amp;quot;, 2)&lt;br /&gt;
MsgBox(0, &amp;quot;Quick Info&amp;quot;, &amp;quot;Computer Name = &amp;quot; &amp;amp; @ComputerName &amp;amp; @CRLF &amp;amp; _&lt;br /&gt;
		&amp;quot;Desktop Common Dir = &amp;quot; &amp;amp; @DesktopCommonDir &amp;amp; @CRLF &amp;amp; _&lt;br /&gt;
		&amp;quot;Desktop Width = &amp;quot; &amp;amp;  @DesktopWidth &amp;amp; @CRLF &amp;amp; _&lt;br /&gt;
		&amp;quot;Desktop Height = &amp;quot; &amp;amp; @DesktopHeight &amp;amp; @CRLF &amp;amp; _&lt;br /&gt;
		&amp;quot;Ip Address = &amp;quot; &amp;amp;  @IPAddress1 &amp;amp; @CRLF &amp;amp; _&lt;br /&gt;
		&amp;quot;OS Version = &amp;quot; &amp;amp;  @OSVersion)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _StripEnvVariable ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
 | AuthorURL = 35302-guinness&lt;br /&gt;
 | AuthorName = guinness&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
ConsoleWrite(EnvGet(_StripEnvVariable(&amp;quot;%PATH%&amp;quot;)) &amp;amp; @CRLF)&lt;br /&gt;
ConsoleWrite(EnvGet(_StripEnvVariable(&amp;quot;PATH%&amp;quot;)) &amp;amp; @CRLF)&lt;br /&gt;
ConsoleWrite(_StripEnvVariable(&amp;quot;PATH&amp;quot;) &amp;amp; @CRLF)&lt;br /&gt;
ConsoleWrite(_StripEnvVariable(&amp;quot;%PATH&amp;quot;) &amp;amp; @CRLF)&lt;br /&gt;
&lt;br /&gt;
; Strip the percentage signs from an environment variable.&lt;br /&gt;
Func _StripEnvVariable($sVariable)&lt;br /&gt;
	Return StringRegExpReplace($sVariable, &#039;%?(\V*)%+&#039;, &#039;\1&#039;) ; &#039;%*(.*?)%*&#039;&lt;br /&gt;
EndFunc   ;==&amp;gt;_StripEnvVariable&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== USB connections - All USB Devices ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
 | AuthorURL = 4920-valuater&lt;br /&gt;
 | AuthorName = Valuater&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
$strComputer = &amp;quot;.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
$objWMIService = ObjGet(&amp;quot;winmgmts:\\&amp;quot; &amp;amp; $strComputer &amp;amp; &amp;quot;\root\cimv2&amp;quot;)&lt;br /&gt;
$colDevices = $objWMIService.ExecQuery (&amp;quot;Select * From Win32_USBControllerDevice&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
For $objDevice in $colDevices&lt;br /&gt;
    $strDeviceName = $objDevice.Dependent&lt;br /&gt;
    ;ConsoleWrite(&amp;quot;!&amp;gt;&amp;quot; &amp;amp; $strDeviceName &amp;amp; @CRLF)&lt;br /&gt;
    $strQuotes = Chr(34)&lt;br /&gt;
    $strDeviceName = StringReplace($strDeviceName, $strQuotes, &amp;quot;&amp;quot;)&lt;br /&gt;
    $arrDeviceNames = StringSplit($strDeviceName, &amp;quot;=&amp;quot;)&lt;br /&gt;
    $strDeviceName = $arrDeviceNames[2]&lt;br /&gt;
    $colUSBDevices = $objWMIService.ExecQuery (&amp;quot;Select * From Win32_PnPEntity Where DeviceID = &#039;&amp;quot; &amp;amp; $strDeviceName &amp;amp; &amp;quot;&#039;&amp;quot;)&lt;br /&gt;
    For $objUSBDevice in $colUSBDevices&lt;br /&gt;
        ConsoleWrite(&amp;quot;--&amp;gt;&amp;quot; &amp;amp; $objUSBDevice.Description &amp;amp; @CRLF)&lt;br /&gt;
    Next&lt;br /&gt;
Next&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _WinAPI_IsEnvExists ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
 | AuthorURL = 35302-guinness&lt;br /&gt;
 | AuthorName = guinness&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;WinAPI.au3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ConsoleWrite(_WinAPI_IsEnvExists(&amp;quot;%SciTE_HOME%&amp;quot;) &amp;amp; @CRLF)&lt;br /&gt;
ConsoleWrite(_WinAPI_IsEnvExists(&amp;quot;%PATH%&amp;quot;) &amp;amp; @CRLF)&lt;br /&gt;
&lt;br /&gt;
; Checks if an environment variable exists. Uses the API ExpandEnvironmentStrings, so therefore you must use an environment variable with&lt;br /&gt;
; percentage signs included.&lt;br /&gt;
Func _WinAPI_IsEnvExists($sVariable)&lt;br /&gt;
    Return _WinAPI_ExpandEnvironmentStrings($sVariable) &amp;lt;&amp;gt; $sVariable&lt;br /&gt;
EndFunc   ;==&amp;gt;_IsEnvExists&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
ConsoleWrite(_WinAPI_IsEnvExists(&amp;quot;%SciTE_HOME%&amp;quot;) &amp;amp; @CRLF)&lt;br /&gt;
ConsoleWrite(_WinAPI_IsEnvExists(&amp;quot;%PATH%&amp;quot;) &amp;amp; @CRLF)&lt;br /&gt;
&lt;br /&gt;
; Checks if an environment variable exists. Uses the API ExpandEnvironmentStrings, so therefore you must use an environment variable with&lt;br /&gt;
; percentage signs included.&lt;br /&gt;
Func _WinAPI_IsEnvExists($sVariable)&lt;br /&gt;
    Local $aResult = DllCall(&#039;kernel32.dll&#039;, &#039;dword&#039;, &#039;ExpandEnvironmentStringsW&#039;, &#039;wstr&#039;, $sVariable, &#039;wstr&#039;, &#039;&#039;, &#039;dword&#039;, 4096)&lt;br /&gt;
    If @error Then&lt;br /&gt;
        Return SetError(@error, @extended, 0)&lt;br /&gt;
    EndIf&lt;br /&gt;
    Return $aResult[2] &amp;lt;&amp;gt; $sVariable&lt;br /&gt;
EndFunc   ;==&amp;gt;_WinAPI_IsEnvExists&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _WinGetPath ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
 | AuthorURL = 1967-garyfrost&lt;br /&gt;
 | AuthorName = GaryFrost&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
; Get the execuatble path of a window&lt;br /&gt;
&lt;br /&gt;
$path = _WinGetPath()&lt;br /&gt;
MsgBox(0,WinGetTitle(&amp;quot;&amp;quot;),$path)&lt;br /&gt;
&lt;br /&gt;
Func _WinGetPath($Title=&amp;quot;&amp;quot;, $strComputer=&#039;localhost&#039;)&lt;br /&gt;
    $win = WinGetTitle($Title)&lt;br /&gt;
    $pid = WinGetProcess($win)&lt;br /&gt;
   $wbemFlagReturnImmediately = 0x10&lt;br /&gt;
   $wbemFlagForwardOnly = 0x20&lt;br /&gt;
   $colItems = &amp;quot;&amp;quot;&lt;br /&gt;
   $objWMIService = ObjGet(&amp;quot;winmgmts:\\&amp;quot; &amp;amp; $strComputer &amp;amp; &amp;quot;\root\CIMV2&amp;quot;)&lt;br /&gt;
   $colItems = $objWMIService.ExecQuery (&amp;quot;SELECT * FROM Win32_Process WHERE ProcessId = &amp;quot; &amp;amp; $pid, &amp;quot;WQL&amp;quot;, _&lt;br /&gt;
         $wbemFlagReturnImmediately + $wbemFlagForwardOnly)&lt;br /&gt;
   If IsObj($colItems) Then&lt;br /&gt;
      For $objItem In $colItems&lt;br /&gt;
         If $objItem.ExecutablePath Then Return $objItem.ExecutablePath&lt;br /&gt;
      Next&lt;br /&gt;
   EndIf&lt;br /&gt;
EndFunc ;==&amp;gt;_WinGetPath()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;br /&gt;
&lt;br /&gt;
== _IsUACEnabled ==&lt;br /&gt;
&lt;br /&gt;
{{Snippet Header&lt;br /&gt;
 | AuthorURL = 35302-guinness&lt;br /&gt;
 | AuthorName = guinness&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
ConsoleWrite( _IsUACEnabled() &amp;amp; @CRLF) ; Returns 0/1 if disabled/enabled and sets @error to non-zero if the OS doesn&#039;t support UAC i.e. XP and below.&lt;br /&gt;
&lt;br /&gt;
Func _IsUACEnabled()&lt;br /&gt;
    If RegRead(&amp;quot;HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\&amp;quot;, &amp;quot;CurrentVersion&amp;quot;) &amp;gt;= 6.0 Then&lt;br /&gt;
        Return Number(RegRead(&amp;quot;HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System&amp;quot;, &amp;quot;ConsentPromptBehaviorAdmin&amp;quot;) = 1)&lt;br /&gt;
    EndIf&lt;br /&gt;
    Return SetError(1, 0, 0)&lt;br /&gt;
EndFunc   ;==&amp;gt;_IsUACEnabled&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[#top | ReturnToContents]]&lt;/div&gt;</summary>
		<author><name>232showtime</name></author>
	</entry>
</feed>