Sign in to follow this  
Followers 0
AlienStar

call exe's functions ???!!!!

14 posts in this topic

#1 ·  Posted (edited)

hello everybody

I made a script like this :

while ProcessExists("explorer.exe") = True 
    sleep(50)
WEnd
;------------------------------------------------------------------
func goingon()
    MsgBox(4096, "Test", "This box will time out in 10 seconds", 10)
EndFunc

I used that loop to make the script running only

and its name is file.exe

how can I call this function via another script ??

I did this :

Run("file.exe /goingon()")

but nothing happened and also file.exe run again (the second script is near file.exe) but I don't wanna that .

please help me

Edited by AlienStar

Share this post


Link to post
Share on other sites



Unless I'm mistaken - you can include other scripts with this:

#include "123456789.AU3"

Anyone correct me if I'm wrong, but that's the way I've included scripts into others and so far - no bugs..

Just make sure the path of the files are the same ;)

Share this post


Link to post
Share on other sites

You should pass command line arguments to your script, and based on the command line argument you can call the function in a proper way.

Share this post


Link to post
Share on other sites

can you explain more about this ?

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

This is my lesson learned for the day if Im right on this.

Am to understand that, based on the code in the OP post I could get the msgbox to appear from command line with something like "c:\path\file.exe /goingon()" ?

EDIT: Booooo No I cant.

Thought it sounded to easy to be true ;)

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

Yay, lesson lerned

while ProcessExists("explorer.exe") = True 
    If $CmdLine[0] >0 Then
        If $CmdLine[1] = "goingon" Then goingon()
    EndIf   
    sleep(50)
WEnd
;------------------------------------------------------------------
func goingon()
    MsgBox(4096, "Test", "This box will time out in 10 seconds", 10)
EndFunc

C:\Path\File.exe goingon


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

thanks so so much teacher JohnOne

but there is one thing not OK

I used While loop to let my script running all time waiting for calling

but when I call it in this way it runs again but closing after doing the function

I wanna call it from processes not from location

just not to run the script again

and thanks so much for help

Edited by AlienStar

Share this post


Link to post
Share on other sites

Add a Return 1 to the end of your goingon() function, that should return the script to it's former position when the function quits.

while ProcessExists("explorer.exe") = True 
    If $CmdLine[0] >0 Then
        If $CmdLine[1] = "goingon" Then goingon()
    EndIf   
    sleep(50)
WEnd
;------------------------------------------------------------------
func goingon()
    MsgBox(4096, "Test", "This box will time out in 10 seconds", 10)
    Return 1
EndFunc

Share this post


Link to post
Share on other sites

You shouldn't have the If statement inside the While loop. That should have been obvious. If you loop something, it gets called over and over.

Share this post


Link to post
Share on other sites

@LaNiZ , @Richard Robertson

thanks for you but I wanna it as I wrote

now please : how can I call it without running the script again ???

Share this post


Link to post
Share on other sites

#AutoIt3Wrapper_Change2CUI=y

ConsoleWrite("Compiled: " & @TAB & @COMPILED & @CRLF & "CMDLine: " & @TAB & $CMDLineRaw & @CRLF)

Execute($CMDLineRaw)

Func HitTest()
    ConsoleWrite("Success!" & @CRLF)
    Sleep (1000)
EndFunc   ;==>HitTest

Compile that using au3Wrapper and then run something like this:

Run (@ScriptDir & "\Example.exe HitTest()")

Share this post


Link to post
Share on other sites

@LaNiZ , @Richard Robertson

thanks for you but I wanna it as I wrote

now please : how can I call it without running the script again ???

Search for Inter-process communication or something like that. I usually use CoProc.au3

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

@Mat

I used JohnOne's code and that's I wanna ;)

@AdmiralAlkex

I've downloaded CoProc.au3 and read its topic but I couldn't use it in my purpose

can you help me with that ???

Edited by AlienStar

Share this post


Link to post
Share on other sites

no problem if it's not possible to do that

thanks so much for everybody help or try to help me

;):evil::evil:

Share this post


Link to post
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
Sign in to follow this  
Followers 0