DaleHohm Posted February 23, 2008 Share Posted February 23, 2008 (edited) In nearly every case I've encountered, setting a COM object to the null string ("") produces the same result as as setting the same to the constant "Nothing" in VB/VBScript. This is unfortunately not always true. So, here is a way to make the Nothing value available in AutoIt: Local $oVBS = ObjCreate("ScriptControl") $oVBS.language = "VBScript" Global Const $Nothing = $oVBS.eval("Nothing") $oVBS = $Nothing $Nothing is then available to use anywhere in your script. Dale Note: There are cases where nothing works like $Nothing. for others you may be able to use 0, "" or the Default keyword. Edited June 28, 2008 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 Link to comment Share on other sites More sharing options...
GEOSoft Posted February 23, 2008 Share Posted February 23, 2008 In nearly every case I've encountered, setting a COM object to the null string ("") produces the same result as as setting the same to the constant "Nothing" in VB/VBScript. This is unfortunately not always true. So, here is a way to make the Nothing value available in AutoIt: Local $oVBS = ObjCreate("ScriptControl") $oVBS.language = "VBScript" Global Const $Nothing = $oVBS.eval("Nothing") $oVBS = $Nothing $Nothing is then available to use anywhere in your script. DaleThanks Dale. This could come in handy. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
James Posted February 23, 2008 Share Posted February 23, 2008 Neat. Thanks! Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
arcker Posted February 25, 2008 Share Posted February 25, 2008 Excellent ! as you said, setting "" is not always sufficient. thx for the tip. -- Arck System _ Soon -- Ideas make everything "La critique est facile, l'art est difficile" Projects :[list] [*]Au3Service : Run your exe as service V3 / Updated 29/07/2013 Get it Here [/list] Link to comment Share on other sites More sharing options...
martin Posted February 25, 2008 Share Posted February 25, 2008 In nearly every case I've encountered, setting a COM object to the null string ("") produces the same result as as setting the same to the constant "Nothing" in VB/VBScript. This is unfortunately not always true. So, here is a way to make the Nothing value available in AutoIt: Local $oVBS = ObjCreate("ScriptControl") $oVBS.language = "VBScript" Global Const $Nothing = $oVBS.eval("Nothing") $oVBS = $Nothing $Nothing is then available to use anywhere in your script. Dale Can you give an example of where "" doesn't work the same as $Nothing? I don't know anything about VB. Is Nothing a predefined constant in VB? Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
DaleHohm Posted February 25, 2008 Author Share Posted February 25, 2008 One example is the activeconnection property used with some ADO objects. You'll know that "" doesn't work because you'll get an error and $Nothing does because you don't. Yes, Nothing is a literal constant in VB/VBScript. 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 Link to comment Share on other sites More sharing options...
Gigglestick Posted February 25, 2008 Share Posted February 25, 2008 I wonder if there are any plans to make this a part of AutoIt, such as a @Nothing macro or a keyword Nothing. If not, it would be very helpful to have it, or fix the "" problem. My UDFs: ExitCodes Link to comment Share on other sites More sharing options...
ptrex Posted February 26, 2008 Share Posted February 26, 2008 @allSome of the objects accept the AU3 keyword Default for this.Regardsptrex 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 Link to comment Share on other sites More sharing options...
GEOSoft Posted February 26, 2008 Share Posted February 26, 2008 @allSome of the objects accept the AU3 keyword for this.RegardsptrexAnd as Dale pointed out in the original post some will accept "". The keyword in both his post and yours is "some".$Nothing should work in all instances. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
idbirch Posted November 24, 2010 Share Posted November 24, 2010 (edited) Unfortunately I seem to have found a case where none of the current methods for harnessing the 'Nothing' VB variable work. I'm porting a VB script which does a simple check on backup progress in Symantec Backup Exec System Recovery Manager 8.0.1. The original VB script looks like this: Option Explicit Dim oProgDlg Set oProgDlg = createObject("Symantec.VProProgress.ProgressDlg") Call oProgDlg.ShowProgress(Nothing,True,True,"") And my AutoIt version currently like this: Local $oVBS = ObjCreate("ScriptControl") $oVBS.language = "VBScript" Global Const $Nothing = $oVBS.eval("Nothing") $oVBS = $Nothing $oProgDlg = ObjCreate("Symantec.VProProgress.ProgressDlg") $oProgDlg.ShowProgress($Nothing,True,True,"") But it doesn't work, the Symantec app does nothing at all, no errors are produced either (which is exactly what happens when you replace 'Nothing' in the VB Script with anything else). In the AutoIt version, I've tried 0, "", Default, DIMing a variable with no value and passing that, and the method posted in this thread, nothing works. And when I say nothing works, I mean Nothing doesn't work I'm thinking I will have to just call the poxy VB script externally but that's just dirty, any other suggestions? Edited November 24, 2010 by idbirch Link to comment Share on other sites More sharing options...
James Posted November 24, 2010 Share Posted November 24, 2010 I'm thinking I will have to just call the poxy VB script externally but that's just dirty, any other suggestions?One. Stop reviving old topics, this has been dead for two years.Post in the General Help and Support forum. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
idbirch Posted November 24, 2010 Share Posted November 24, 2010 I thought it better to revive a relevant topic rather than start another about an already discussed one. Silly me. Link to comment Share on other sites More sharing options...
James Posted November 24, 2010 Share Posted November 24, 2010 I thought it better to revive a relevant topic rather than start another about an already discussed one. Silly me.In most cases, yes. When the relative topic is 2 years+ old, no, it's not. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
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