Jump to content

hum3

Members
  • Posts

    3
  • Joined

  • Last visited

hum3's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. This is great. I just corected a couple of typos so it runs and changed a message to one that was more neutral. CODE; Generated by NewScript 4.5 ;---------------------------------------------------------------------------- ; Created: 06-05-2007 13:02:23 ; Author: Johnny Rex ; Mail: RexprivatAThotmailDOTcom ; Version: 1.0a ; AutoitVer: 3.1.1.119 ; AutoItForum: ; Script Function: ; Enables or disables Auto logon on Wndows XP ; Changelog: 1.0a Hum3 2007-09-13 Corrected a couple of typos ; ; ---------------------------------------------------------------------------- #include <GUIConstants.au3> ; Includes GUIConstants.au3 to script ; Opt's Start > -------------------------------------------------------------- ; Opt("RunErrorsFatal", 1) ;1=fatal, 0=silent set @error Opt("GUIOnEventMode", 1) ;0=disabled, 1=OnEvent mode enabled ; Opt("GUICloseOnESC", 1) ;1=ESC closes, 0=ESC won't close ; Opt("TrayIconDebug", 0) ;0=no info, 1=debug line info ; Opt("TrayMenuMode",0) ;0=append, 1=no default menu, 2=no automatic check, 4=menuitemID not return ; Opt("TrayOnEventMode",0) ;0=disable, 1=enable Opt("TrayIconHide", 1) ;0=show, 1=hide tray icon ; Opt("TrayAutoPause",1) ;0=no pause, 1=Pause ; Opt's End > ---------------------------------------------------------------- ; Script start Global $Pass_1, $Pass_2, $Pass_Check, $Pass_Check2, $Pass_Check_OK #Region ### START Koda GUI section ### $AutoLogon = GUICreate(" Force Autologon", 365, 208, -1, -1, BitOR($WS_SYSMENU, $WS_CAPTION, $WS_POPUP, $WS_POPUPWINDOW, $WS_BORDER, $WS_CLIPSIBLINGS)) $User_Name = GUICtrlCreateInput("", 16, 24, 329, 30, BitOR($ES_CENTER, $ES_AUTOHSCROLL, $ES_READONLY)) GUICtrlSetData(-1, @UserName) ;GUICtrlSetState(-1, $GUI_Disable) GUICtrlSetFont(-1, 14, 400, 0, "Arial") GUICtrlSetColor(-1, 0x800080) $Pass_1 = GUICtrlCreateInput("", 16, 80, 329, 21, BitOR($ES_PASSWORD, $ES_AUTOHSCROLL)) GUICtrlSetTip(-1, "Type password, or leve blank for non") GUICtrlSetState(-1, $GUI_Focus) GUICtrlSetColor(-1, 0xFF0000) ;GUICtrlSetOnEvent(-1, "Pass_1Change") $Pass_2 = GUICtrlCreateInput("", 16, 128, 329, 21, BitOR($ES_PASSWORD, $ES_AUTOHSCROLL)) GUICtrlSetTip(-1, "Type password, or leve blank for non") GUICtrlSetColor(-1, 0xFF0000) ;GUICtrlSetColor(-1, 0x00FF00) ;GUICtrlSetOnEvent(-1, "Pass_2Change") $ALabel1 = GUICtrlCreateLabel("User Name", 16, 8, 64, 16) $ALabel2 = GUICtrlCreateLabel("Password", 16, 64, 70, 16) $ALabel3 = GUICtrlCreateLabel("Retype Password", 16, 112, 110, 16) $OK = GUICtrlCreateButton("&Ok", 16, 160, 75, 25, $BS_DEFPUSHBUTTON) GUICtrlSetOnEvent(-1, "OKClick") GUICtrlSetTip(-1, "Enables Autologon") $Exit = GUICtrlCreateButton("Exit", 104, 160, 75, 25, 0) GUICtrlSetOnEvent(-1, "ExitClick") GUICtrlSetTip(-1, "Exits Autologon") $remowe = GUICtrlCreateButton("Remove", 272, 160, 75, 25, 0) GUICtrlSetOnEvent(-1, "removeClick") GUICtrlSetTip(-1, "Disables Autologon") $Label1 = GUICtrlCreateLabel("©2007 //>Rex<\\", 256, 192, 91, 15) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 Sleep(100) ; ==> Checking typed password $Pass_Check = GUICtrlRead($Pass_1) $Pass_Check2 = GUICtrlRead($Pass_2) If $Pass_Check == $Pass_Check2 Then GUICtrlSetColor($Pass_1, 0x00FF00) ; Sets the fontcolor to Green when the 2 passwords are identical GUICtrlSetColor($Pass_2, 0x00FF00) ; Sets the fontcolor to Green when the 2 passwords are identical Else GUICtrlSetColor($Pass_1, 0xFF0000) ; Sets fontcolor to Red, as default and until the 2 pass are identical GUICtrlSetColor($Pass_2, 0xFF0000) ; Sets fontcolor to Red, as default and until the 2 pass are identical EndIf ; <== Checking typed password WEnd Func ExitClick() SplashTextOn("By by", "On reboot will log on", "350", "50", "-1", "-1", 2, "Arial Black", "20", "400") Sleep(500) Exit EndFunc ;==>ExitClick Func OKClick() If $Pass_Check == $Pass_Check2 Then $Pass_Check_OK = $Pass_Check2 $regread = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "LogonType"); Checks logon style in reg If $regread = "00000001" Then; If Dword = 1 logon typpe is XP, and we changes it to oldstyle RegDelete("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "Background") RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "AllowMultipleTSSessions", "REG_DWORD", "00000000") RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "LogonType", "REG_DWORD", "00000000") EndIf RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "ForceAutoLogon", "REG_SZ", "1") RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "AutoAdminLogon", "REG_SZ", "1") RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "DefaultPassword", "REG_SZ", $Pass_Check_OK) MsgBox(64, "Autologon", "Autologon for User " & @CRLF & @UserName & @CRLF & "Is Enabled...", 10) Else MsgBox(16, "Password", "Passwords" & @CRLF & "are not identical..." & @CRLF & "Try again.") GUICtrlSetData($Pass_1, "") ; Clear input GUICtrlSetData($Pass_2, "") ; Clear input EndIf EndFunc ;==>OKClick Func RemoveClick() $Check = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "ForceAutoLogon") If $Check == "1" Then $iMsgBoxAnswer = MsgBox(52, "Password", "This will disable Autologon !" & @CRLF & @CRLF & "Do you want to disable Autologon ?") Select Case $iMsgBoxAnswer = 6 ;Yes RegDelete("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "ForceAutoLogon") ; This part enables Disables Autologon RegDelete("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "AutoAdminLogon") ; This part enables Disables Autologon RegDelete("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "DefaultPassword") ; This part enables Disables Autologon $iMsgBoxAnswer = MsgBox(64, "Autologon", "Autologon for User" & @CRLF & @UserName & @CRLF & "are dissabled...", 10) Case $iMsgBoxAnswer = 7 ;No EndSelect Else MsgBox(16, "Autologon", "Autologon not active" & @CRLF & "on this computer !!") End EndIf EndFunc ;==>removeClick
  2. An Update. What I really wanted was a list of printer names that matched the list in ActivePrinter in Excel. This is actually slightly different from the code above and this is what I have got to incase anyone else wants it. i have only tested in Excel 2003 CODE;Returns a list which should match ActivePrinter and ing the same order Func _PrinterList() Local $key, $list, $port, $printer, $printerList[99], $numPrinters ;Set to only work for max of 99 printers $numPrinters = 0 $key = "HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Devices" $j = 1 While 1 $printer = RegEnumVal($key, $j) If @error < 0 Then ExitLoop ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $printer=RegEnumKey($key,$j) = ' & "Prob 1? " & $j & " " & $printer & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console $port = RegRead($key ,$printer) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : RegRead($key,$printer) = ' & "Prob? " & $port & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console $port = StringRight($port,StringLen($port)-StringInStr($port,",")) $printerList[$numPrinters] = $printer & " on " & $port $numPrinters += 1 ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $numPrinters = ' & $numPrinters & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console $j = $j + 1 WEnd if $numPrinters > 0 Then ReDim $printerList[$numPrinters] Else ;no printers set up ReDim $printerList[1] $printerList[0] = "No printers setup" EndIf Return $printerList EndFunc ;==>_PrinterList
  3. I just updated this as I wanted to use it and didn't quite work on my XP machine CODE; Default printer is denoted with astrisk; shared printers are denoted with $ then share name MsgBox(4096, "Printer Info |" & @OSTYPE & "|", _Identify_Printers()) ; CyberSlug - 18 Nov 2004 ; Hum3 - 2007-09-14 ; List installed printers (port name drive and shareNameIfApplicable) also indentify default printer Func _Identify_Printers() Local $key, $default, $i = 1, $list, $name If @OSTYPE = "WIN32_WINDOWS" Then $key = "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Print\Printers" $default = RegRead("HKEY_CURRENT_CONFIG\System\CurrentControlSet\Control\Print\Printers", "Default") ElseIf @OSTYPE = "WIN_NT" Then;WIN_NT type $key = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Printers" $netKey = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Printers" $default = RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows", "Device") $default = StringLeft($default, StringInStr($default, ",") - 1);remove info after comma... Else ;assume "WIN32_NT" $key = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Printers" $netKey = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Providers\LanMan Print Services\Servers" $default = RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows", "Device") $default = StringLeft($default, StringInStr($default, ",") - 1);remove info after comma... EndIf ;;;$list = StringReplace($list, $default, '** ' & $default) ; ENUMERATE LOCAL PRINTERS (AND ALSO 9x PRINTERS SHARED ON OTHER COMPUTERS) While 1 ;#cs - enum bug workaround RegRead($key, "") If @error = 1 Then ExitLoop ;#ce Local $name = RegEnumKey($key, $i) If @error Then ExitLoop Local $port = "<" & RegRead($key & "\" & $name, "Port") & ">" If $name = $default Then $port = '* ' & $port Local $driver = RegRead($key & "\" & $name, "Printer Driver") Local $shared = RegRead($key & "\" & $name, "Share Name") If $shared <> "" Then $shared = "$ " & $shared $list = $list & $port & " " & $name & " [" & $driver & "] " & $shared & @CRLF $i = $i + 1 WEnd ; ENUMERATE 2000/XP PRINTERS SHARED ON OTHER COMPUTERS If @OSTYPE <> "WIN32_WINDOWS" Then Local $i = 1, $j = 1 While 1 ;#cs - enum bug workaround RegRead($netKey, "") If @error = 1 Then ExitLoop ;#ce Local $serverAddress = RegEnumKey($netKey, $i) If @error Then ExitLoop $j = 1 While 1 ;#cs - enum bug workaround RegRead($netKey & "\" & $serverAddress & "\Printers", "") If @error = 1 Then ExitLoop (2) ;#ce Local $networkedPrinter = RegEnumKey($netKey & "\" & $serverAddress & "\Printers", $j) If @error Then ExitLoop (2) $name = RegRead($netKey & "\" & $serverAddress & "\Printers\" & $networkedPrinter, "Name") Local $share = "<\\" & $serverAddress & "\" & RegRead($netKey & "\" & $serverAddress & "\Printers\" & $networkedPrinter, "Share Name") & ">" If $name = $default Then $share = '* ' & $share $list = $list & $share & " " & $name & " [" & $driver & "]" & @CRLF $j = $j + 1 WEnd $i = $i + 1 WEnd EndIf If $list = "" Then $list = "No printers detected" & @CRLF Return $list EndFunc ;==>_Identify_Printers
×
×
  • Create New...