njkone Posted November 6, 2017 Posted November 6, 2017 Hi, sorry for My English, I would Like to create a simple script2.exe child that return a generic number value in script1 father and read this value through stdoutread(). What can i write in script2.exe to return the value? Thanks guys
Earthshine Posted November 6, 2017 Posted November 6, 2017 I felt like after reading that the first time. sorry, there is a return statement that you use to return values from functions good day. https://www.autoitscript.com/autoit3/docs/keywords/Func.htm My resources are limited. You must ask the right questions
Danyfirex Posted November 6, 2017 Posted November 6, 2017 (edited) If is a Integer Number you can use Exit. App 1 retuns number. Exit 12345 App 2 Get the number Local $iNumber=ShellExecuteWait("App1.exe") Saludos Edited November 6, 2017 by Danyfirex Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut
njkone Posted November 6, 2017 Author Posted November 6, 2017 Thanks for reply my script2.exe contain this code #include <Array.au3> #include <GUIConstants.au3> #include <MsgBoxConstants.au3> #include <AutoItConstants.au3> #include <Constants.au3> While 1 for $y=150 to 630 $emay=PixelGetColor(736,$y) $emay2=PixelGetColor(739,$y) $emay3=PixelGetColor(742,$y) $emay4=PixelGetColor(744,$y) $emay5=PixelGetColor(746,$y) $emay6=PixelGetColor(748,$y) $emay7=PixelGetColor(750,$y) $emay8=PixelGetColor(752,$y) if $emay>15800000 or $emay2>15800000 or $emay3>15800000 or $emay4>15800000 or $emay5>15800000 or $emay6>15800000 or $emay7>15800000 or $emay8>15800000 Then $y -= 25 EndIf Next WEnd can i return the $y value ? in main program this is the code: $pid=Run("script2.exe","",$STDOUT_CHILD) Sleep(500) $out=StdoutRead($pid)
Danyfirex Posted November 6, 2017 Posted November 6, 2017 I meant this. ;Child Script Local $iY=Random(-100,100,1) Exit $iY ;father Script Local $iY=ShellExecuteWait("child.exe") MsgBox(0,"","Y value returned from Child: " & $iY) Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut
njkone Posted November 6, 2017 Author Posted November 6, 2017 yes i understand, how can i return the $y form the while loop childr process?
Danyfirex Posted November 6, 2017 Posted November 6, 2017 Read help File. Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut
njkone Posted November 6, 2017 Author Posted November 6, 2017 ok, but i go not know what to look in the help file. i'd like to know what function i can use in the child process to return value and in the fhater process to read value, but not close the process child. thank you all.
Danyfirex Posted November 6, 2017 Posted November 6, 2017 mmm I see. Probably you need another way. Do a google search about comunication between procress. There is many examples around the forum. Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut
njkone Posted November 6, 2017 Author Posted November 6, 2017 i tried solutions before opening the topic but i did not find anything. i expect other answers, do not have other choice. thank you all.
BrewManNH Posted November 6, 2017 Posted November 6, 2017 Search for IPC or Inter Process Communication in the forum. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator
njkone Posted November 6, 2017 Author Posted November 6, 2017 thank you for the reply, i tried ipc but is very complicated for me. in summary i need a way to communicate 2 process, the child process contains the value and the father process read this value(in the child), for more times (loop). is there a simple way? example : send message from child to father? message= number value.
RTFC Posted November 6, 2017 Posted November 6, 2017 Trancexx's MailSlot is one of the simplest ways of achieving IPC. My Contributions and Wrappers Spoiler BitMaskSudokuSolver BuildPartitionTable CodeCrypter CodeScanner DigitalDisplay Eigen4AutoIt FAT Suite HighMem MetaCodeFileLibrary OSgrid Pool RdRand SecondDesktop SimulatedAnnealing Xbase I/O
njkone Posted November 6, 2017 Author Posted November 6, 2017 thank you for reply, i need to receive a single variable automatically from children to father. do you think i can change it for my purpose?
BrewManNH Posted November 6, 2017 Posted November 6, 2017 Write to a file from the child, read it from the parent process if everything else is more than you need. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator
njkone Posted November 6, 2017 Author Posted November 6, 2017 2 hours ago, BrewManNH said: Write to a file from the child, read it from the parent process if everything else is more than you need. do you refer to the way MailSlot? or other?
RTFC Posted November 7, 2017 Posted November 7, 2017 8 hours ago, njkone said: do you refer to the way MailSlot? No. Look up Iniwrite and IniRead in the Help file, if you don't want to use MailSlot. My Contributions and Wrappers Spoiler BitMaskSudokuSolver BuildPartitionTable CodeCrypter CodeScanner DigitalDisplay Eigen4AutoIt FAT Suite HighMem MetaCodeFileLibrary OSgrid Pool RdRand SecondDesktop SimulatedAnnealing Xbase I/O
njkone Posted November 7, 2017 Author Posted November 7, 2017 Thanks man. It works Perfect and rapid. Solved.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now