Jump to content

Recommended Posts

Posted
#requireadmin
if not RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\HideFileExt\type", "checkbox") Then
Local $longdate = " Long date set incorrectly ;( "
Else
    Local $longdate = " Long date set Correctly :) "
MsgBox(64,"Terminal User Setup", $longdate,0,0)
EndIf

MsgBox(64,"Terminal User Setup", @error,0,0)

This is most likely a simple issue but for the life of me i can not seem to figure out why this gives me an error of 1. I know that error 1 means that it cant open the key but it could before and the permissions on this key are set for admin access to read.

 

any help please.....thanks

Posted

"C:\Program Files (x86)\AutoIt3\SciTE\..\AutoIt3.exe" "C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "C:\work\Hospitallity\Script files\Longdate.au3" /UserParams    
+>09:40:13 Starting AutoIt3Wrapper v.16.306.1237.0 SciTE v.3.6.2.0   Keyboard:00000409  OS:WIN_10/  CPU:X64 OS:X64  Environment(Language:0409)  CodePage:0  utf8.auto.check:4    # detect ascii high characters and if none found set default encoding to UTF8 and do not add BOM

 

well according to this it looks to be the 32bit executable.

 

  • Developers
Posted

So the second bit in my post should be an indication what your issue is. ;)

Quote from the helpfile:

Quote

Remarks

A registry key must start with "HKEY_LOCAL_MACHINE" ("HKLM") or "HKEY_USERS" ("HKU") or "HKEY_CURRENT_USER" ("HKCU") or "HKEY_CLASSES_ROOT" ("HKCR") or "HKEY_CURRENT_CONFIG" ("HKCC").

When running on 64-bit Windows if you want to read a value specific to the 64-bit environment you have to suffix the HK... with 64 i.e. HKLM64.
 

Jos

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.
  :)

Posted

If I was trying a 64bit key I could understand but this key is 32bit, but just assuming that I was mistaken(happens more than i'd like to admit) I tried with the 32 bit version

if not RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\HideFileExt\type", "checkbox") Then
Local $longdate = " Long date set incorrectly ;( "
Else
    Local $longdate = " Long date set Correctly :) "
MsgBox(64,"Terminal User Setup", $longdate,0,0)
EndIf

MsgBox(64,"Terminal User Setup", @error,0,0)

and I also tried the 64bit

if not RegRead("HKLM64\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\HideFileExt\type", "checkbox") Then
Local $longdate = " Long date set incorrectly ;( "
Else
    Local $longdate = " Long date set Correctly :) "
MsgBox(64,"Terminal User Setup", $longdate,0,0)
EndIf

MsgBox(64,"Terminal User Setup", @error,0,0)

And Instead of just trying to run it, I compiled both and then tried executing both and still with error 1

  • Developers
Posted

So the key you are trying to read is actually located in?:

"HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\HideFileExt\type"

Jos

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.
  :)

  • Developers
Posted (edited)

Can you try this version:

$rc=RegRead("HKLM64\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\HideFileExt\type", "checkbox")
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $rc = ' & $rc & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console
$rc=RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\HideFileExt\type", "checkbox")
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $rc = ' & $rc & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console

 

Edited by Jos

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.
  :)

Posted

on just an F5 on scite i get this

>"C:\Program Files (x86)\AutoIt3\SciTE\..\AutoIt3.exe" "C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "C:\work\Hospitallity\Script files\Longdate.au3" /UserParams    
+>10:48:54 Starting AutoIt3Wrapper v.16.306.1237.0 SciTE v.3.6.2.0   Keyboard:00000409  OS:WIN_10/  CPU:X64 OS:X64  Environment(Language:0409)  CodePage:0  utf8.auto.check:4    # detect ascii high characters and if none found set default encoding to UTF8 and do not add BOM
+>         SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE   UserDir => C:\Users\Aaron.Kennedy\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper   SCITE_USERHOME => C:\Users\Aaron.Kennedy\AppData\Local\AutoIt v3\SciTE 
>Running AU3Check (3.3.14.2)  from:C:\Program Files (x86)\AutoIt3  input:C:\work\Hospitallity\Script files\Longdate.au3
+>10:48:55 AU3Check ended.rc:0
>Running:(3.3.14.2):C:\Program Files (x86)\AutoIt3\autoit3_x64.exe "C:\work\Hospitallity\Script files\Longdate.au3"    
--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
@@ Debug(53) : $rc = 
>Error code: 1
@@ Debug(55) : $rc = 
>Error code: 1
+>10:49:02 AutoIt3.exe ended.rc:0
+>10:49:02 AutoIt3Wrapper Finished.
>Exit code: 0    Time: 8.224

 

  • Developers
