Is there any way to create a function dynamically? Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
User
Posts: 407
Joined: 26 Jun 2017, 08:12

Is there any way to create a function dynamically?

30 Dec 2018, 23:02

Example below,

Function_Name := "Test"

%Function_Name%()
{

}
User avatar
Delta Pythagorean
Posts: 567
Joined: 13 Feb 2017, 13:44
GitHub: DelPyth
Location: Somewhere in the US

Re: Is there any way to create a function dynamically?

31 Dec 2018, 00:05

As of currently. No. Functions are set in stone as it is.
You can, however, CALL the function dynamically:

Code: Select all

CallFunc := "FunctionNames"
MsgBox, % [CallFunc]()

FunctionNames() {
	Return, True
}

- [AHK].......: 1.1.33.02 Unicode 64-bit
- [OS].........: Windows 10.0.18362
- [GITHUB]...: github.com/DeltaPyth
- [PAYPAL]....: paypal.me/DelPyth
- [DISCORD]..: Delta#3324

Remember to use [code]CODE[/code] for your multi-line scripts.
Stay safe, stay inside, and remember to wash your hands for 20 seconds!
User
Posts: 407
Joined: 26 Jun 2017, 08:12

Re: Is there any way to create a function dynamically?

31 Dec 2018, 10:17

Delta Pythagorean wrote:
31 Dec 2018, 00:05
As of currently. No. Functions are set in stone as it is.
Really bad, unfortunately!
A_AhkUser
Posts: 1126
Joined: 06 Mar 2017, 16:18
GitHub: AAhkUser
Location: France

Re: Is there any way to create a function dynamically?

31 Dec 2018, 13:10

Hi User,

Check out function%myvar%().

As DeltaPythagorean stated I'm pretty sure you only can call a function dynamically.

Btw @DeltaPythagorean I think you had in view a dynamic call of a method:

Code: Select all

CallFunc := "MethodName"
MsgBox, % C[CallFunc]()

Class C {
	MethodName() {
		Return, True
	}
}
my scripts
FanaticGuru
Posts: 1435
Joined: 30 Sep 2013, 22:25

Re: Is there any way to create a function dynamically?

31 Dec 2018, 19:51

User wrote:
30 Dec 2018, 23:02
Example below,

Function_Name := "Test"

%Function_Name%()
{

}
Not sure of your end game but you could create the function code dynamically then either execute it through a pipe or add it to your function library.

Code: Select all

Function_Name := "TestFunc"

Code = 
(
%Function_Name%()
{
	MsgBox I am here!
}
)

MsgBox % Code
Once you have the code in a variable like that there is various ways to execute it or make it available for use.

But nothing is going to be as simple as your example. Functions are defined when the script is being interperted before anything is actual executed in the script. Function_Name has no value when the interpreter is setting that function up for use by the script to be executed after the code is pre-processed.

FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts

AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon

[Function] Timer - Create and Manage Timers
User avatar
kczx3
Posts: 1143
Joined: 06 Oct 2015, 21:39

Re: Is there any way to create a function dynamically?

31 Dec 2018, 21:06

Why would you need such a thing?
User
Posts: 407
Joined: 26 Jun 2017, 08:12

Re: Is there any way to create a function dynamically?

31 Dec 2018, 22:59

Delta Pythagorean wrote:
31 Dec 2018, 00:05
As of currently. No. Functions are set in stone as it is.
A_AhkUser wrote:
31 Dec 2018, 13:10
As DeltaPythagorean stated I'm pretty sure you only can call a function dynamically.

Well, it seems that it is easy to implement "function dynamic creation"! example below:

93_ image.gif
93_ image.gif (1.39 MiB) Viewed 2297 times

Code: Select all

