;-- TIME_STAMP 2017-05-27 13:57:52 v 0.1 #RequireAdmin _FileCreateTemplate() Func _FileCreateTemplate() Local $sCreator = _GetAU3Property('UDFCreator', @UserName) Local $sWrite = _ "#cs ----------------------------------------------------------------------------" & @CRLF & @CRLF & _ " AutoIt Version: " & @AutoItVersion & @CRLF & _ " Author: " & ($sCreator = "Your Name" ? @UserName : $sCreator) & @CRLF & @CRLF & _ " Script Function: AutoIt script." & @CRLF & @CRLF & _ "#ce ----------------------------------------------------------------------------" & @CRLF & @CRLF & _ "; Script Start - Add your code below here" & @CRLF Local $sFileName = @WindowsDir & "\ShellNew\Template.au3" If Not FileExists($sFileName) Then Exit MsgBox(262192, 'Fehler', 'Es ist keine Datei "Template.au3" installiert!') Local $fH = FileOpen($sFileName, 2+128) Local $iSucc = FileWrite($fH, $sWrite) FileClose($fH) Exit MsgBox(($iSucc = 1 ? 262208 : 262192), ($iSucc = 1 ? 'Fertig!' : 'Fehler!'), ($iSucc = 1 ? _ 'Das personalisierte Template wurde erfolgreich geschrieben.' : 'Das Template konnte nicht geschrieben werden.')) EndFunc ; #FUNCTION# ==================================================================================================================== ; Name ..........: _GetAU3Property ; Description ...: Gets a property value (one-line entry only!). Ask order: 1. SciTEUser.properties 2. au3.properties ; Syntax ........: _GetAU3Property($sProperty[, $sDefault = '']) ; Parameters ....: $sProperty - The property name ; $sDefault - [optional] A value to use, if none property set. Default is ''. ; Return values .: The value of the property (or the default value) ; Author ........: BugFix ; =============================================================================================================================== Func _GetAU3Property($sProperty, $sDefault='') Local $sPathUserProp = @LocalAppDataDir & "\AutoIt v3\SciTE\SciTEUser.properties" ; C:\Users\[USER]\AppData\Local\AutoIt v3\SciTE\SciTEUser.properties Local $sPathAU3Prop = StringTrimRight(@AutoItExe, 11) & "SciTE\properties\au3.properties" ; C:\Program Files (x86)\AutoIt3\SciTE\properties\au3.properties Local $sRead = '', $sValueReturn = $sDefault, $aMatch Local $sPattern = $sProperty & "=([^\r\n]+)" If FileExists($sPathUserProp) Then $sRead = FileRead($sPathUserProp) $aMatch = StringRegExp($sRead, $sPattern, 1) If @error Then If FileExists($sPathAU3Prop) Then $sRead = FileRead($sPathAU3Prop) $aMatch = StringRegExp($sRead, $sPattern, 1) If Not @error Then $sValueReturn = $aMatch[0] Else $sValueReturn = $aMatch[0] EndIf Return $sValueReturn EndFunc