Steve Lovell Posted November 29, 2006 Share Posted November 29, 2006 I'm using AutoIt to create a simple executable that I'm calling from a Y!WE widget. I want the script to do one of two things depending on the number of parameters it's passed. If no parameters are passed it searches two registry locations for an instance of "FirstDisplay" and returns a 1 or a 2 if it finds the entry in those locations. If parameters are passed, the first is either a 1 or a 2 and the second is the name of registry key to delete (from the same location as "FirstDisplay"). The deletion part works okay, but it seems that however I set up the Exit command it returns 0. Here's one version of my script: expandcollapse popup#include <Array.au3> $regArray = _ArrayCreate( _ "HKEY_CURRENT_USER\Software\Yahoo\WidgetEngine\Widgets\", _ "HKEY_CURRENT_USER\Software\Pixoria\Konfabulator\Widgets\" _ ) Dim $ThisWidget $ThisWidget = "FirstDisplay" Dim $RegIndex $RegIndex = -1 if $CmdLine[0]<2 Then LookForSelf() if $CmdLine[0]=2 Then DeleteEntry() if $CmdLine[0]>2 Then Exit (0) Func LookForSelf() Dim $RegCheck $RegIndex = 0 For $RegCheck = 0 to _ArrayMaxIndex($regArray) if RegEnumKey($regArray[$RegCheck] & $ThisWidget,1) <> "" Then $RegIndex = $RegCheck +1 Next EndFunc Func DeleteEntry() Dim $ToDelete $ToDelete = $regArray[$CmdLine[1]-1] & $CmdLine[2] if RegEnumKey($ToDelete,1)="" Then MsgBox(0,$ThisWidget,"Sorry, " & $CmdLine[2] & " not found in registry") Else RegDelete($ToDelete) MsgBox(0,$ThisWidget,"Registry entries for " & $CmdLine[2] & " have been removed") EndIf EndFunc MsgBox(0,"",$RegIndex) Exit $RegIndex If I run the script from SciTE, ie passing no parameters, then the message box at the end gives "1" but the exit code is still 0. Any ideas? Link to comment Share on other sites More sharing options...
MHz Posted November 29, 2006 Share Posted November 29, 2006 Very strange. I am using Scite4Autoit3 as can be downloaded from here. I run this $RegIndex = 1 MsgBox(0,"",$RegIndex) Exit $RegIndex and get this output >"C:\Program Files\Autoit3\SciTe\..\Beta\autoit3.exe" /ErrorStdOut "C:\Program Files\AutoIt3\SciTE\Temp\2006.11.27_tdp.au3" >Exit code: 1 Time: 1.760Exit code of 1, so I do not understand the result that you receive. Are you up to date with your Scite version? Link to comment Share on other sites More sharing options...
Developers Jos Posted November 29, 2006 Developers Share Posted November 29, 2006 Very strange. I am using Scite4Autoit3 as can be downloaded from here. I run this $RegIndex = 1 MsgBox(0,"",$RegIndex) Exit $RegIndex oÝ÷ Ù©Ýëm+(ºÚn´LbµÊzõ²¢z-ºw^®ËZÛaz·¬º[m«r¢êÞqè¯x ÞÊ®¦Új×°Ør¢êÒr+^½êìÿªê-xúèm¦åÉ©Ò¶¸§+,¹äëÊë"®¶sbWBçVÖ&W"b33cµ&VtæFW SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Steve Lovell Posted November 29, 2006 Author Share Posted November 29, 2006 Thanks for your speedy replies ... Tried the Exit Number($RegIndex) thing, but with no success. I also tried the three line script and that had the same result as my longer one. But since that seemed to indicate problems with my installation I downloaded and installed the latest AutoIt and SciTE packages and now all is working as would be expected. It was rather weird though. Thanks again, Steve 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