Holles Library

Veröffentliche deine funktionierenden Skripte und Funktionen

Moderator: jNizM

User avatar
Holle
Posts: 186
Joined: 01 Oct 2013, 23:19

Holles Library

10 Apr 2014, 01:53

Hier ist mal meine Lib, vielleicht kann ja jemand etwas davon gebrauchen.

Code: Select all

;*****************
; Holles_Lib.ahk *
; ############## *
; #            # *
; # Holles Lib # *
; #            # *
; ############## *
;                *
;*****************

Goto HollesLib_weiter ; ermöglicht das includen am "Anfang des Scripts"

{ ; *********** Math-Functions *********************************************************************************************
IsBinary(var) {
    return var~="^([0-1]+)$"
}
IsInteger(var) {
    return var~="^\s*[\+\-]?((0x[0-9A-Fa-f]+)|\d+)\s*$"
}
IsFloat(var) {
    return var~="^\s*[\+\-]?([0-9]+\.[0-9]*|[0-9]*\.[0-9]+)\s*$"
}
IsNumber(var) {
    return IsInteger(var)||IsFloat(var)
}
IsDigit(var) {
    return var~="^[[:digit:]]*$"
}
IsXDigit(var) {
    return var~="^(0x)?[[:xdigit:]]*$"
}
IsAlpha(var) {
    return var~="^[[:alpha:]]*$"
}
IsUpper(var) {
    return var~="^[[:upper:]]*$"
}
IsLower(var) {
    return var~="^[[:lower:]]*$"
}
IsAlNum(var) {
    return var~="^[[:alnum:]]*$"
}
IsSpace(var) {
    return var~="^[[:blank:]]*$"
}
IsTime(var) {
    return !(!IsDigit(var)||(StrLen(var)<4)||(StrLen(var)>14)
    ||((StrLen(var)>4)&&((SubStr(var,5,2)>12)||!SubStr(var,5,2)))
    ||((StrLen(var)>6)&&((SubStr(var,7,2)>31)||!SubStr(var,7,2)))
    ||((SubStr(var,9,2)>23)||(SubStr(var,11,2)>59)||(SubStr(var,13,2)>59))
    ||((SubStr(var,7,2)>30)&&((mod(SubStr(var,5,2),2)&&(SubStr(var,5,2)>7))||(!mod(SubStr(var,5,2),2)&&(SubStr(var,5,2)<7))))
    ||((SubStr(var,5,2) = 2)&&((SubStr(var,7,2)>29)||(mod(SubStr(var,1,4),4)&&(SubStr(var,7,2)>28)))))
}
IsDate(var) {
    return IsTime(var)
}
IsBetween(var,min,max) { ; Example --> IsBetween(250,10,300) --> True (250 is between 10 and 300)
	if (var<min)||(var>max)
		return false
return true
}
PosFloat(value) { ; If values is positive, it returns the same value. Otherwise it returns 0
	return (abs(value/2)+value/2)?StrLeft(value,StrLen(value)):false
}
RemZero(value) { ; removes zeros (and the point, if no value follow) at the END from float numbers
    ; Example: RemZero("12.000") --> 12   ,   RemZero("12.001") --> 12.001
return RegExReplace(value,"(\.0*$|\.$)")
}
hex2dec(value) { ; Hexadecimal to Decimal
    ; Example --> hex2dec("1A") = 26
return Format(value,16,10)
}
dec2hex(value,CutPrefix:=0) { ; Decimal to Hexadecimal
    ; Example 1 --> dec2hex(26) = 0x1A
    ; Example 2 --> dec2hex(26,1) = 1A  (Prefix is cut)
return CutPrefix?Format(value,10,16):"0x" . Format(value,10,16)
}
Format(value,from,to,ByRef ErrorMsg:="") {
; =================================================================================
; | Format.ahk (by Holle)
; |
; | Date: 2014/02/19
; |
; | Syntax: Format(Value , From , To [,ErrorMsg])
; | 
; | What does it do?
; | Format.ahk is able to convert every number systems. 
; | Because we have only 35 chars (numbers 0-9 and letters A-Z) it is not possible to replace every value with letters,
; | but you can use parenthesis with the value inside, instead a letter.
; | from and to can be a number or "b/bin/binary","d/dec/decimal","h/x/hex/hexadecimal","o/oct/octal" or "base...".
; |
; | Examples:
; | Format("12345","d","h") --> convert the decimal number "12345" to the hexadecimal number "3039" (WITHOUT "0x" !!!)
; | Format("12F","16","10") --> convert the hexadecimal number "12F" to the decimal number "303"
; | Format("10000","b","Base20") --> convert the binary number "10000" to the Base20 number "G"
; | Format("12(40)F","Base45","dec") --> convert the Base45 number "12(40)F" to the decimal number "96990". 
; |     Because there is no letter for "40" it is embedded in parenthesis, instead replace with a letter.
; | Format("12(40)F","Base35","dec") --> returns "nothing", because there is a error. To find the error, use this:
; | Format("12(40)F","Base35","dec", ErrorMsg)
; |     MsgBox %ErrorMsg%  --> Only numbers from 0-34 are available! --> Value = "12(40)F"
; |         OK, the Error is, that the embedded number "40" does not exist in Base35 
; |         (same like the letter "G" does not exist in Hexadecimal)
; |
; =================================================================================    
	if !value||!from||!to
        return (ErrorMsg:="Missing """ SubStr((!value?", value":"") (!from?", from":"") (!to?", to":""),3)"""")?"":""
	from:=SubStr(from,1,4)="base"?SubStr(from,5)+0:SubStr(from,1,1)="b"?2:SubStr(from,1,1)="o"?8:SubStr(from,1,1)="d"?10:(SubStr(from,1,1)="h")||(SubStr(from,1,1)="x")?16:from
	if !((from~="^\d+$")>0)
        return (ErrorMsg:="Unknown format (from = """ from """)")?"":""
	to:=SubStr(to,1,4)="base"?SubStr(to,5)+0:SubStr(to,1,1)="b"?2:SubStr(to,1,1)="o"?8:SubStr(to,1,1)="d"?10:(SubStr(to,1,1)="h")||(SubStr(to,1,1)="x")?16:to
	if !((to~="^\d+$")>0)
        return (ErrorMsg:="Unknown format (to = """ to """)")?"":""        
	value:=(from=16)&&(SubStr(value,1,2)="0x")?SubStr(value,3):value 	; cut prefix		
	if !(RegExReplace(value,"[\(\)]*","$1")~="^[[:alnum:]]*$")			; only AlNum is allowed ...and "()"
        return (ErrorMsg:="Value = """ value """ (only AlNum is allowed)")?"":""
	if ((from<11)&&!(RegExReplace(value,"[\(\)]*","$1")~="^\s*[\+\-]?((0x[0-9A-Fa-f]+)|\d+)\s*$"))
		return (ErrorMsg:="Value = """ value """, but only integer is possible, because from is """ from """.")?"":""
    con_letter:="ABCDEFGHIJKLMNOPQRSTUVWXYZ",result_dec:=0,length:=StrLen(value),counter:=0,parenthesis:=False
	loop,%length% {
		char:=SubStr(value,(length+1-A_Index),1) 						; calculate "backward" every char
        if (char=")") {                                           		; remember, we calculate "backward"
            if parenthesis
                return (ErrorMsg:="Parenthesis inside parenthesis is not allowed. --> Value = """  value """")?"":""
            parenthesis:=True                                     		; inside parenthesis
            Continue
        }
        else if (char="(") {											; remember, we calculate "backward"
            if !parenthesis
                return (ErrorMsg:="Left parenthesis without right parenthesis! --> Value = """  value """")?"":""
            parenthesis:=False,char:=par_char               			; outside parenthesis
            if !par_char&&(par_char!="0")
                return (ErrorMsg:="Parenthesis without content! --> Value = """  value """")?"":""
        }
        else if parenthesis {                                       	; inside parenthesis...
			if !(char~="^\s*[\+\-]?((0x[0-9A-Fa-f]+)|\d+)\s*$")
                return (ErrorMsg:="Only integer is allowed inside parenthesis! --> Value = """  value """")?"":""
            par_char:=char par_char 
            Continue
        }
		else if (char~="^[[:alpha:]]*$") {								; char is a letter
			char_pos:=InStr(con_letter,char)			          		; check position in "con_letter"
            StringReplace,char,char,%char%,%char_pos%   				; replace letter with the position
            char+=9	                                         			; und add 9      
            if (char>=from)
                return (ErrorMsg:="Only letters from A-" SubStr(con_letter,from -10,1) " are available! --> Value = """  value """")?"":""
        }
		char+=0															; convert to integer
        if (char>=from)
            return (ErrorMsg:="Only numbers from 0-" from-1 " are available! --> Value = """  value """")?"":""
        result_dec+=char*(from**counter),counter+=1  					; calculate from source to decimal
    }
    if (to=10)
        return result_dec                                  				; if destination = decimal
    result:=""                                               			; else calculate from decimal to destination system
    while (result_dec)
        char:=Mod(result_dec,to) 
		,char:=(char>35)?"(" char ")":(char>9)?SubStr(con_letter,(char-9),1):char 
		,result:=char result 
		,result_dec:=Floor(result_dec/to)
return result
}
} ; ************************************************************************************************************************


{ ; *********** Graphic-Functions ******************************************************************************************
PutImage(hwnd) { ; put a hBitmap into a hwnd
    global hBitmap
    SendMessage,0x172,0x0,hBitmap,,ahk_id %hwnd%
return
}
GetImage(hwnd) { ; get a hBitmap from a hwnd
  SendMessage,0x173,,,,ahk_id %hwnd%
return (ErrorLevel="FAIL"?0:ErrorLevel)
}
FadeText(text,Trans:=500,Speed:=4,FontSize:=0,Width:=0,Height:=0,X:=0,Y:=0,TextColor:="",BgColor:="",Borderless:=0,Font:="Arial")
{  
; =================================================================================
; | FadeText.ahk by Holle. Special thanks to "just me" for creating function "StrPixel()"
; |
; | Syntax: FadeText(Text , Trans , Speed , FontSize , Width , Height , X , Y , TextColor , BgColor , Boderderless, Font)
; | Defaults:   Trans = 250 , Speed = 5 , Fontsize = 18 , Width = 0 (auto) , Height = 0 (auto) , X = 0 (center) , Y = 0 (center) ,
; |             TextColor = "" (Black) , BgColor = "" (Grey) , Borderless = 0 (show border) , Font = "" (Arial)
; |
; | Tip: If the Width and the Height are specified and FontSize is 0 or "" then the FontSize will scale automatically.
; |
; | Examples:
; | FadeText("This is a Test." , Trans , Speed , FontSize , Width , X , Y , TextColor , BgColor , Boderderless, Font)
; | --> Generates a Fade-Text with default settings (when variables = "" or "0"), or with specified values if variables are defined.
; |
; | FadeText("This is a Test." ,,,,,,,,"Red","White",1)
; | --> Generate a Fade-Text with default "Trans/Speed/FontSize/X/Y/Font", but with red text on the white background without a border.
; |
; | FadeText("This is a Test." , 1300 , 8 , 12 , 300 , 50 , 50 , 50, "FFFFFF" , "Black" , 1, "Courier")
; | --> Generate a Fade-Text with specified values (with white text in Courier on the black background without a border).
; |
; | FadeText("This is a Test." , Trans := 300 , Speed := 8 , FontSize := 12 , Width := 300 , X := 50 , Y := 50 ,
; |                             TextColor := "White" , BgColor := "Black" , Borderless := 1 , Font := "Courier")
; | --> Same as above!
; |
; | FadeText("This is a Test." ,,8, FontSize := 12 , Width , X := 50 , 30 ,, "Red" , "MS Sans Serif")
; | --> Default Trans and Width (if 0 or ""), Speed = 8 , FontSize = 12 , X = 50 , Y = 30 , Background = red , Font = MS Sans Serif
; |
; =================================================================================
    Trans:=Trans<1?500:Trans>5000?5000:Trans     
    Speed:=Speed<1?4:Speed>20?20:Speed   
    Width:=Width<1?300:Width>A_ScreenWidth?A_ScreenWidth:Width
    ; calculate number of rows...
    RowNumber:=0
    row:=StrSplit(text,"`n")
    MaxFontSize:=1
    if !FontSize&&Width&&Height ; Scale FontSize to fit on BoxSize
        MaxFontSize:=200,FontSize:=1
    FontSize:=FontSize<1?18:FontSize>200?200:FontSize
    Loop,%MaxFontSize% {
        if (MaxFontSize>1)
            FontSizeBefore:=FontSize,RowNumberBefore:=RowNumber,FontSize:=a_index,RowNumber:=0
        Loop {
            RowNumber+=1
            if (StrPixel(row[A_Index],"s" FontSize,Font).width>Width-32)&&InStr(row[A_Index],A_Space) {
                string:=""
                documented:=""
                This_Row:=row[A_Index]
                Loop,Parse,This_Row,%A_Space%
                {
                    string.=A_Space A_LoopField
                    if (StrPixel(RegExReplace(string,"^\s?") , "s" FontSize, Font).width > Width - 16)
                        position:=InStr(string, A_LoopField ,-1)-1
                        ,documented.=SubStr(string,1,position) "`n"
                        ,RowNumber+=1
                        ,string:=A_LoopField
                }
            }
        } Until !row[A_Index]&&(A_Index>=row.MaxIndex())
        RowNumber-=1
        if !RowNumber
            RowNumber:=1  
        TextHeight:=StrPixel("H","s" FontSize,Font).height*RowNumber
        if (MaxFontSize>1)&&(((TextHeight+10)>Height)||(FontSize>200)) {
            TextHeight:=TextHeightBefore?TextHeightBefore:TextHeight
            FontSize:=FontSizeBefore
            RowNumber:=RowNumberBefore
            break
        }
        else
            TextHeightBefore:=TextHeight,RowNumberBefore:=RowNumber
    }
    TextHeight:=StrPixel("H","s" FontSize,Font).height*RowNumber
    Height:=Height<1?TextHeight:Height>A_ScreenHeight?A_ScreenHeight:Height
    X:=X<1?0:X>(A_ScreenWidth-Width-(Width/4 +16))?Round(A_ScreenWidth-Width-(Width/4+16)):X
    Y:=Y<1?0:Y>(A_ScreenHeight-Height-(Height/4+16))?Round(A_ScreenHeight-Height-(Height/4+16)):Y
    Parameter:="b zh0 c11 fs" FontSize
    Parameter:=Borderless?Parameter:"m2 " . Parameter
    Parameter.=Width?" w" Width:""
    Parameter.=Height?" h" Height " zy" Round((Height/2-TextHeight/2)*(A_ScreenDPI/96)):""
    Parameter.=X?" x" X:""
    Parameter.=Y?" y" Y:""
    Parameter.=TextColor?" CT" TextColor:""
    Parameter.=BgColor?" CW" BgColor:""
    global FadeTrans:=Trans,FadeSpeed:=Speed 
    Progress,%Parameter%,%text%,,Fade,%Font%
    ;~ TrayTip,, Da der Befehl Progress in AHK v2 entfernt wurde ist diese Funktion leider nicht mehr funktionsfähig :-(
    SetTimer,Fade,1
Return
}
StrPixel(Str,FontOptions,FontName) { ; by "just me"
    Gui,StrPixelDummyGUI:Font,%FontOptions%,%FontName%
    Gui,StrPixelDummyGUI:Add,Text,hwndHTX,%Str%
    GuiControlGet,S,StrPixelDummyGUI:Pos,%HTX%
    Gui,StrPixelDummyGUI:Destroy
    result:={width:SW,height:SH}
Return result
}
Fade:
{
    WinSet,Transparent,%FadeTrans%,Fade
    FadeTrans-=%FadeSpeed%
    if (FadeTrans<0)
        SetTimer,Fade,off
Return
}
} ; ************************************************************************************************************************


{ ; *********** Debug-Functions ********************************************************************************************
GetTimer() { ; Based on scripts from "corrupt" and "Lexikos"    
    ; ============================================================================================
    ; | GetTimer.ahk
    ; |
    ; | Date	: 	2013 / 11 / 14
    ; |
    ; | Author 	: 	Holle (this function based on the scripts from "corrupt" and "Lexikos")
    ; |				Original thread: http://www.autohotkey.com/board/topic/20925-listvars/#entry156570
    ; |
    ; | Examples: 	GetTimer().total  	-->  total timer (integer)
    ; |				GetTimer().active	-->  active timer (integer)
    ; |				GetTimer().names	-->  timer names (string, seperated by space)
    ; |
    ; ============================================================================================
    dhw:=A_DetectHiddenWindows
    DetectHiddenWindows,On
    HidWin:=WinExist(A_ScriptFullPath " - AutoHotkey v")
    OldPar:=DllCall("GetParent",UInt,HidWin)
    GUI +LastFound
    DllCall("SetParent",UInt,HidWin,UInt,WinExist("ahk_class Shell_TrayWnd"))
    WinMenuSelectItem ahk_id %HidWin%,,View,Key
    Sleep,0
    ControlGetText,text,Edit1,ahk_id %HidWin%
    WinHide ahk_id %HidWin%
    DllCall("SetParent",UInt,HidWin,UInt,OldPar)
    DetectHiddenWindows,%dhw%
    RegExMatch(text,"Enabled\sTimers\:\s(\d+)\sof\s(\d+)\s\((.*)\)",hit)
    timer:={active:hit1,total:hit2,names:hit3}
    StringSplit,name,hit3,%A_Space%
    loop, %hit1%
        timer[a_index]:=name%a_index%
    Return timer
}
StdErr_Write(LineNumber,text,spec:="") { ; from Lexikos , edit by Holle
; ============================================================================================
; | StdErr_Write(A_LineNumber,ErrorMessage[,Specifically])
; |
; | Date    :   2013 / 12 / 12
; |
; | Author  :   "Lexikos" (edited by Holle: "Use the same format like the other error messages" ...testet with SciTE4AutoHotkey Version 3.0.04)
; |             Original thread: http://www.autohotkey.com/board/topic/50306-can-a-script-write-to-stderr/?hl=errorstdout#entry314658
; |
; | Examples:   StdErr_Write(A_LineNumber,"This function needs pairs of parameter.","odd number")
; |             month<1||month>12?StdErr_Write(A_LineNumber,"The variable month must have a value between 1 and 12.","month := " month)
; |
; ============================================================================================
    text:=A_ScriptFullPath " (" LineNumber ") : ==>  " . text
    text.=spec?"`n     Specifically: " spec "`n":""
    if A_IsUnicode
        return StdErr_Write_("astr",text,StrLen(text))
return StdErr_Write_("uint",&text,StrLen(text))
}
StdErr_Write_(type,data,size) { ; from Lexikos
    static STD_ERROR_HANDLE:=-12
    if (hstderr:=DllCall("GetStdHandle","uint",STD_ERROR_HANDLE))=-1
        return false
	try DllCall("WriteFile","uint",hstderr,type,data,"uint",size,"uint",0,"uint",0)
return
}
} ; ************************************************************************************************************************


{ ; *********** String-Functions *******************************************************************************************
StringParts(string,count,delimiter:=" ") {
    ; Example 1 --> StringParts("ABCDEFGHIJKLMNOP", 6) 	    -->  "ABCDEF GHIJKL MNOP"
    ; Example 2 --> StringParts("ABCDEFGHIJKLMNOP", 4, "|") -->  "ABCD|EFGH|IJKL|MNOP"    
    CharCount:=StrLen(string),Position:=1
    Loop {
        StringParts.=SubStr(string,Position,count) . delimiter
        Position+=count
    } Until (Position>=CharCount)
return StringParts
}
StringChain(char,count) {
    ; Example 1 --> StringChain("1A", 3) --> "1A1A1A"
    ; Example 2 --> StringChain("x", 10) --> "xxxxxxxxxx"
    Loop,%count%
        string.=char
return string
}
StrTrimLeft(string,count) { ; Example --> StrTrimLeft("This is a test", 2)  --> "is is a test"
    Return SubStr(string,count+1)
}
StrTrimRight(string,count) { ; Example --> StrTrimRight("This is a test", 3)  --> "This is a t"
    Return SubStr(string,1,StrLen(string)-count)
}
StrLeft(string,count) { ; Example --> StrLeft("This is a test", 4)  --> "This"
    Return SubStr(string,1,count)
}
StrRight(string,count) { ; Example --> StrRight("This is a test", 4)  --> "test"
    Return SubStr(string,StrLen(string)-count+1,count)
}
StrLower(string,T:="") { 
    ; Example 1 --> StrLower("GONE with the WIND")  --> "gone with the wind"
    ; example 2 --> StrLower("GONE with the WIND","T")  --> "Gone With The Wind"
    StringLower,result,string,%T%
Return result
} 
StrUpper(string,T:="") { 
    ; Example 1 --> StrUpper("GONE with the WIND")  --> "GONE WITH THE WIND"
    ; Example 2 --> StrUpper("GONE with the WIND","T")  --> "Gone With The Wind"
    StringUpper,result,string,%T%
Return result
} 
StrMid(string,start,count,L:="") { 
    ; Example 1 --> StrMid("This is a test",6,4) --> "is a"  (6 to right, from there 4 to right)
    ; Example 2 --> StrMid("This is a test",6,4,"L")   --> "is i"  (6 to right, from there 4 to LEFT)
    Return L?SubStr(string,start-count+1,count):SubStr(string,start,count)
} 
StrReplace(string,chars,CaseSensetive:=0) { ;  use "\," for literal ","
; Example --> StrReplace("Hello", "H,B,o,a") --> "Bella"
	char:=StrSplit(RegExReplace(chars,"\\,","¸"),",") 
    if mod(char.MaxIndex(),2)
        ExitApp StdErr_Write(A_LineNumber,"StrReplace() needs pairs of parameter.","odd number (" char.MaxIndex() ")")
	loop,parse,string
	{
		StrPart:=A_LoopField,ParNum:=1
		while(ParNum<char.MaxIndex())
			Char[ParNum]:=RegExReplace(Char[ParNum],"¸",",") 
			,replace:=IsContains(Char[ParNum],"\,.,*,?,+,[,{,|,(,),^,$")?"\" Char[ParNum]:Char[ParNum]
			,with:=RegExReplace(Char[ParNum+1],"¸",","),ParNum += 2 
			,StrPart:=RegExReplace(StrPart,CaseSensetive?replace:"i)" replace,with)
		result.=StrPart
	}
return Result
}
StrCount(Haystack,Needle,CaseSensitive:=false) { 
    ; Example 1 --> StrCount("This is the Haystack","h")     --> 3 (position 2 + 10 + 13)
    ; Example 2 --> StrCount("This is the Haystack","h",1)   --> 2 (position 2 + 10) because "Case Sensitive"
	count:=0,startpos:=Instr(HayStack,Needle,CaseSensitive,1)
	while(startpos)
		count+=1,startpos:=Instr(Haystack,Needle,CaseSensitive,startpos+1)
return count
}
IsIn(Haystack,Needle) { ; Example --> IsIn("Test", "Blubb,Test,Blubber") --> True
	Needle:=StrSplit(Needle,",")
	loop,% Needle.MaxIndex()
		if (HayStack=Needle[A_Index])
            return True
return False
}
IsContains(Haystack,Needle) { ; Example --> IsContains("Test.txt", ".txt,.doc,.rtf") --> True
	Needle:=StrSplit(Needle,",")
	loop,% Needle.MaxIndex()
		if InStr(HayStack,Needle[A_Index])
            return True
return False
}
IsTextFile(FileName) { ; Example --> IsTextFile(FileName) --> Returns Encoding if the file contains text, else returns "0"
	File:=FileOpen(FileName,"r"),Encoding:=File.Encoding,FileSize:=File.Length,File.Close()
    If InStr(Encoding,"UTF-")
        Return Encoding
    FileRead,Text,%FileName%
	return StrLen(text)==FileSize?Encoding:0
}
Send(string) { ; Example --> Send(block?"AE":"ae") --> send "AE" if block true, or "ae" if Block false
    send %string%
return
}
} ; ************************************************************************************************************************


{ ; *********** System-Functions *******************************************************************************************
GetSystemLanguage() {
    languageCode_0436:="Afrikaans"
    languageCode_041c:="Albanian"
    languageCode_0401:="Arabic_Saudi_Arabia"
    languageCode_0801:="Arabic_Iraq"
    languageCode_0c01:="Arabic_Egypt"
    languageCode_1001:="Arabic_Libya"
    languageCode_1401:="Arabic_Algeria"
    languageCode_1801:="Arabic_Morocco"
    languageCode_1c01:="Arabic_Tunisia"
    languageCode_2001:="Arabic_Oman"
    languageCode_2401:="Arabic_Yemen"
    languageCode_2801:="Arabic_Syria"
    languageCode_2c01:="Arabic_Jordan"
    languageCode_3001:="Arabic_Lebanon"
    languageCode_3401:="Arabic_Kuwait"
    languageCode_3801:="Arabic_UAE"
    languageCode_3c01:="Arabic_Bahrain"
    languageCode_4001:="Arabic_Qatar"
    languageCode_042b:="Armenian"
    languageCode_042c:="Azeri_Latin"
    languageCode_082c:="Azeri_Cyrillic"
    languageCode_042d:="Basque"
    languageCode_0423:="Belarusian"
    languageCode_0402:="Bulgarian"
    languageCode_0403:="Catalan"
    languageCode_0404:="Chinese_Taiwan"
    languageCode_0804:="Chinese_PRC"
    languageCode_0c04:="Chinese_Hong_Kong"
    languageCode_1004:="Chinese_Singapore"
    languageCode_1404:="Chinese_Macau"
    languageCode_041a:="Croatian"
    languageCode_0405:="Czech"
    languageCode_0406:="Danish"
    languageCode_0413:="Dutch_Standard"
    languageCode_0813:="Dutch_Belgian"
    languageCode_0409:="English_United_States"
    languageCode_0809:="English_United_Kingdom"
    languageCode_0c09:="English_Australian"
    languageCode_1009:="English_Canadian"
    languageCode_1409:="English_New_Zealand"
    languageCode_1809:="English_Irish"
    languageCode_1c09:="English_South_Africa"
    languageCode_2009:="English_Jamaica"
    languageCode_2409:="English_Caribbean"
    languageCode_2809:="English_Belize"
    languageCode_2c09:="English_Trinidad"
    languageCode_3009:="English_Zimbabwe"
    languageCode_3409:="English_Philippines"
    languageCode_0425:="Estonian"
    languageCode_0438:="Faeroese"
    languageCode_0429:="Farsi"
    languageCode_040b:="Finnish"
    languageCode_040c:="French_Standard"
    languageCode_080c:="French_Belgian"
    languageCode_0c0c:="French_Canadian"
    languageCode_100c:="French_Swiss"
    languageCode_140c:="French_Luxembourg"
    languageCode_180c:="French_Monaco"
    languageCode_0437:="Georgian"
    languageCode_0407:="German_Standard"
    languageCode_0807:="German_Swiss"
    languageCode_0c07:="German_Austrian"
    languageCode_1007:="German_Luxembourg"
    languageCode_1407:="German_Liechtenstein"
    languageCode_0408:="Greek"
    languageCode_040d:="Hebrew"
    languageCode_0439:="Hindi"
    languageCode_040e:="Hungarian"
    languageCode_040f:="Icelandic"
    languageCode_0421:="Indonesian"
    languageCode_0410:="Italian_Standard"
    languageCode_0810:="Italian_Swiss"
    languageCode_0411:="Japanese"
    languageCode_043f:="Kazakh"
    languageCode_0457:="Konkani"
    languageCode_0412:="Korean"
    languageCode_0426:="Latvian"
    languageCode_0427:="Lithuanian"
    languageCode_042f:="Macedonian"
    languageCode_043e:="Malay_Malaysia"
    languageCode_083e:="Malay_Brunei_Darussalam"
    languageCode_044e:="Marathi"
    languageCode_0414:="Norwegian_Bokmal"
    languageCode_0814:="Norwegian_Nynorsk"
    languageCode_0415:="Polish"
    languageCode_0416:="Portuguese_Brazilian"
    languageCode_0816:="Portuguese_Standard"
    languageCode_0418:="Romanian"
    languageCode_0419:="Russian"
    languageCode_044f:="Sanskrit"
    languageCode_081a:="Serbian_Latin"
    languageCode_0c1a:="Serbian_Cyrillic"
    languageCode_041b:="Slovak"
    languageCode_0424:="Slovenian"
    languageCode_040a:="Spanish_Traditional_Sort"
    languageCode_080a:="Spanish_Mexican"
    languageCode_0c0a:="Spanish_Modern_Sort"
    languageCode_100a:="Spanish_Guatemala"
    languageCode_140a:="Spanish_Costa_Rica"
    languageCode_180a:="Spanish_Panama"
    languageCode_1c0a:="Spanish_Dominican_Republic"
    languageCode_200a:="Spanish_Venezuela"
    languageCode_240a:="Spanish_Colombia"
    languageCode_280a:="Spanish_Peru"
    languageCode_2c0a:="Spanish_Argentina"
    languageCode_300a:="Spanish_Ecuador"
    languageCode_340a:="Spanish_Chile"
    languageCode_380a:="Spanish_Uruguay"
    languageCode_3c0a:="Spanish_Paraguay"
    languageCode_400a:="Spanish_Bolivia"
    languageCode_440a:="Spanish_El_Salvador"
    languageCode_480a:="Spanish_Honduras"
    languageCode_4c0a:="Spanish_Nicaragua"
    languageCode_500a:="Spanish_Puerto_Rico"
    languageCode_0441:="Swahili"
    languageCode_041d:="Swedish"
    languageCode_081d:="Swedish_Finland"
    languageCode_0449:="Tamil"
    languageCode_0444:="Tatar"
    languageCode_041e:="Thai"
    languageCode_041f:="Turkish"
    languageCode_0422:="Ukrainian"
    languageCode_0420:="Urdu"
    languageCode_0443:="Uzbek_Latin"
    languageCode_0843:="Uzbek_Cyrillic"
    languageCode_042a:="Vietnamese"
return languageCode_%A_Language%  ; Return the name of the system's default language.
}
MsgBox(Text,Title:="",Option:=0) {
    ; Example:  pressed := MsgBox("Yes, No, or Cancel?","Continue?",35)
    ;           MsgBox((MsgBoxResult="CANCEL")||(MsgBoxResult="NO")?"Exit because " pressed " was pressed!":"Continue because YES was pressed","What now?")
    
	;---Options---
	;0 = OK
	;1 = OK/Cancel
	;2 = Abort/Retry/Ignore
	;3 = Yes/No/Cancel 
	;4 = Yes/No
	;5 = Retry/Cancel
	;6 = Cancel/Try Again/Continue
	;...add following for a icon/style/default button
	;16 = Icon Hand (stop/error)
	;32 = Icon Question
	;48 = Icon Exclamation
	;64 = Icon Asterisk (info)
	;256 = default 2nd button default
	;512 = default 3rd button default
	;4096 = System Modal (always on top)
	;8192 = Task Modal
	;16384 = Adds a Help button
	;262144 = like System Modal but omits title bar icon (style WS_EX_TOPMOST)
	;524288 = Make the text right-justified
	;1048576 = Right-to-left reading order for Hebrew/Arabic
	ErrorID:=DllCall("MessageBox","Ptr",0,"Str",text,"Str",title,"UInt",option)
	pressed:=ErrorID=1?"OK":ErrorID=2?"CANCEL":ErrorID=3?"ABORT":ErrorID=4?"RETRY":ErrorID=5?"IGNORE":ErrorID=6?"YES":ErrorID=7?"NO":ErrorID=10?"TRYAGAIN":ErrorID=11?"CONTINUE":""
return pressed
}
} ; ************************************************************************************************************************
 
HollesLib_weiter: ; Sprungmarke, damit diese Library am anfang eines Scripts includiert werden kann.
{ ; Nötig, damit nachfolgende Funktionen nicht als Teil dieses Labels angesehen werden
}
Edit: Fehler in StrReplace behoben
Last edited by Holle on 16 May 2014, 05:53, edited 3 times in total.
Johnny R
Posts: 235
Joined: 03 Oct 2013, 02:07

Re: Holles Library

10 Apr 2014, 09:23

Auf einem anderen PC klappt es bei mir jetzt auch... Sieht gut aus! Danke.
User avatar
SL5
Posts: 339
Joined: 12 May 2015, 02:10
GitHub: sl5net
Contact:

Re: Holles Library

08 Jun 2015, 05:23

ich hab mal eine Funktionsübersicht dieser prima Lib erstellt.

der wichtigste Reguläre Ausdruck dabei war:
(^\w+\([^\)]*\))\s*\{[^}]*\} Vielleicht sind ja Fehler drin in meiner Übersicht ( Erstellprozess hier: youtu.be/f1XGZZzDcgQ ).

;*****************
; Holles_Lib.ahk *
; *** funktions - overview
IsBinary(var)
IsInteger(var)
IsFloat(var)
IsNumber(var)
IsDigit(var)
IsXDigit(var)
IsAlpha(var)
IsUpper(var)
IsLower(var)
IsAlNum(var)
IsSpace(var)
IsTime(var)
IsDate(var)
IsBetween(var,min,max)
PosFloat(value)
RemZero(value)
hex2dec(value)
dec2hex(value,CutPrefix:=0)
Format(value,from,to,ByRef ErrorMsg:="")
PutImage(hwnd)
GetImage(hwnd)
FadeText(text,Trans:=500,Speed:=4,FontSize:=0,Width:=0,Height:=0,X:=0,Y:=0,TextColor:="",BgColor:="",Borderless:=0,Font:="Arial")
StrPixel(Str,FontOptions,FontName)
GetTimer()
StringParts(string,count,delimiter:=" ")
StringChain(char,count)
StrTrimLeft(string,count)
StrTrimRight(string,count)
StrLeft(string,count)
StrRight(string,count)
StrLower(string,T:="")
StrUpper(string,T:="")
StrMid(string,start,count,L:="")
StrReplace(string,chars,CaseSensetive:=0)
StrCount(Haystack,Needle,CaseSensitive:=false)
IsIn(Haystack,Needle)
IsContains(Haystack,Needle)
IsTextFile(FileName)
Send(string)
GetSystemLanguage()
MsgBox(Text,Title:="",Option:=0)

Return to “Skripte und Funktionen”

Who is online

Users browsing this forum: No registered users and 2 guests