Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Not receiving Return Value ( prob something stupid ive done...

$
0
0
Ok i made a function to find a default folder like this

I call it like this
[ autoit ]      
Local $nMsg = 0 While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $button1 _FindDefault() ;~ $sDefault = "D:\Code\Projects\" RegWrite("HKEY_CURRENT_USER\Software\Rand", "Location", "REG_SZ", $sDefault) EndSwitch WEnd

[ autoit ]      
Func _FindDefault() #region $sFindDefault Local $sDefault = "" $sDefault = FileSelectFolder("Choose a drive.", "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}") If @error = 1 Then ; User cancel or X close error check MsgBox(48, "Cancelled", "Cancelled By User", 4) $sDefault = "" EndIf If DriveSpaceTotal($sDefault) = 0 Then ; Drive contains no files error check MsgBox(48, "Source Error", "There Is No Data On That Drive", 4) $sDefault = "" EndIf Local $sDefaultEnd = StringRight($sDefault, 1) If $sDefaultEnd <> "\" Then $sDefault = $sDefault & "\" ;make sure backslash is on the end ConsoleWrite("Default = " & $sDefault & @CRLF) ;######## Checking ######## Return $sDefault #endregion EndFunc ;==>_FindDefault

When it uses the function _FindDefault() it never completes the reg key
Yet if i use this $sDefault = "D:\Code\Projects\" it works perfectly..

What did i miss?

Many thanks

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>