Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Commands as Functions


  • Please log in to reply
21 replies to this topic
SAPlayer
  • Members
  • 403 posts
  • Last active: Apr 11 2014 04:45 PM
  • Joined: 06 Nov 2012

Aber wenn man dann sowas aufruft:

 

if(abc := MyFunc1() AND def := MyFunc2() AND ghi := MyFunc3())
  MsgBox, Yes

Hat man am Ende nur noch das ErrorLevel von MyFunc3().

 

Mit ErrorLevel im Array könnte man dann schauen:

if(abc := MyFunc1() AND def := MyFunc2() AND ghi := MyFunc3() AND !abc["ErrorLevel"] AND !def["ErrorLevel"] AND !ghi["ErrorLevel"])
  MsgBox, Yes


Alibaba
  • Members
  • 435 posts
  • Last active: Nov 19 2014 04:21 PM
  • Joined: 01 Nov 2012
Mhh... SAPlayers Lösung mit dem Extra Array item gefällt mir besser, die ist kürzer. ;D
Ich werde versuchen die ganzen Vorschläge heute noch umzusetzen, wenn ich genug Zeit dazu finde!

Find the recent autohotkey version here: ahkscript.org


nnnik
  • Members
  • 1625 posts
  • Last active: Jan 24 2019 02:19 PM
  • Joined: 28 Jul 2012
Class Execute
{
__new()
{
this.func2:={}
this.func3:=[]
this.executors:={}
this.noinit:=1
}
__set(var1,var2)
{
if this.noinit
{
if this.executors[var1,"nr"]
{
this.executors[var1,this.executors[var1,"nr"]]:=var2    
this.executors[var1,"nr"]++
}
else
{
this.executors[var1]:={"nr":2,1:var2}
}
return
}
}
__call(var,p*)
{
StringLower, var, var
if this.func2[var]
{
var2:=[]
var2[1]:=this.func2[var]
var2[2]:=p
return var2
}    
If IsFunc(var) ; wenn man diesen Teil rausstreicht
{ ;bleiben nur noch die Funktionen die man in this.func3 und this.func2 vordefiniert hat.
var2:=[]
this.func3.insert(func(var))
var2[1]:=this.func2[var]:=this.func3.maxindex()
var2[2]:=p
return var2
}
if IsObject(this.executors[var])
{
loop,% this.executors[var,"nr"]-2
{
v:=this.func3[this.executors[var,A_Index,1]]
v2:=this.executors[var,A_Index,2]
v.(v2*)
}
v:=this.func3[this.executors[var,this.executors[var,"nr"]-1,1]]
v2:=this.executors[var,this.executors[var,"nr"]-1,2]
return v.(v2*)
}    
}
}
 
 
;Benuztung:

obj:= new execute()
obj.2msgboxes:=obj.msgbox("Hallo")
obj.2msgboxes:=obj.DllCall("MessageBox", "Int", "0", "Str", "Nochmal Hallo", "Str", "Titel der Box", "Int", 4) ;in das Execute object halt noch die Funktion
obj.GetactiveID:=obj.WinActive("A")
msgbox("Die Id des Aktiven Fensters ist : " obj.GetactiveID() ".`nSie haben " ((obj.2msgboxes()=6)? "ja" : "nein") " gedrückt.")

Das kannst du ja noch mal reinbauen...

Ich habs zurückgehalten, da ich dachte das Polythemes Funktionen verschollen wären.(AutoHotkey.net)

Obwohl es nur so kurz ist hat es ganz schön Power.


Visit the new forum ahkscript.org.

http://ahkscript.org


Alibaba
  • Members
  • 435 posts
  • Last active: Nov 19 2014 04:21 PM
  • Joined: 01 Nov 2012

Update

Befehle mit einem "InputVar"-Parameter, benötigen jetzt nicht mehr den Variablennamen als String, sondern die direkte Variable.

Und Arrays bekommen das extra "Errorlevel"-Item.


Find the recent autohotkey version here: ahkscript.org


Alibaba
  • Members
  • 435 posts
  • Last active: Nov 19 2014 04:21 PM
  • Joined: 01 Nov 2012

Gui Befehl hinzugefügt.

Beim Parameter "Sub_command" kann man den Namen des GUI mit einem Doppelpunkt voranstellen, also syntaxmäßig genau wie beim normalen Gui-Befehl.

 

Zum Beispiel:

Gui("Name:Show", "w200 h100", "Test")

Find the recent autohotkey version here: ahkscript.org


fredchf
  • Members
  • 111 posts
  • Last active: Oct 23 2019 07:56 PM
  • Joined: 02 Nov 2012

Hallo!

Ich hätte da mal einen Vorschlag für die Funktion MsgBox:



MsgBox(Options="", Title="", Text="", Timeout="")
{
	If !(Title . Text . Timeout)
        MsgBox, %Options%
    Else
        MsgBox, % Options, % Title, % Text, % Timeout
    IfMsgBox, Yes
        return "Yes"
    IfMsgBox, No
        return "No"
    IfMsgBox, OK
        return "OK"
    IfMsgBox, Cancel
        return "Cancel"
    IfMsgBox, Abort
        return "Abort"
    IfMsgBox, Ignore
        return "Ignore"
    IfMsgBox, Retry
        return "Retry"
    IfMsgBox, Timeout
        return "Timeout"
    Return
}

 

 



Alibaba
  • Members
  • 435 posts
  • Last active: Nov 19 2014 04:21 PM
  • Joined: 01 Nov 2012
Ja gute Idee.

Find the recent autohotkey version here: ahkscript.org