Modify

Opened 17 years ago

Closed 17 years ago

Last modified 17 years ago

#56 closed Feature Request (Rejected)

Some features for discussion

Reported by: Xenobiologist Owned by:
Milestone: Component: AutoIt
Version: Severity:
Keywords: Cc:

Description

Hi,

GaryFrost openend a thread how to submit udfs. I searched through my snippets and found some pieces of code which I'd like to discuss whether they can become a macro/udf ... before submitting them btw. somebody creates a nice piece of code for achieving the goal.

Before flaming me, YES I know they are not perfect. The code is just as examples!

  1. Macro for type of OS like (XP home or Professional)
  2. _getDNS()
  3. Macro for loggedInUser
  4. StringInsertLF

1.

Global $objWMIService = objget("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
Global $colSettings = $objWMIService.ExecQuery("Select * from Win32_OperatingSystem")
For $objOperatingSystem in $colSettings
    $Type = StringMid($objOperatingSystem.Caption, 19)
    MsgBox(64, 'Ouput of Windows Type', "Type	: "& $Type)
Next
MsgBox(0,"",_getDNS())

Func _getDNS()
    Local $dns_A = StringRegExp(StdoutRead(Run(@ComSpec & " /c nslookup", "", @SW_HIDE, 2)), '(?s)(?i)server:  .*?\.(.*?)(?m:$|\r)', 1)
    If IsArray($dns_A) Then Return $dns_A[0]
    Return SetError(1)
EndFunc
  1. (may fail on other machines than XP PRO SP2?)
    Global $loggegInUser = RegRead("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", "AltDefaultUserName")
    Msgbox(64, "Value", $loggegInUser)
    
  1. ;~ Beispieltext von http://de.wikipedia.org/wiki/AutoIt
    $String = "Die Skripte ermöglichen z. B. das Ausführen von Programmen, das Simulieren von Tastaturanschlägen bzw. Mausklicks. Es können einfache Textfunktionen der Zwischenablage oder auch Windowsfunktionen (wie z. B. minimieren, verstecken, Warten auf/Aktivieren von Fenstern) aufgerufen werden. Seit Version 3 können zudem graphische Benutzeroberflächen mit zahlreichen Controls entworfen werden. Soll es um Registrymanipulationen oder komplexere Schleifen gehen, ist AutoIt 3 inzwischen mit seiner verbesserten Syntax deutlich einfacher zu handhaben als frühere Versionen. Es ist möglich, AutoIt mit anderen Scriptsprachen wie WSH oder Kixtart zu kombinieren (AutoItX)."
    
    MsgBox(0, "", $String) ; Original-Text
    MsgBox(0, "", _StringInsertLF($String, 50)) ; Softbreak after 50 
    MsgBox(0, "", _StringInsertLF($String, 50, 1)) ; Hardbreak after 50
    
    Func _StringInsertLF($strString, $nCount, $cBreaking = 0)
    	Local $strRetString = "", $nPos
    	Do
    		If StringLen($strString) > $nCount Then
    			$nPos = StringInStr(StringLeft($strString, $nCount + 1), " ", 0, -1)
    			If ($nPos And $cBreaking = 0) Then
    				$strRetString &= StringLeft($strString, $nPos - 1) & @LF
    				$strString = StringMid($strString, $nPos + 1)
    			Else
    				$strRetString &= StringLeft($strString, $nCount) & @LF
    				$strString = StringMid($strString, $nCount + 1)
    			EndIf
    		EndIf
    	Until StringLen($strString) < $nCount
    	$strRetString &= $strString
    	Return $strRetString
    EndFunc   ;==>_StringInsertLF
    

Mega

Attachments (0)

Change History (2)

comment:1 Changed 17 years ago by Gary

  • Resolution set to rejected
  • Status changed from new to closed

Examples forum is where you should put these to get feedback from the user community.

Tickets should not be made up for discussing things.

comment:2 Changed 17 years ago by TicketCleanup

  • Version 3.2.10.0 deleted

Automatic ticket cleanup.

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The ticket will remain with no owner.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.