Jump to content
RaiNote

Start Script through other Script(Advanced)

Recommended Posts

RaiNote

Hello :3

How to make that an Script start another special Script which can only be started through this other script not manual 

The 2 Scripts are compiled but only the main can be started manual.

The other must be started through the other and can't be started manual but if it gets that the main Programm gets closed it will instantly close.

And If in the 2nd Script is an Array how can that be loaded through the first Script?

I hope i formulated it well to understand ^-^.

Thanks.

P.S: A Cat loves fish.


  • C++/AutoIt/OpenGL Easy Coder
  • I will be Kind to you and try to help you
  • till what you want isn't against the Forum
  • Rules~

 

Share this post


Link to post
Share on other sites
Jos

Shell script2 with an expected commandline parameter which contains the initial scripts PID and keep on monitoring that during execution of script2.

Simply exit script2 in case this expected commandline parameter isn't there.
 

Jos

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
RaiNote

But How would this command line look and at all i don't get all of it.^^


  • C++/AutoIt/OpenGL Easy Coder
  • I will be Kind to you and try to help you
  • till what you want isn't against the Forum
  • Rules~

 

Share this post


Link to post
Share on other sites
Bowmore

This very basic example shows one method. It's not 100% but for someone to start the second script manually they would have to know the key value and know you were using this method.

;Script 1
$key = '{B9E447D4-1706-419A-8077-007D39897225}'
Run('C:\code\test\script2.exe ' & $key)

While 1
    Sleep(10)
wend




;Script 2
$key = '{B9E447D4-1706-419A-8077-007D39897225}'
If $CmdLine[0] < 1 Then Exit ; No key provided
If $CmdLine[1] <> $key = '{B9E447D4-1706-419A-8077-007D39897225}' Then Exit ; Invalid key provided


While 1
    Sleep(10)
wend

 


"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Share this post


Link to post
Share on other sites
RaiNote

Oh thank you very much so it was that easy :o.

Ima stupid cat :3


  • C++/AutoIt/OpenGL Easy Coder
  • I will be Kind to you and try to help you
  • till what you want isn't against the Forum
  • Rules~

 

Share this post


Link to post
Share on other sites
water

Shouldn't this line

If $CmdLine[1] <> $key = '{B9E447D4-1706-419A-8077-007D39897225}' Then Exit ; Invalid key provided

read

If $CmdLine[1] <> $key Then Exit ; Invalid key provided

 


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
Jos

Add the PID like this:

Run('C:\code\test\script2.exe ' & $key & " " & @AutoItPID)

.. and add something like this to your second script

AdlibRegister("Check_Parent",1000)

Func Check_Parent()
    If Not ProcessExists($CmdLine[2]) then Exit
EndFunc

Jos

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Bowmore

Shouldn't this line

If $CmdLine[1] <> $key = '{B9E447D4-1706-419A-8077-007D39897225}' Then Exit ; Invalid key provided

read

If $CmdLine[1] <> $key Then Exit ; Invalid key provided

 

​It most certainly should.


"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

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

×