Jump to content

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


Recommended Posts

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
Link to comment
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 ;)

Link to comment
Share on other sites

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.

Link to comment
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.

Link to comment
Share on other sites

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
Link to comment
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
Link to comment
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()")
Link to comment
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
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...