Jump to content

Multi Processing support (not quite sure what to call it)


Tioner
 Share

Recommended Posts

hey everyone, I'm not quite new here, I've been reading topics and looking for help here and there, but never really posted.

so my question is that I want to make a program that would work on multiple processes and execute the same functions, it would be hard so I came up with an idea of first writing down all the processes with ProcessList() and then saving them in a txt file with F and T (T = taken, F = free) next to the PID.

I made an array with these numbers and I wanted to assign PIDs to the program, but the problem came in when I created a 2D array, I searched for F and it returned the position of F in the array, while I wanted to get the position of the whole array, so I can extract the PID from it and use it for the program. it's been really a pain to get it to work and so far no success. I'm hoping you guys can help me, here's the code:

#include 
#include 
$test = msgbox(1,"Test","Do you want to save the processlist to the text file?")
if $test = 1 Then
$array = Processlist("Notepad.exe")
filedelete("PID.txt")
for $i = 1 To $array[0][0]
Filewrite("PID.txt",$array[$i][1] &",F" & @CRLF)
Next
EndIf
$PIDs = _FileCountLines("PID.txt")
Local $Array2[$PIDs], $arraycheck[$PIDs][$PIDs]
_FileReadToArray("PID.txt",$array2)
local $arrayPID[$PIDs]
for $i = 1 to $PIDs
$arrayPID[$i-1] = filereadline("PID.txt", $i)
Next
local $arraycheck[$PIDs][$PIDs]
for $i = 1 to $PIDs
$arraycheck[$i-1][$i-1] = StringSplit($array2[$i],",")
Next
Local $arrays[$PIDs]
for $i = 1 to $PIDs
$arrays[$i-1] = _ArraySearch($arraycheck[$i-1][$i-1],"F")
Next
_ArrayDisplay($arraycheck[1][1])

I know it's a mess, I tried different things and nothing really helped. I just hope I missed something that you can point out and I can just get over with it.

thanks for any kind of support!

Link to comment
Share on other sites

I want to make a program that would work on multiple processes and execute the same functions

Can you please tell us what you try to achieve with your script? Which functions do you want to execute on the processes?

Your script looks overly complicated. Maybe there is an easier way.

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

Thanks for a quick reply!

First I would like to make a script that would write down PIDs and let me run multiple autoit scripts so that they dont mess eachother's work. As you may have noticed, if there's more than one process with the same name, autoit will execute itself on the earliest one created. I want it to let me run few autoit executables and they would work on one process each. all of them would pick one for themself. if that doesnt make sense, let me know, it's kinda hard for me to explain.

Link to comment
Share on other sites

What do you want to do with each process?

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

Thanks again for blazing fast reply!

its nothing complicated, it's a backup program, I want it to open multiple browsers and download all my backups from my friend's website, to make it faster I want to run multiple autoit scripts. all of them are different, but I wanted to include a multipid support. and it's all about fun I guess. I actually came up with this idea when I was bored today, but then I had some issues.....

Edited by Tioner
Link to comment
Share on other sites

If you want to run multiple downloads in parallel you could use function InetGet and run all the downloads in the background. This way you can do all the work in one script.

Edited by water

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

no, not quite, it's dsm 4.0 (diskstation filemanager). um.. it looks like a desktop and kinda behaves like one. and yes, there are multiple other things I could do to make the download go faster, but somehow the multi PID thing caught my eye and I wanted to take a look at it. maybe someone could use it later for something else :P and hey I like challenges :)

Link to comment
Share on other sites

If you need to stay with the multi-PID approach I think you don't need to save the PIDs to a file.

Have script A start dsm multiple times using function Run. Run starts the program and returns the PID. Use function Run to start script B and pass the PID as parameter and then start the next dsm.

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

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