Jump to content

Read from an array and concatenate


Maxwin
 Share

Recommended Posts

I am totally new to AutoIT, need a small help. Currently, Iam trying to automate the work which i do everyday manually so as to save time.

In the code here below, I am have launch a program called as Wireshark in cmd prompt.

A folder present on C drive has many pcaps (kind of files that Wireshark understands).

The help that i required is i want to send the contents (files) of the folder to (example)

Example: Send("tshark.exe -r C;\Rtfpcaps\google.rtf.pcap)

For this i had listed all the files in an Array but when i pop them out i cannot get them in the format as shown in the example stated above.

PS: Array has many pcaps:- google,7f56ce915dc6be782681464cc62a6588.rtf.pcap,

7f5d3c5ab6621bbacde0c14719d2e0c7.rtf.pcap,8cf4cb2bd4531c82c57b81abb293be86.rtf.pcap.etc

Thanks for the help in advance

#include<File.au3>

#include<Array.au3>

Run("cmd")

WinWaitActive("C:\WINDOWS\system32\cmd.exe")

send("Cd C:\Program Files\Wireshark")

send("{Enter}")

$a=_FileListToArray("C:\Rtfpcaps")

While UBound($a)

Send("tshark.exe -r C:\Rtfpcaps\")

_ArrayPop($a)

send("{Enter}")

WEnd

Link to comment
Share on other sites

Can't you use function

Run("C:\Program Files\Wireshark\tshark.exe -r " & <Your filename goes here>, "C:\Rtfpcaps")
for every file you need to 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

What I mean is:

If you can process one file as I described above then you can process them all.

Populate an array with all the files you need to process (as you ahve done with _FileListToArray) and then loop throught the array and process one by one.

I would replace Run with RunWait so not to start 2000 processes at the same time.

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