Valuater Posted April 20, 2006 Author Posted April 20, 2006 ; add user accounts ; Author - MHz _NetUser('Jack', 'pw_abc') _NetUser('Jill', 'pw_def') Func _NetUser($name, $password = '', $groupname = 'Administrators', $autologon = 0) ; Creates user accounts. Only 1 user can have autologon, if set. Local $key If Not FileExists(EnvGet('AllUsersProfile') & '\..\' & $name) Then RunWait(@ComSpec & ' /c ' & _ 'Net User ' & $name & ' ' & $password & ' /add &&' & _ 'Net LocalGroup ' & $groupname & ' ' & $name & ' /add &' & _ 'Net Accounts /MaxPwAge:UnLimited', '', @SW_HIDE) If $autologon Then $key = 'HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon' RegWrite($key, 'DefaultUserName', 'Reg_sz', $name) RegWrite($key, 'DefaultPassword', 'Reg_sz', $password) RegWrite($key, 'AutoAdminLogon', 'Reg_sz', 1) EndIf EndIf EndFunc 8)
Valuater Posted May 3, 2006 Author Posted May 3, 2006 expandcollapse popup; Get ALL controls Info ; Author - CyberSlug ( dusted-off old code ) $title = "Calculator" Run("calc.exe") WinWait($title) MsgBox( 0x0,"Info", _getClasses($title) ) Exit ; This function returns an @LF-separted list of controls on the specified window Func _getClasses($title) ;Get array of each control Local $buttonCount = 0, $editCount = 0, $staticCount = 0, $i Local $classes = StringSplit( WinGetClassList($title) , @LF) Local $classIDs[$classes[0]+1] $classIDs[0] = $classes[0] For $i = 1 to $classes[0] Select Case $classes[$i] = "Button" $buttonCount = $buttonCount + 1 $classIDs[$i] = $classes[$i] & $buttonCount Case $classes[$i] = "Edit" $editCount = $editCount + 1 $classIDs[$i] = $classes[$i] & $editCount $classes[$i] = "Input" Case $classes[$i] = "Static" $staticCount = $staticCount + 1 $classIDs[$i] = $classes[$i] & $staticCount $classes[$i] = "Label" Case Else If $classes[$i] <> "" Then $classIDs[$i] = $classes[$i] & "?" EndSelect Next ;Display the results Local $output = "" For $i = 1 to $classIDs[0] $output = $output & $classIDs[$i] & @LF Next Return $output EndFunc 8)
Valuater Posted May 3, 2006 Author Posted May 3, 2006 (edited) ; timer to "thousandths" of a second ; Author - Holger While 1 ToolTip(@Hour & ':' & @Min & ':' & @Sec & ':' & _MSec()) Sleep(1) WEnd Exit Func _MSec() Local $stSystemTime = DllStructCreate('ushort;ushort;ushort;ushort;ushort;ushort;ushort;ushort') DllCall('kernel32.dll', 'none', 'GetSystemTime', 'ptr', DllStructGetPtr($stSystemTime)) $sMilliSeconds = StringFormat('%03d', DllStructGetData($stSystemTime, 8)) $stSystemTime = 0 Return $sMilliSeconds EndFunc 8) Edited May 3, 2006 by Valuater
jftuga Posted May 16, 2006 Posted May 16, 2006 (edited) ; Move Message Box ; Author - herewasplato _MoveMsgBox(0, "testTitle", "testText", 0, 10) Func _MoveMsgBox($MBFlag, $MBTitle, $MBText, $x, $y) Local $file = FileOpen(EnvGet("temp") & "\MoveMB.au3", 2) If $file = -1 Then Return;if error, give up on the move Local $line1 = 'AutoItSetOption(' & '"WinWaitDelay", 0' & ')' Local $line2 = 'WinWait("' & $MBTitle & '", "' & $MBText & '")' Local $line3 = 'WinMove("' & $MBTitle & '", "' & $MBText & '"' & ', ' & $x & ', ' & $y & ')' FileWrite($file, $line1 & @CRLF & $line2 & @CRLF & $line3) FileClose($file) Run(@AutoItExe & " /AutoIt3ExecuteScript " & EnvGet("temp") & "\MoveMB.au3") MsgBox($MBFlag, $MBTitle, $MBText) FileDelete(EnvGet("temp") & "\MoveMB.au3") EndFunc;==>_MoveMsgBox A small improvement: local $result = MsgBox($MBFlag, $MBTitle, $MBText) and then have the last line of the function return $result. -John Edited May 16, 2006 by jftuga Admin_Popup, show computer info or launch shellRemote Manager, facilitates connecting to RDP / VNCProc_Watch, reprioritize cpu intensive processesUDF: _ini_to_dict, transforms ini file entries into variablesUDF: monitor_resolutions, returns resolutions of multiple monitorsReport Computer Problem, for your IT help deskProfile Fixer, fixes a 'missing' AD user profile
JoshDB Posted May 17, 2006 Posted May 17, 2006 You guys are crazy... Ha, I haven't been on these forums since... 2006, almost. Behold, my legacy signature:My AutoIt idol is Valuater. You know you love him, too.My Stuff: D&D AGoT Tools Suite
ConsultingJoe Posted May 17, 2006 Posted May 17, 2006 Great job guys. these should be all included UDFs and this should be a sticky Thanks Check out ConsultingJoe.com
Moderators SmOke_N Posted May 17, 2006 Moderators Posted May 17, 2006 A small improvement: local $result = MsgBox($MBFlag, $MBTitle, $MBText) and then have the last line of the function return $result. -JohnI knew I had seen this post somewhere, I updated it even more differently lol... take a look: http://www.autoitscript.com/forum/index.ph...ndpost&p=185158 Of course, I don't know if you would call it an "improvement" Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
JoshDB Posted May 17, 2006 Posted May 17, 2006 This should be stickied.Check this out:http://www.autoitscript.com/forum/index.php?showtopic=26274 Ha, I haven't been on these forums since... 2006, almost. Behold, my legacy signature:My AutoIt idol is Valuater. You know you love him, too.My Stuff: D&D AGoT Tools Suite
Valuater Posted May 19, 2006 Author Posted May 19, 2006 (edited) ; Windows - copy with progress ; Author - JdeB ;~ 4 Do not display a progress dialog box. ;~ 8 Give the file being operated on a new name in a move, copy, or rename operation if a file with the target name already exists. ;~ 16 Respond with "Yes to All" for any dialog box that is displayed. ;~ 64 Preserve undo information, if possible. ;~ 128 Perform the operation on files only if a wildcard file name (*.*) is specified. ;~ 256 Display a progress dialog box but do not show the file names. ;~ 512 Do not confirm the creation of a new directory if the operation requires one to be created. ;~ 1024 Do not display a user interface if an error occurs. ;~ 2048 Version 4.71. Do not copy the security attributes of the file. ;~ 4096 Only operate in the local directory. Don't operate recursively into subdirectories. ;~ 8192 Version 5.0. Do not copy connected files as a group. Only copy the specified files. _FileCopy("C:\Installed Apps\Patches\WindowsXP-KB835935-SP2-ENU.exe","C:\temp") Func _FileCopy($fromFile,$tofile) Local $FOF_RESPOND_YES = 16 Local $FOF_SIMPLEPROGRESS = 256 $winShell = ObjCreate("shell.application") $winShell.namespace($tofile).CopyHere($fromFile,$FOF_RESPOND_YES) EndFuncMSDN Documentationhttp://msdn.microsoft.com/en-us/library/ms723207(VS.85).aspx; to copy a directory; the destination directory must exist_FileCopy("C:\Installed Apps\Patches\*.*","C:\temp\test")8) Edited November 7, 2008 by Valuater Tony4219 1
ptrex Posted May 19, 2006 Posted May 19, 2006 @Valuater VERY NICE !! And I thought I had seen all the COM objects 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
nocow Posted May 19, 2006 Posted May 19, 2006 If any finds the source you will have free contents running all over. Also if you make the the encrypt password to some like the username then it will work diffence on each computer and nobody can just "Copy/past" the regedit and get free contents Hope it help Regards
Moderators SmOke_N Posted May 19, 2006 Moderators Posted May 19, 2006 If any finds the source you will have free contents running all over. Also if you make the the encrypt password to some like the username then it will work diffence on each computer and nobody can just "Copy/past" the regedit and get free contentsHope it help RegardsThat doesn't point to any thread here (with a quote) and IMHO makes absolutely no sense Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
JoshDB Posted May 19, 2006 Posted May 19, 2006 I think he's talking about my post... Ha, I haven't been on these forums since... 2006, almost. Behold, my legacy signature:My AutoIt idol is Valuater. You know you love him, too.My Stuff: D&D AGoT Tools Suite
Neoborn Posted May 19, 2006 Posted May 19, 2006 That doesn't point to any thread here (with a quote) and IMHO makes absolutely no sense I love roast chicken! ~Projects~1. iPod Ejector 1.0 - Tool Used To Eject iPod in Windows - Uses DevEject.exe :P2. SmartFTP Close Popup Tool - Closes reminders from freeware SmartFTP.~Helpful Links For New Users~1. LXP's Learning AutoIT PDF Guide - <<< Go here for a PDF Guide on learning AutoIT from the ground up!<<<2. AutoIt 1-2-3 <<<Want to learn more about AutoIT quickly? Go Here<<<3. How To Install The Beta And Production Versions Of AutoIT / SciteAutoIT
JoshDB Posted May 20, 2006 Posted May 20, 2006 I love roast chicken! Roast Llllllllllama is for me Ha, I haven't been on these forums since... 2006, almost. Behold, my legacy signature:My AutoIt idol is Valuater. You know you love him, too.My Stuff: D&D AGoT Tools Suite
Valuater Posted May 21, 2006 Author Posted May 21, 2006 (edited) ** new ; finding a "hung" process ; author gafrost $v_ret = DllCall("user32.dll","int","IsHungAppWindow", "hwnd", $hwnd) If $v_ret[0] Then MsgBox(0,"HungApp", "Application is Hung") ;.... need to know the handle ( $hwnd ) ; finding if an application is hung ; neogia If _NotResponding("TITLE HERE", "TEXT HERE[OPTIONAL]", 1) Then; The last parameter indicates whether you want to close the hung app or not. MsgBox(0,"", "Hung Application, closing app now.") Else MsgBox(0,"", "Application running as intended.") EndIf Func _NotResponding($title, $text, $closeIfHung = 0) $hWnd = WinGetHandle($title, $text) If $hWnd == "" Then MsgBox(0,"Error","Could not find window") Exit EndIf $retArr = DllCall("user32.dll", "int", "IsHungAppWindow", "hwnd", $hWnd) If @error == 0 Then If $retArr[0] == 1 Then If $closeIfHung Then ProcessClose(WinGetProcess($title, $text)) EndIf Return 1 EndIf Else Return 0 EndIf EndFunc 8) Edited September 8, 2006 by Valuater
Valuater Posted May 21, 2006 Author Posted May 21, 2006 ; terminate a script right [i]before[/i] a user shuts ; VicTT Global $WM_QUERYENDSESSION = 0x0011 Func InterceptShutdown($hWnd, $msg, $w, $l) MsgBox(0, "", "Shutting down") EndFunc ;==>InterceptShutdown GUIRegisterMsg($WM_QUERYENDSESSION, "InterceptShutdown") While 1 Sleep(10) WEnd 8)
BigDod Posted May 27, 2006 Posted May 27, 2006 I think that This one by GaFrost should be added. Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother
JoshDB Posted May 28, 2006 Posted May 28, 2006 I use that one all the time Ha, I haven't been on these forums since... 2006, almost. Behold, my legacy signature:My AutoIt idol is Valuater. You know you love him, too.My Stuff: D&D AGoT Tools Suite
Valuater Posted June 1, 2006 Author Posted June 1, 2006 ; Round GUI Corners ; Author - gafrost Test Script #include <GuiConstants.au3> $my_gui = GuiCreate("MyGUI", 392, 323) _GuiRoundCorners($my_gui, 0, 0, 50, 50) GuiSetState() While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case Else ;;; EndSelect WEnd Exit Function to round the corners of a window: Func _GuiRoundCorners($h_win, $i_x1, $i_y1, $i_x3, $i_y3) Dim $pos, $ret, $ret2 $pos = WinGetPos($h_win) $ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long", $i_x1, "long", $i_y1, "long", $pos[2], "long", $pos[3], "long", $i_x3, "long", $i_y3) If $ret[0] Then $ret2 = DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $ret[0], "int", 1) If $ret2[0] Then Return 1 Else Return 0 EndIf Else Return 0 EndIf EndFunc ;==>_GuiRoundCorners 8)
Recommended Posts