Script =
(join`r`n

xxx := "111"

 yyy := "222"

	zzz := "333"

;ttt := "44444"

gui, add, text, , `%`%xxx`%`%  `%`%yyy`%`%  `%`%zzz`%`%  `%`%;ttt`%`%

;_________

gui, add, text, w300 h200, Left click anywhere in this window

gui, show

return

guiclose:	;__
exitapp

;___________


;Function_Name := "Test"

`%`%;Function_Name`%`%()		;__________________________________________________
{
Static RunAtScriptExecution := OnMessage(0x201, Func("`%`%;Function_Name`%`%"))	;"0x201" left mouse down

Static count := 0

tooltip, `% A_ThisFunc "() - " count++, 0, 100, 1
}

   ;Function_Name := "First"

   `%`%;Function_Name`%`%()		;__________________________________________________
   {
   Static RunAtScriptExecution := OnMessage(0x201, Func("`%`%;Function_Name`%`%"))	;"0x201" left mouse down

   Static count := 1

   tooltip, `% A_ThisFunc "() - " count++, 0, 125, 2
   }



	;Function_Name := "Last"

	`%`%;Function_Name`%`%()		;__________________________________________________
	{
	Static RunAtScriptExecution := OnMessage(0x201, Func("`%`%;Function_Name`%`%"))	;"0x201" left mouse down

	Static count := 2

	tooltip, `% A_ThisFunc "() - " count++, 0, 150, 3
	}

)


Temp_Script_File_Name := "#_AHK_Temp_Pre_Edited_Script.ahk"

gui,add, button, gPreRunScript, Pré-Edit and Run Script

gui, add, button, x+5 gShowPreEdScript, show Pre-Edited code

gui, add, edit, xm w800 h600 +HScroll +HwndUserInputControlId, % Script

gui, show

return

ShowPreEdScript:	;___________________________________

ControlGetText, UserScript, , % "ahk_id" UserInputControlId

gui ShowPreEdScript:default

gui, destroy

gui, add, edit, w700 h500 +HScroll +HwndPreEdScriptOut,

ControlSetText , , % Pre_Edit_Script(UserScript), % "ahk_id" PreEdScriptOut

gui, show

return

PreRunScript:	;_________________________________________

ControlGetText, UserScript, , % "ahk_id" UserInputControlId

FileDelete, % Temp_Script_File_Name

FileAppend , % Pre_Edit_Script(UserScript), % Temp_Script_File_Name

run, % Temp_Script_File_Name

return

guiclose:	;_________________________________________
exitapp


RegExEsc(String, Options := "")		;_________ RegExEsc(Function) - v1.0 __________
{

if (Options == "$")
return, RegExReplace(String, "\$", "$$$$")	;to be used with "RegExReplace" third parameter! ("$$" represents one literal "$")

return, "\E\Q" RegExReplace(String, "\\E", "\E\\E\Q") "\E"	;to be used with "RegExMatch" and "RegExReplace" second parameters! ("\\" represents one literal "\")

}


Pre_Edit_Script(Script)		;_______________ v1.1 _________________
{

Pre_Vars := []

	MatchLength := 0
	FoundPos := 1
	loop
	{
	FoundPos := RegExMatch(Script, "(?P<Set>(\n| |\t)(?P<Key>\S+?)( |\t)*?:=( |\t)*?""(?P<Value>.*?)"")|(?P<Rep>%%(?P<Var>\S+?)%%)", Match_, FoundPos + MatchLength)

	;\s, Matches any single whitespace character, mainly space, tab, and newline (`r and `n)
	;"(\n| |\t)" in use because "\s" does not work correctly!
	;\S, means "any non-whitespace character".

		if (FoundPos == "" or FoundPos = 0)
		break
		else
		{

			if (Match_ = Match_Set)
			{
			Pre_Vars[Match_Key] := Match_Value

			MatchLength := StrLen(Match_)

				;msgbox, % Match_Set " - " Match_Key " / " Match_Value
			}
			else if (Match_ = Match_Rep)
			{
			Script := RegExReplace(Script, RegExEsc(Match_Rep), RegExEsc(Pre_Vars[Match_Var], "$"), , 1, FoundPos)

			MatchLength := StrLen(Pre_Vars[Match_Var])

				;msgbox, % Match_Rep " - " Match_Var
			}
		
		}
	}


return, Script 
}
just me
Posts: 7228
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Is there any way to create a function dynamically?

01 Jan 2019, 07:38

LOL, good joke!
User
Posts: 407
Joined: 26 Jun 2017, 08:12

Re: Is there any way to create a function dynamically?

01 Jan 2019, 10:04

just me wrote:
01 Jan 2019, 07:38
LOL, good joke!
Hahahahahahahahahahahahahahahahahahahahahahahahahahahahahaha!
User
Posts: 407
Joined: 26 Jun 2017, 08:12

Re: Is there any way to create a function dynamically?

01 Jan 2019, 12:08

(v1.2)

++Var Operator supported now! (This can be used, for example, to create Anonymous Functions, etc, etc, etc)!

92_ Image.gif
92_ Image.gif (1.44 MiB) Viewed 2199 times

Code: Select all

Script =
(join`r`n

xxx := "111"

 yyy := "222"

	zzz := "333"

;ttt := "44444"

gui, add, text, , `%`%xxx`%`%  `%`%yyy`%`%  `%`%zzz`%`%  `%`%;ttt`%`%

gui, add, text, , `%`%++Count`%`%  `%`%++Count`%`%  `%`%++Count`%`%  -  `%`%Count`%`%  `%`%Count`%`%  `%`%Count`%`%

gui, add, text, , `%`%++UniqueId`%`%  `%`%++UniqueId`%`%  -  `%`%UniqueId`%`%  `%`%UniqueId`%`%

;_________

gui, add, text, w300 h200, Left click anywhere in this window

gui, add, button, gRunAnonymousFunctions, Run Anonymous Functions

gui, show

return

RunAnonymousFunctions:	;__

Anonymous_Function`%`%++UniqueId`%`%()
Anonymous_Function`%`%UniqueId`%`%()
{
msgbox, `% A_ThisFunc
}

Anonymous_Function`%`%++UniqueId`%`%()
Anonymous_Function`%`%UniqueId`%`%()
{
msgbox, `% A_ThisFunc
}

Anonymous_Function`%`%++UniqueId`%`%()
Anonymous_Function`%`%UniqueId`%`%()
{
msgbox, `% A_ThisFunc
}

return

guiclose:	;__
exitapp

;___________


;Function_Name := "Test"

`%`%;Function_Name`%`%()		;__________________________________________________
{
Static RunAtScriptExecution := OnMessage(0x201, Func("`%`%;Function_Name`%`%"))	;"0x201" left mouse down

Static count := 0

tooltip, `% A_ThisFunc "() - " count++, 0, 200, 1
}

   ;Function_Name := "First"

   `%`%;Function_Name`%`%()		;__________________________________________________
   {
   Static RunAtScriptExecution := OnMessage(0x201, Func("`%`%;Function_Name`%`%"))	;"0x201" left mouse down

   Static count := 1

   tooltip, `% A_ThisFunc "() - " count++, 0, 225, 2
   }



	;Function_Name := "Last"

	`%`%;Function_Name`%`%()		;__________________________________________________
	{
	Static RunAtScriptExecution := OnMessage(0x201, Func("`%`%;Function_Name`%`%"))	;"0x201" left mouse down

	Static count := 2

	tooltip, `% A_ThisFunc "() - " count++, 0, 250, 3
	}

)


Temp_Script_File_Name := "#_AHK_Temp_Pre_Edited_Script.ahk"

gui,add, button, gPreRunScript, Pré-Edit and Run Script

gui, add, button, x+5 gShowPreEdScript, show Pre-Edited code

gui, add, edit, xm w800 h600 +HScroll +HwndUserInputControlId, % Script

gui, show

return

ShowPreEdScript:	;___________________________________

ControlGetText, UserScript, , % "ahk_id" UserInputControlId

gui ShowPreEdScript:default

gui, destroy

gui, add, edit, w700 h500 +HScroll +HwndPreEdScriptOut,

ControlSetText , , % Pre_Edit_Script(UserScript), % "ahk_id" PreEdScriptOut

gui, show

return

PreRunScript:	;_________________________________________

ControlGetText, UserScript, , % "ahk_id" UserInputControlId

FileDelete, % Temp_Script_File_Name

FileAppend , % Pre_Edit_Script(UserScript), % Temp_Script_File_Name

run, % Temp_Script_File_Name

return

guiclose:	;_________________________________________
exitapp


RegExEsc(String, Options := "")		;_________ RegExEsc(Function) - v1.0 __________
{

if (Options == "$")
return, RegExReplace(String, "\$", "$$$$")	;to be used with "RegExReplace" third parameter! ("$$" represents one literal "$")

return, "\E\Q" RegExReplace(String, "\\E", "\E\\E\Q") "\E"	;to be used with "RegExMatch" and "RegExReplace" second parameters! ("\\" represents one literal "\")

}


Pre_Edit_Script(Script)		;_______________ v1.2 _________________
{

Pre_Vars := []

	MatchLength := 0
	FoundPos := 1
	loop
	{
	FoundPos := RegExMatch(Script, "(?P<Set>(\n| |\t)(?P<Key>\S+?)( |\t)*?:=( |\t)*?""(?P<Value>.*?)"")|(?P<Rep>%%(?P<Var>\S+?)%%)", Match_, FoundPos + MatchLength)

	;\s, Matches any single whitespace character, mainly space, tab, and newline (`r and `n)
	;"(\n| |\t)" in use because "\s" does not work correctly!
	;\S, means "any non-whitespace character".

		if (FoundPos == "" or FoundPos = 0)
		break
		else
		{

			if (Match_ = Match_Set)
			{
			Pre_Vars[Match_Key] := Match_Value

			MatchLength := StrLen(Match_)

				;msgbox, % Match_Set " - " Match_Key " / " Match_Value
			}
			else if (Match_ = Match_Rep)
			{
				if RegExMatch(Match_Var, "^\+\+(.+)", Found_Var)
				{
					;msgbox, % Match_Var " / " Found_Var1

				Match_Var := Found_Var1

				Match_Var_Value := Pre_Vars[Match_Var]

				if Match_Var_Value is number
				Pre_Vars[Match_Var]++
				else
				Pre_Vars[Match_Var] := 0
				}

			Script := RegExReplace(Script, RegExEsc(Match_Rep), RegExEsc(Pre_Vars[Match_Var], "$"), , 1, FoundPos)

			MatchLength := StrLen(Pre_Vars[Match_Var])

				;msgbox, % Match_Rep " - " Match_Var
			}
		
		}
	}


return, Script 
}
swagfag
Posts: 3973
Joined: 11 Jan 2017, 17:59

Re: Is there any way to create a function dynamically?

01 Jan 2019, 14:50

how is any of this "create a function dynamically"? ur script boils down to:

Code: Select all

script =
(
myfunc()
myfunc() {
	MsgBox look ma`, dynamik fankshuns! 
}
)

