Jump to content

Start Script through other Script(Advanced)


Recommended Posts

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~

 

Link to comment
Share on other sites

  • Developers

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

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

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~

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

  • Developers

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

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

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

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...