LxP Posted October 15, 2005 Posted October 15, 2005 Hi guys,A webpage gives some C# to toggle the desktop (equivalent to hitting Win+D):// Create an instance of the shell class Shell32.ShellClass objShel = new Shell32.ShellClass(); // Show the desktop ((Shell32.IShellDispatch4) objShel).ToggleDesktop(); // Do some operations here // Restore the desktop ((Shell32.IShellDispatch4) objShel).ToggleDesktop();I've spent an hour or so trying to convert this to its AutoIt equivalent. It obviously has something to do with ObjCreate() but everything I've tried so far has given me an @Error code of -2147221005 (odd)...Local $Obj = ObjCreate("IShellDispatch4") Local $Obj = ObjCreate("IShellDispatch4.This") Local $Obj = ObjCreate("Shell.IShellDispatch4") Local $Obj = ObjCreate("Shell32.IDispatch4") Local $Obj = ObjCreate("Shell32.IID_IShellDispatch4")Some other pieces of code floating around refer to this object by its CLSID but I'm not sure whether that can be done using AutoIt. I tried all sorts of things there too:Local $Obj = ObjCreate("13709620-C279-11CE-A49E-444553540000") Local $Obj = ObjCreate("{13709620-C279-11CE-A49E-444553540000}") Local $Obj = ObjCreate("CLSID::13709620-C279-11CE-A49E-444553540000") Local $Obj = ObjCreate("CLSID::{13709620-C279-11CE-A49E-444553540000}")How might the above C# code be written for AutoIt?
Valuater Posted October 15, 2005 Posted October 15, 2005 (edited) not sure about this stuff...but have you searched for the " C# TO AUTOIT" in Scripts and Scrapts there is one in there 8) Edited October 15, 2005 by Valuater
Valuater Posted October 15, 2005 Posted October 15, 2005 (edited) found ithttp://www.autoitscript.com/forum/index.ph...2143&hl=Autoit#ooooops thats VB to autoit???? Edited October 15, 2005 by Valuater
DaleHohm Posted October 15, 2005 Posted October 15, 2005 Try this: $oShell = ObjCreate("Shell.Application") $oShell.ToggleDesktop() Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble
LxP Posted October 15, 2005 Author Posted October 15, 2005 (edited) So simple -- I was way off. Thanks Dale!For next time, how did you come up with Shell.Application from IShellDispatch4? I couldn't see anything obvious on MSDN saying that IShellDispatch objects extend Shell objects...P.S. Thanks anyway Valuater! Edited October 15, 2005 by LxP
DaleHohm Posted October 15, 2005 Posted October 15, 2005 (edited) You want me to reveal my tricks huh? I was hoping you wouldn't ask I took a quick look in MSDN for an example of instantiating the IShellDispatch4 object... when I couldn't find one I thought, hmmm, I wonder if this will work... and it did...DaleSo simple -- I was way off. Thanks Dale!For next time, how did you come up with Shell.Application from IShellDispatch4? I couldn't see anything obvious on MSDN saying that IShellDispatch objects extend Shell objects...P.S. Thanks anyway Valuater! Edited October 15, 2005 by DaleHohm Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble
ptrex Posted October 19, 2005 Posted October 19, 2005 This is a little late but might come handy later on.Lookat this for more example using "Shell.Application" More examples and references to MSDNNice job !! Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New
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