FileDelete C:\dyn.ahk
FileAppend % script, C:\dyn.ahk
Run C:\dyn.ahk
where is the dynamicness?
User avatar
kczx3
Posts: 1143
Joined: 06 Oct 2015, 21:39

Re: Is there any way to create a function dynamically?

01 Jan 2019, 19:51

It’s really just pre-compiled scripts using AHK as the compiler.
SOTE
Posts: 1057
Joined: 15 Jun 2015, 06:21

Re: Is there any way to create a function dynamically?

01 Jan 2019, 21:15

I'm confused by the purpose of a "dynamic function" as well. The only thing that I can think of that makes sense is if you are trying to have your script adapt to unknown conditions.

In the example of what swagfag showed, it was to have the script rewrite itself upon meeting a particular condition. However, if your main script has variables with functions to execute when a particular condition is met, then needing to rewrite itself would seem usually unnecessary. You could simply store numerous functions at the bottom of your script, which are then called by if-statements.

I can also understand what FantasicGuru is doing, which is similar to what swagfag showed. Have multiple functions placed in multiple variables, so that if a particular condition is met, then a particular variable and function is selected. And, it doesn't really have to be functions within variables. It can just as easily be subroutines called by various variables, which meet criteria within if-statements.

To me, "dynamicness" would be like the script searching for a function that is not listed within itself, when it gets an unexpected result or when an error occurs. Possibly do a directory and then a computer wide search of functions in .ahk files and/or .dlls. When a function is found, copy the function or dll call (though dllcalls are way more problematic) into a variable, then test the function and see if it can achieve the result. Possibly, do the test virtually, as to not cause any problems on the computer or any permanent changes yet. Upon getting the result it desired (virtually), then the script writes a new version of itself with the new function or dllcall (less likely to succeed), and uses the newly written version of itself to solve the problem.

