Leaderboard
Popular Content
Showing content with the highest reputation on 08/16/2015 in all areas
-
Get installed applications
coffeeturtle reacted to Danyfirex for a topic
A simple example of listing installed applications using ObjCreateInterface. Update. 10/09/2014 ;Danyfirex 06/09/2014 #include <Array.au3> Opt("MustDeclareVars", 1) Global Const $sTagAppInfoData = "UINT cbSize;UINT dwMask;ptr pszDisplayName;ptr pszVersion;ptr pszPublisher;ptr pszProductID;" & _ "ptr pszRegisteredOwner;ptr pszRegisteredCompany;ptr pszLanguage;ptr pszSupportUrl;ptr pszSupportTelephone;" & _ "ptr pszHelpLink;ptr pszInstallLocation;ptr pszInstallSource;ptr pszInstallDate;ptr pszContact;ptr pszComments;" & _ "ptr pszImage;ptr pszReadmeUrl;ptr pszUpdateInfoUrl" Global Const $sCLSID_EnumInstalledApps = "{0B124F8F-91F0-11D1-B8B5-006008059382}" Global Const $sIID_IEnumInstalledApps = "{1BC752E1-9046-11D1-B8B3-006008059382}" Global Const $sTagIEnumInstalledApps = "Next hresult(ptr*);Reset hresult();" Global Const $sIID_IShellApp = "{A3E14960-935F-11D1-B8B8-006008059382}" Global Const $sShellApp = "GetAppInfoData hresult(ptr);" Global Const $AIM_DISPLAYNAME = 0x00000001 Global Const $AIM_VERSION = 0x00000002 Global Const $AIM_PUBLISHER = 0x00000004 Global Const $AIM_PRODUCTID = 0x00000008 Global Const $AIM_REGISTEREDOWNER = 0x00000010 Global Const $AIM_REGISTEREDCOMPANY = 0x00000020 Global Const $AIM_LANGUAGE = 0x00000040 Global Const $AIM_SUPPORTURL = 0x00000080 Global Const $AIM_SUPPORTTELEPHONE = 0x00000100 Global Const $AIM_HELPLINK = 0x00000200 Global Const $AIM_INSTALLLOCATION = 0x00000400 Global Const $AIM_INSTALLSOURCE = 0x00000800 Global Const $AIM_INSTALLDATE = 0x00001000 Global Const $AIM_CONTACT = 0x00004000 Global Const $AIM_COMMENTS = 0x00008000 Global Const $AIM_IMAGE = 0x00020000 Global Const $AIM_READMEURL = 0x00040000 Global Const $AIM_UPDATEINFOURL = 0x00080000 Local $aArray = GetInstalledApps(BitOR($AIM_DISPLAYNAME, $AIM_INSTALLDATE)) _ArrayDisplay($aArray, "GetInstalledApps", Default, Default, Default, "NAME|INSTALLDATE") $aArray = GetInstalledApps(BitOR($AIM_DISPLAYNAME, $AIM_UPDATEINFOURL)) _ArrayDisplay($aArray, "GetInstalledApps", Default, Default, Default, "DISPLAYNAME|UPDATEINFOURL") $aArray = GetInstalledApps(BitOR($AIM_DISPLAYNAME, $AIM_INSTALLDATE, $AIM_INSTALLLOCATION)) _ArrayDisplay($aArray, "GetInstalledApps", Default, Default, Default, "DISPLAYNAME|INSTALLLOCATION|INSTALLDATE") Func GetInstalledApps($iMask = $AIM_DISPLAYNAME) Local $oEnumInstalledApps = ObjCreateInterface($sCLSID_EnumInstalledApps, $sIID_IEnumInstalledApps, $sTagIEnumInstalledApps) If @error Then Return 0 Local $pShellApp = 0 Local $oShellApp = 0 Local $AppInfoData = DllStructCreate($sTagAppInfoData) Local $pAppInfoData = DllStructGetPtr($AppInfoData) Local $i = 0 Local $aArray[0][0] Local $iF = 1 Local $tData = 0 Local $sData = "" Local $aMax = nCol($iMask) While $oEnumInstalledApps.Next($pShellApp) = 0 And $pShellApp <> 0 $oShellApp = ObjCreateInterface($pShellApp, $sIID_IShellApp, $sShellApp) If @error Then Return 0 DllStructSetData($AppInfoData, "cbSize", DllStructGetSize($AppInfoData)) DllStructSetData($AppInfoData, "dwMask", $iMask) $oShellApp.GetAppInfoData($pAppInfoData) ReDim $aArray[$iF][UBound($aMax)] For $i = 0 To UBound($aMax) - 1 $tData = DllStructCreate("wchar[260]", DllStructGetData($AppInfoData, $aMax[$i] + 2)) $sData = DllStructGetData($tData, 1) If $aMax[$i] = 13 Then $sData = StringMid($sData, 7, 2) & "/" & StringMid($sData, 5, 2) & "/" & StringMid($sData, 1, 4) $aArray[$iF - 1][$i] = ($sData = "0") ? "" : $sData DllStructSetData($tData, 1, "") Next $oShellApp = Null $iF += 1 WEnd $oEnumInstalledApps = Null Return $aArray EndFunc ;==>GetInstalledApps Func nCol($iMask) Local $aFlag[18] = [$AIM_DISPLAYNAME, $AIM_VERSION, $AIM_PUBLISHER, $AIM_PRODUCTID, $AIM_REGISTEREDOWNER, $AIM_REGISTEREDCOMPANY, _ $AIM_LANGUAGE, $AIM_SUPPORTURL, $AIM_SUPPORTTELEPHONE, $AIM_HELPLINK, $AIM_INSTALLLOCATION, $AIM_INSTALLSOURCE, _ $AIM_INSTALLDATE, $AIM_CONTACT, $AIM_COMMENTS, $AIM_IMAGE, $AIM_READMEURL, $AIM_UPDATEINFOURL] Local $iCol = 0 Local $x = 0 Local $aCol[18] For $i = 0 To UBound($aFlag) - 1 If BitAND($iMask, $aFlag[$i]) Then $aCol[$x] = $i + 1 $x += 1 EndIf Next ReDim $aCol[$x] Return $aCol EndFunc ;==>nCol Saludos1 point -
Hey, Minxomat. Sorry about the double post in the pm. I was looking thru the framework for a plug-in to Notepad++ and I do think I could make one that could scan the .p++ file and generate a .pas header file. I'll sit down over the next couple of days and see what I can come up with, using your .p++ files for a reference. As for the idea about the paths, I have a couple ideas I want to try. I wasn't trying to exclude anyone, I just wanted your opinion of a couple ideas before I mentioned them here, see if you would mind me trying to work them out. Your project has a lot of possible uses, even ones you might not have considered.1 point
-
1 point
-
Not saying you have any ill intentions, but just like to make sure other can't either like decoding Captcha's or something. Jos1 point
-
Not sure is serious. But yes, of course... ;If Not (IsBool($bOverWrite) Or $bOverWrite = 0 Or $bOverWrite = 1) Then Return SetError(5, 0, 0) ; For old versions.1 point
-
Here it is. Last try #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <File.au3> #include <Array.au3> #include <FileConstants.au3> $hGUI = GUICreate("Form1", 702, 533, 513, 305) GUISetBkColor(0xFFFFFF) GUICtrlCreateGroup(" Search ", 10, 107, 342, 385) GUICtrlCreateLabel("Search for text", 24, 131, 73, 17) $hSearchInput = GUICtrlCreateInput("", 25, 151, 185, 21) $hFinddAllButton = GUICtrlCreateButton("Find All", 224, 149, 75, 25) GUICtrlSetState($hFinddAllButton, $GUI_DISABLE) GUICtrlCreateLabel("Found Items ( click to edit )", 24, 193, 131, 17) $hList = GUICtrlCreateList("", 24, 211, 313, 266, BitOR($WS_BORDER, $WS_VSCROLL)) ; disable sort !! GUICtrlCreateGroup("", -99, -99, 1, 1) GUICtrlCreateGroup(" Edit Item ", 364, 108, 329, 137) GUICtrlCreateLabel("Name", 381, 132, 32, 17) $hNameInput = GUICtrlCreateInput("", 380, 152, 289, 21) $hSaveButton = GUICtrlCreateButton("Save", 596, 204, 75, 25) GUICtrlSetState($hSaveButton, $GUI_DISABLE) GUICtrlCreateLabel("Item ID", 381, 187, 38, 17) $hItemID = GUICtrlCreateInput("", 378, 204, 57, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_CENTER,$ES_READONLY)) GUICtrlCreateGroup("", -99, -99, 1, 1) $Pic1 = GUICtrlCreatePic("C:\Users\Mario\Desktop\Untitled-1.jpg", 0, 0, 702, 100) $hOpenIniButton = GUICtrlCreateButton("Open INI for Edit", 8, 500, 105, 25) $hWriteIniButton = GUICtrlCreateButton("Write Modified INI", 123, 500, 105, 25) GUISetState(@SW_SHOW) Global $file, $sFile, $matches[0][3], $afound[0][3], $index While 1 Switch GUIGetMsg() Case -3 Exit Case $hOpenIniButton _FileOpen() Case $hList $index = _GUICtrlListBox_GetCurSel($hList) If $index <> -1 Then GUICtrlSetData($hNameInput, $afound[$index][2]) Case $hFinddAllButton GUICtrlSetData($hList, '') Redim $afound[0][3] For $i = 0 To UBound($matches)-1 If StringInStr($matches[$i][2], GUICtrlRead($hSearchInput)) Then _ArrayAdd($afound, $matches[$i][0] &'|'& $matches[$i][1] &'|'& $matches[$i][2]) GUICtrlSetData($hList, '[' & $matches[$i][1] &'] '& $matches[$i][2]) EndIf Next _ArrayDisplay($afound, "found") ; debug Case $hSaveButton $newitem = GUICtrlRead($hNameInput) IniWrite($file, $afound[$index][1], "1", $newitem) ; update ini $afound[$index][2] = $newitem ; update $afound array $matches[$afound[$index][0]][2] = $newitem ; update main array ; update listbox _GUICtrlListBox_ReplaceString($hList, $index, "[" & $afound[$index][1] & "] " & $newitem) ;_ArrayDisplay($matches, "$matches after save") EndSwitch WEnd Func _FileOpen() ; open file Global $file = FileOpenDialog("Open INI for edit", "", "INI files (*.ini)") If @error Then Return $tmp = StringRegExp(FileRead($file), '(?s)\[(\d+)\].*?\v1=(\V+)', 3) ; _ArrayDisplay($tmp) Redim $matches[UBound($tmp)/2][3] For $i = 0 to UBound($tmp)-1 step 2 $matches[$i/2][0] = $i/2 $matches[$i/2][1] = $tmp[$i] $matches[$i/2][2] = $tmp[$i+1] Next GUICtrlSetState($hOpenIniButton, $GUI_DISABLE) GUICtrlSetState($hFinddAllButton, $GUI_ENABLE) GUICtrlSetState($hSaveButton, $GUI_ENABLE) _ArrayDisplay($matches, "$matches creation for key 1") EndFunc ;=> file open1 point
-
Apps allowed by default in windows 10 firewall
JohnOne reacted to AdmiralAlkex for a topic
You must mean AllJoyn, as in the AllJoyn Router Service (off by default if anyone is wondering). Plenty of results on Google. https://ms-iot.github.io/content/en-US/win10/AllJoyn.htm1 point -
How to add Path into a CMD command?
Shadow_Delta reacted to iamtheky for a topic
closer? $CMD = 'ccs.exe /line /pack /PackPath:' & $sPath RunWait(@ComSpec & ' /k ' & $CMD, @SystemDir, @SW_SHOW) or if you need to wrap that path in quotes due to spaces $CMD = 'ccs.exe /line /pack /PackPath:' & '"' & $sPath & '"' RunWait(@ComSpec & ' /k ' & $CMD, @SystemDir, @SW_SHOW)1 point -
Help getting drive letter from an Arc Path?
argumentum reacted to Danyfirex for a topic
A wrote a simple AutoIt example based on this. http://blogs.microsoft.co.il/pavely/2014/02/05/creating-a-winobj-like-tool/ #include <Array.au3> Opt("MustDeclareVars", 1) Global Const $DIRECTORY_QUERY = 0x0001 Global Const $DIRECTORY_TRAVERSE = 0x0002 Global Const $sTagUNICODESTRING = "USHORT Length;USHORT MaximumLength;PTR Buffer;" Global Const $sTagOBJECT_ATTRIBUTES="ULONG Length;HANDLE RootDirectory;PTR ObjectName;ULONG Attributes;PTR SecurityDescriptor;PTR SecurityQualityOfService" Local $tUnicodeString = DllStructCreate($sTagUNICODESTRING) Local $pUnicodeString = DllStructGetPtr($tUnicodeString) ConsoleWrite("!$pUnicodeString: " & $pUnicodeString & @CRLF) Local $tSourceString = DllStructCreate("wchar[256]") DllStructSetData($tSourceString, 1, "\ArcName") Local $aRet = DllCall("Ntdll.dll", "NONE", "RtlInitUnicodeString", "ptr", $pUnicodeString, "ptr", DllStructGetPtr($tSourceString)) ConsoleWrite("!$tUnicodeString.Length: " & $tUnicodeString.Length & @CRLF) Local $tObject_Attributes = DllStructCreate($sTagOBJECT_ATTRIBUTES) Local $pObject_Attributes = DllStructGetPtr($tObject_Attributes) ConsoleWrite("!$pObject_Attributes: " & $pObject_Attributes & @CRLF) DllStructSetData($tObject_Attributes, 1, DllStructGetSize($tObject_Attributes)) DllStructSetData($tObject_Attributes, 3, $pUnicodeString) $aRet = DllCall("Ntdll.dll", "LONG", "NtOpenDirectoryObject", "HANDLE*", 0, "ULONG", BitOR($DIRECTORY_TRAVERSE, $DIRECTORY_QUERY), "PTR", $pObject_Attributes) Local $hDirectory = $aRet[1] ConsoleWrite("!$hDirectory: " & $hDirectory & @CRLF) Local $tData = 0 Local $tName = 0 Local $tType = 0 Local $index = 0 Local $bytes = 0 Local $tBuffer = 0 Local $aArcName[0] $tBuffer = DllStructCreate("byte Data[32767]") $aRet = DllCall("Ntdll.dll", "LONG", "NtQueryDirectoryObject", "HANDLE", $hDirectory, "ptr", DllStructGetPtr($tBuffer), "ULONG", 32767, "BOOL", False, "BOOL", True, "ULONG*", 0, "ULONG*", 0) If @error or $aRet[0]<0 then Exit $index = $aRet[6] $bytes = $aRet[7] ConsoleWrite("!index: " & $index & " $bytes: " & $bytes & @CRLF) For $i = 0 To $index - 1 $tData = DllStructCreate($sTagUNICODESTRING & $sTagUNICODESTRING , DllStructGetPtr($tBuffer) + ($i * 16)) $tName = DllStructCreate("wchar wNameString[" & DllStructGetData($tData,1) & "]", DllStructGetData($tData,3)) $tType = DllStructCreate("wChar wTypeString[" & DllStructGetData($tData,4) & "]", DllStructGetData($tData,6)) ConsoleWrite(">" & $i + 1 & @TAB & $tName.wNameString & @TAB & $tType.wTypeString & @CRLF) ReDim $aArcName[UBound($aArcName)+1][2] $aArcName[UBound($aArcName)-1][0]=$tName.wNameString $aArcName[UBound($aArcName)-1][1]=$tType.wTypeString $tType = 0 $tName = 0 $tData = 0 Next _ArrayDisplay($aArcName) I did not implement SimbolicLink. I'm lazy. Saludos1 point -
day/month arrays from datetimeformatinfo
argumentum reacted to iamtheky for a topic
This might save you...literally seconds. Sorry if this is widely known, im new to this exploring. #include<array.au3> $oDTinfo = ObjCreate("system.globalization.datetimeformatinfo") $aShrtDayArray = $oDTinfo.AbbreviatedDayNames $aShrtMonthArray = $oDTinfo.AbbreviatedMonthNames $aFullDayArray = $oDTinfo.DayNames $aFullMonthArray = $oDTinfo.MonthNames _ArrayDisplay($aShrtDayArray , "short days") _ArrayDisplay($aShrtMonthArray , "short months") _ArrayDisplay($aFullDayArray , "long days") _ArrayDisplay($aFullMonthArray, "long months")1 point -
maybe you're looking for something like this. Saludos1 point