Jump to content

how to call a built-in AutoIt function dynamically


 Share

Recommended Posts

  • Moderators

hi everyone,

as we known call() is only used for calling a user-defined function , but how to call for a built-in function?

execept if ...endif or select...endselect, any other method?

any advise is welcome. thx in advance

1. Why would you want to use "Call" << Built in function itself, to call a built in function?

2. The only way I can think of is put it in its own function.

Call('__MsgBox', 64, 'Information', 'Here is your text', 5)

Func __MsgBox($Param1, $Param2, $Param3, $Param4)
    Return MsgBox($Param1, $Param2, $Param3, $Param4)
EndFunc

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

but how to call for a built-in function?

not possible. From help file of Call()

Remarks

The function cannot be a built-in AutoIt function or plug-in function.

Why would you want to do that?

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Link to comment
Share on other sites

as we known call() is only used for calling a user-defined function , but how to call for a built-in function?

I guess I understand it now. Maybe you think you have to call a user function with Call(). That's NOT the case.

Func test()
   MsgBox(0,"","I'm in test")
EndFunc

;- now just call test with it's name. No need for Call()

test()

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Link to comment
Share on other sites

  • Moderators

I guess I understand it now. Maybe you think you have to call a user function with Call(). That's NOT the case.

Func test()
   MsgBox(0,"","I'm in test")
EndFunc

;- now just call test with it's name. No need for Call()

test()
God help us if we hadn't covered them all thus far :whistle:
Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Hm.. maybe we should just wait for an answer from Mr. Mac Table.

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Link to comment
Share on other sites

thx all, i am sorry, i think i should describe my question more details.

i would like to write a simple script for some automations. for example:

;software installation

RunWait ("installer.exe") ;run a installer

RunWait("regedit.exe /s " & "setting.reg") ;import registry

;other window operation

RunWait("my_program")

WinWinActivate("my_program")

ControlCommand(...)

ControlClick(...)

but i do want to hard coding the above in .au3 script, so i would like to define those actions in an another config (.ini) file,

ini key = action (function) , and ini value = function parameters which separete by "|"

for example:

[install_xxx]

RunWait = installer.exe

RunWait = regedit.exe /s "setting.reg"

[other_window_operation0

RunWait = my_program

WinWinActivate = my_program

ControlCommand = window_tiltle | control_id | command

ControlClick = window_tiltle | control_id

then, my script could read this ini filem, then re-generate commands, and execute one by one.

although autoit has eval() function but does not works like my expect.

any idea? thx in advance!

Link to comment
Share on other sites

but i do want to hard coding the above in .au3 script, so i would like to define those actions in an another config (.ini) file,

ini key = action (function) , and ini value = function parameters which separete by "|"

Hm.. read INI file, write all AU3 commands into another file and run that with /AutoIt3ExecuteScript (see help file: Autoit -> Using AutoIT -> Running Scripts).

Edited by /dev/null

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Link to comment
Share on other sites

Hm.. read INI file, write all AU3 commands into another file and run that with /AutoIt3ExecuteScript (see help file: Autoit -> Using AutoIT -> Running Scripts).

i see.

do you have any suggestion how to get result (return value) from another script? by save return value to file or by system environment value?

Link to comment
Share on other sites

i see.

do you have any suggestion how to get result (return value) from another script? by save return value to file or by system environment value?

many ways: Registry keys, files, Exit codes (see Exit()), .....

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...