I think that would be one hell of a script, that would arguably border on AI level, but might be worthwhile to try and particularly for an automation based language.
User
Posts: 407
Joined: 26 Jun 2017, 08:12

Re: Is there any way to create a function dynamically?  Topic is solved

03 Jan 2019, 00:04

(Pre-Editor v1.0)

Now I can finally write ahk scripts smoothly, nicely, easily, and of course, dynamically!

Thanks for All your HELP!!!



Basically, set windows to always run ".ahkpe" extension files with "Pre-Editor.exe"

- Example, run "Test.ahkpe"

- "Pre-Editor.exe" will automatically pre-edit script from "Test.ahkpe" file

- "Pre-Editor.exe" will store the pre-edited script in "Test.ahkpe.ahk" file! (in the same directory of "Test.ahkpe")

- "Pre-Editor.exe" then executes "Test.ahkpe.ahk", and exit!

- "Test.ahkpe.ahk" itself will delete "Test.ahkpe.ahk" file

Pre-Editor (v1.0).rar
(344.52 KiB) Downloaded 33 times
(the ".rar" file contains "Pre-Editor" script compiled - Pre-Editor.exe - and "Test.ahkpe")


Image


Pre-Editor

Code: Select all

Cmd_Total_Parameters = %0%

Cmd_Parameter := []

