Valnurat Posted September 15, 2016 Posted September 15, 2016 How do you read AD attribute: thumbnailPhoto and show the picture? It is a syntax of octet string. I have no code for this. Yours sincerely Kenneth.
water Posted September 15, 2016 Posted September 15, 2016 Maybe this and the following posts help: My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Valnurat Posted September 15, 2016 Author Posted September 15, 2016 I read it and I could see some code to retrive data, but how do I show the picture? #include <AD.au3> #include <File.au3> _AD_Open() If @error Then Exit $ThumbNailPhoto = _AD_GetObjectAttribute(@UserName, "thumbnailPhoto") If @error Then $ThumbNailPhoto = "" _AD_Close() Yours sincerely Kenneth.
water Posted September 15, 2016 Posted September 15, 2016 No idea But there are a lot of C# or PowerShell examples available on the web. Maybe one of them fits your needs. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
spudw2k Posted September 16, 2016 Posted September 16, 2016 From what I was reading, the file format is jpg, so I would think it would be possible to either write to a file and/or use GDI+ to display it...but I also don't have the know-how to create a script (to do the GDI+ part at least.) Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF
Subz Posted December 18, 2016 Posted December 18, 2016 (edited) Probably not required but thought I'd share my solution. #include <AD.au3> Opt('ExpandVarStrings', 1) _ADO_USERIMAGE() Func _ADO_USERIMAGE() Local $oADO_USERIMAGE, $hOPN_THUMBNAIL Local $sPIC_USERIMAGE = '@AppDataDir@\Microsoft\Windows\AccountPictures\UserTile.jpg' _AD_Open() $oADO_USERIMAGE = _AD_GetObjectAttribute(@UserName, 'thumbnailPhoto') If @error Then Exit $hOPN_THUMBNAIL = FileOpen($sPIC_USERIMAGE, 26) FileWrite($hOPN_THUMBNAIL, $oADO_USERIMAGE) FileClose($hOPN_THUMBNAIL) _AD_Close() EndFunc Edited January 18, 2017 by Subz Updated Code
water Posted December 18, 2016 Posted December 18, 2016 Great solution My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Valnurat Posted January 18, 2017 Author Posted January 18, 2017 Sorry for my very late reply, but how do I use that function? Yours sincerely Kenneth.
water Posted January 18, 2017 Posted January 18, 2017 Subz's function grabs the thumbnailPhoto property and writes it to "@AppDataDir@\Microsoft\Windows\AccountPictures\UserTile.jpg". No parameters needed. Just call the function. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Valnurat Posted January 18, 2017 Author Posted January 18, 2017 No "usertitle.jpg" file is created in "@AppDataDir@\Microsoft\Windows\AccountPictures" Is this correct: "@AppDataDir@" ? Yours sincerely Kenneth.
Valnurat Posted January 18, 2017 Author Posted January 18, 2017 aha. Local $sPIC_USERIMAGE = @AppDataDir & '\Microsoft\Windows\AccountPictures\UserTile.jpg' Yours sincerely Kenneth.
Subz Posted January 18, 2017 Posted January 18, 2017 Sorry forgot to put in Opt('ExpandVarStrings', 1) which allows you to use @AppDataDir in a string like "@AppDataDir@\Microsoft\Windows\AccountPictures\UserTile.jpg".
Valnurat Posted January 18, 2017 Author Posted January 18, 2017 Check. It works now. Is only possible to save this to a file? It can't be save in memory to show in GUICtrlCreatePic? Thank you. Yours sincerely Kenneth.
Subz Posted January 18, 2017 Posted January 18, 2017 You probably could using GDI+ but haven't tried myself, you can use GuiCtrlCreatePic("@AppDataDir@\Microsoft\Windows\AccountPictures\UserTile.jpg", ....)
Valnurat Posted January 18, 2017 Author Posted January 18, 2017 Yes, but I would like, if possible, to "save" the picture in the RAM and then use the RAM as the source. Is that possible? Yours sincerely Kenneth.
Subz Posted January 18, 2017 Posted January 18, 2017 Using the _GDIPlus_BitmapCreateFromMemory example works for me. #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <AD.au3> Example() Func Example() _GDIPlus_Startup() ;initialize GDI+ Local Const $iWidth = 300, $iHeight = 300, $iBgColor = 0xFFE8FF ;$iBgColor format RRGGBB Local $hGUI = GUICreate("GDI+ Example (" & @ScriptName & ")", $iWidth, $iHeight) ;create a test GUI GUISetBkColor($iBgColor, $hGUI) ;set GUI background color GUISetState(@SW_SHOW) Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI) ;create a graphics object from a window handle Local $hBitmap = _GDIPlus_BitmapCreateFromMemory(_ADO_USERIMAGE()) ;load binary saved GIF image and convert it to GDI+ bitmap format Local $iW = _GDIPlus_ImageGetWidth($hBitmap), $iH = _GDIPlus_ImageGetHeight($hBitmap) _GDIPlus_GraphicsDrawImage($hGraphics, $hBitmap, ($iWidth - $iW) / 2, ($iHeight - $iH) / 2) ;display image in GUI Do Until GUIGetMsg() = $GUI_EVENT_CLOSE ;cleanup GDI+ resources _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_Shutdown() GUIDelete($hGUI) EndFunc ;==>Example Func _ADO_USERIMAGE() _AD_Open() Local $oADO_USERIMAGE = _AD_GetObjectAttribute(@UserName, 'thumbnailPhoto') If @error Then Exit _AD_Close() Return $oADO_USERIMAGE EndFunc
Valnurat Posted January 18, 2017 Author Posted January 18, 2017 Good lord. Thank you. Yours sincerely Kenneth.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now