Posted (edited)

You are seeing different results than I see. Do you need admin rights to read it that hive?
Try adding #requireAdmin at the top ( ConsoleWrite will not work)

#RequireAdmin
$rc=RegRead("HKLM64\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\HideFileExt\type", "checkbox")
MsgBox(262144, 'Debug line ~' & @ScriptLineNumber, 'Selection:' & @CRLF & '$rc' & @CRLF & @CRLF & 'Return:' & @CRLF & $rc) ;### Debug MSGBOX
$rc=RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\HideFileExt\type", "checkbox")
MsgBox(262144, 'Debug line ~' & @ScriptLineNumber, 'Selection:' & @CRLF & '$rc' & @CRLF & @CRLF & 'Return:' & @CRLF & $rc) ;### Debug MSGBOX

 

Edited by Jos

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.
  :)

  • Developers
Posted (edited)

Makes sense ...  I am currently at a loss as it is working fine for me.

Err=1 should indicate that the key (param 1) doesn't exist.

Edited by Jos

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.
  :)

  • Developers
Posted

Just for kicks ...  this should tell you at which level the key is wrong:

$Regkey="HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\HideFileExt\type"
$RegLev=StringSplit($regkey,"\")
$Regkey="HKLM"
For $x = 2 to $RegLev[0]
    $Regkey&= "\" & $RegLev[$x]
    $rc=RegRead($Regkey, "checkbox")
    ConsoleWrite('Key=' & $Regkey & ' : $rc = ' & $rc &  '   Error code: ' & @error & @CRLF)
Next

Jos

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.
  :)

Posted

this is very weird, it looks as though i have permission issues

 

>"C:\Program Files (x86)\AutoIt3\SciTE\..\AutoIt3.exe" "C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "C:\work\Hospitallity\Script files\Longdate.au3" /UserParams    
+>12:56:23 Starting AutoIt3Wrapper v.16.306.1237.0 SciTE v.3.6.2.0   Keyboard:00000409  OS:WIN_10/  CPU:X64 OS:X64  Environment(Language:0409)  CodePage:0  utf8.auto.check:4    # detect ascii high characters and if none found set default encoding to UTF8 and do not add BOM
+>         SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE   UserDir => C:\Users\Aaron.Kennedy\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper   SCITE_USERHOME => C:\Users\Aaron.Kennedy\AppData\Local\AutoIt v3\SciTE 
>Running AU3Check (3.3.14.2)  from:C:\Program Files (x86)\AutoIt3  input:C:\work\Hospitallity\Script files\Longdate.au3
+>12:56:23 AU3Check ended.rc:0
>Running:(3.3.14.2):C:\Program Files (x86)\AutoIt3\autoit3_x64.exe "C:\work\Hospitallity\Script files\Longdate.au3"    
--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
Key=HKLM\SOFTWARE : $rc =    Error code: -1
Key=HKLM\SOFTWARE\Microsoft : $rc =    Error code: -1
Key=HKLM\SOFTWARE\Microsoft\Windows : $rc =    Error code: -1
Key=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion : $rc =    Error code: -1
Key=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer : $rc =    Error code: -1
Key=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced : $rc =    Error code: -1
Key=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder : $rc =    Error code: -1
Key=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\HideFileExt : $rc =    Error code: -1
Key=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\HideFileExt\type : $rc =    Error code: 1
+>12:56:44 AutoIt3.exe ended.rc:0
+>12:56:44 AutoIt3Wrapper Finished.
>Exit code: 0    Time: 22.29

 

Posted

I am so so sorry lol, this was so simple I had a blonde moment, 

$Regkey="HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\HideFileExt\type"
$RegLev=StringSplit($regkey,"\")
$Regkey="HKLM"
For $x = 2 to $RegLev[0]
    $Regkey&= "\" & $RegLev[$x]
    $rc=RegRead($Regkey, "checkbox")
    ConsoleWrite('Key=' & $Regkey & ' : $rc = ' & $rc &  '   Error code: ' & @error & @CRLF)
Next

this is what it should have been, I am sorry for wasting your time so so sorry.

$Regkey="HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\HideFileExt"
$RegLev=StringSplit($regkey,"\")
$Regkey="HKLM"
For $x = 2 to $RegLev[0]
    $Regkey&= "\" & $RegLev[$x]
    $rc=RegRead($Regkey, "type")
    ConsoleWrite('Key=' & $Regkey & ' : $rc = ' & $rc &  '   Error code: ' & @error & @CRLF)
Next

 

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...