loop, % Cmd_Total_Parameters
Cmd_Parameter[a_index] := %a_index%

if (Cmd_Parameter[1] != "")
{
	;msgbox, % Cmd_Parameter[1]

FileRead, File_Content, % Cmd_Parameter[1]	;"Cmd_Parameter[1]" contains the file path

File_Extension := ".ahk"

FileDelete, % Cmd_Parameter[1] File_Extension

Pre_Edited_Script := "FileDelete, % A_ScriptName `r`n`r`n"

Pre_Edited_Script .= Pre_Edit_Script(File_Content)

FileAppend, % Pre_Edited_Script, % Cmd_Parameter[1] File_Extension, UTF-8	;"UTF-8" same Encoding used by ".ahk" files

run, % Cmd_Parameter[1] File_Extension

exitapp
}


;______________________________

App_Title := "Pre-Editor"

App_Version := "1.0"

;______________________________


Script =
(join`r`n

xxx := "111"

 yyy := "222"

	zzz := "333"

;ttt := "44444"

gui, add, text, , `%`%xxx`%`%  `%`%yyy`%`%  `%`%zzz`%`%  `%`%;ttt`%`%

gui, add, text, , `%`%++Count`%`%  `%`%++Count`%`%  `%`%++Count`%`%  -  `%`%Count`%`%  `%`%Count`%`%  `%`%Count`%`%

gui, add, text, , `%`%++UniqueId`%`%  `%`%++UniqueId`%`%  -  `%`%UniqueId`%`%  `%`%UniqueId`%`%

;_________

gui, add, text, w300 h200, Left click anywhere in this window

gui, add, button, gRunAnonymousFunctions, Run Anonymous Functions

gui, show

return

RunAnonymousFunctions:	;__

Anonymous_Function`%`%++UniqueId`%`%()
Anonymous_Function`%`%UniqueId`%`%()
{
msgbox, `% A_ThisFunc
}

Anonymous_Function`%`%++UniqueId`%`%()
Anonymous_Function`%`%UniqueId`%`%()
{
msgbox, `% A_ThisFunc
}

Anonymous_Function`%`%++UniqueId`%`%()
Anonymous_Function`%`%UniqueId`%`%()
{
msgbox, `% A_ThisFunc
}

return

guiclose:	;__
exitapp

;___________


;Function_Name := "Test"

`%`%;Function_Name`%`%()		;__________________________________________________
{
Static RunAtScriptExecution := OnMessage(0x201, Func("`%`%;Function_Name`%`%"))	;"0x201" left mouse down

Static count := 0

tooltip, `% A_ThisFunc "() - " count++, 0, 200, 1
}

   ;Function_Name := "First"

   `%`%;Function_Name`%`%()		;__________________________________________________
   {
   Static RunAtScriptExecution := OnMessage(0x201, Func("`%`%;Function_Name`%`%"))	;"0x201" left mouse down

   Static count := 1

   tooltip, `% A_ThisFunc "() - " count++, 0, 225, 2
   }



	;Function_Name := "Last"

	`%`%;Function_Name`%`%()		;__________________________________________________
	{
	Static RunAtScriptExecution := OnMessage(0x201, Func("`%`%;Function_Name`%`%"))	;"0x201" left mouse down

	Static count := 2

	tooltip, `% A_ThisFunc "() - " count++, 0, 250, 3
	}

)


Temp_Script_File_Name := "#_AHK_Temp_Pre_Edited_Script.ahk"

gui,add, button, gPreRunScript, Pré-Edit and Run Script

gui, add, button, x+5 gShowPreEdScript, show Pre-Edited code

gui, add, edit, xm w800 h600 +HScroll +HwndUserInputControlId, % Script

gui, show, , % App_Title " (v" App_Version ")"

return

ShowPreEdScript:	;___________________________________

ControlGetText, UserScript, , % "ahk_id" UserInputControlId

gui ShowPreEdScript:default

gui, destroy

gui, add, edit, w700 h500 +HScroll +HwndPreEdScriptOut,

ControlSetText , , % Pre_Edit_Script(UserScript), % "ahk_id" PreEdScriptOut

gui, show

return

PreRunScript:	;_________________________________________

ControlGetText, UserScript, , % "ahk_id" UserInputControlId

FileDelete, % Temp_Script_File_Name

FileAppend , % Pre_Edit_Script(UserScript), % Temp_Script_File_Name

run, % Temp_Script_File_Name

return

guiclose:	;_________________________________________
exitapp


RegExEsc(String, Options := "")		;_________ RegExEsc(Function) - v1.0 __________
{

if (Options == "$")
return, RegExReplace(String, "\$", "$$$$")	;to be used with "RegExReplace" third parameter! ("$$" represents one literal "$")

return, "\E\Q" RegExReplace(String, "\\E", "\E\\E\Q") "\E"	;to be used with "RegExMatch" and "RegExReplace" second parameters! ("\\" represents one literal "\")

}


Pre_Edit_Script(Script)		;_______________ v1.2 _________________
{

Pre_Vars := []

	MatchLength := 0
	FoundPos := 1
	loop
	{
	FoundPos := RegExMatch(Script, "(?P<Set>(\n| |\t)(?P<Key>\S+?)( |\t)*?:=( |\t)*?""(?P<Value>.*?)"")|(?P<Rep>%%(?P<Var>\S+?)%%)", Match_, FoundPos + MatchLength)

	;\s, Matches any single whitespace character, mainly space, tab, and newline (`r and `n)
	;"(\n| |\t)" in use because "\s" does not work correctly!
	;\S, means "any non-whitespace character".

		if (FoundPos == "" or FoundPos = 0)
		break
		else
		{

			if (Match_ = Match_Set)
			{
			Pre_Vars[Match_Key] := Match_Value

			MatchLength := StrLen(Match_)

				;msgbox, % Match_Set " - " Match_Key " / " Match_Value
			}
			else if (Match_ = Match_Rep)
			{
				if RegExMatch(Match_Var, "^\+\+(.+)", Found_Var)
				{
					;msgbox, % Match_Var " / " Found_Var1

				Match_Var := Found_Var1

				Match_Var_Value := Pre_Vars[Match_Var]

				if Match_Var_Value is number
				Pre_Vars[Match_Var]++
				else
				Pre_Vars[Match_Var] := 0
				}

			Script := RegExReplace(Script, RegExEsc(Match_Rep), RegExEsc(Pre_Vars[Match_Var], "$"), , 1, FoundPos)

			MatchLength := StrLen(Pre_Vars[Match_Var])

				;msgbox, % Match_Rep " - " Match_Var
			}
		
		}
	}


return, Script 
}

test.ahkpe

Code: Select all

xxx := "111"

 yyy := "222"

	zzz := "333"

;ttt := "44444"

gui, add, text, , %%xxx%%  %%yyy%%  %%zzz%%  %%;ttt%%

gui, add, text, , %%++Count%%  %%++Count%%  %%++Count%%  -  %%Count%%  %%Count%%  %%Count%%

gui, add, text, , %%++UniqueId%%  %%++UniqueId%%  -  %%UniqueId%%  %%UniqueId%%

;_________

gui, add, text, w300 h200, Left click anywhere in this window

gui, add, button, gRunAnonymousFunctions, Run Anonymous Functions

gui, show

return

RunAnonymousFunctions:	;__

Anonymous_Function%%++UniqueId%%()
Anonymous_Function%%UniqueId%%()
{
msgbox, % A_ThisFunc
}

Anonymous_Function%%++UniqueId%%()
Anonymous_Function%%UniqueId%%()
{
msgbox, % A_ThisFunc
}

Anonymous_Function%%++UniqueId%%()
Anonymous_Function%%UniqueId%%()
{
msgbox, % A_ThisFunc
}

return

guiclose:	;__
exitapp

;___________


;Function_Name := "Test"

%%;Function_Name%%()		;__________________________________________________
{
Static RunAtScriptExecution := OnMessage(0x201, Func("%%;Function_Name%%"))	;"0x201" left mouse down

Static count := 0

tooltip, % A_ThisFunc "() - " count++, 0, 200, 1
}

   ;Function_Name := "First"

   %%;Function_Name%%()		;__________________________________________________
   {
   Static RunAtScriptExecution := OnMessage(0x201, Func("%%;Function_Name%%"))	;"0x201" left mouse down

   Static count := 1

   tooltip, % A_ThisFunc "() - " count++, 0, 225, 2
   }



	;Function_Name := "Last"

	%%;Function_Name%%()		;__________________________________________________
	{
	Static RunAtScriptExecution := OnMessage(0x201, Func("%%;Function_Name%%"))	;"0x201" left mouse down

	Static count := 2

	tooltip, % A_ThisFunc "() - " count++, 0, 250, 3
	}

Return to “Ask For Help”

Who is online

Users browsing this forum: boiler, doubledave22, MannyKSoSo, vr4life and 37 guests