-
Recently Browsing 0 members
No registered users viewing this page.
-
Similar Content
-
By Colduction
Hi again guys!, i had COVID-19 for twice and i couldn't check the forum since 3 or 4 months ago till now! i hope you will get better if you're fighting for beat COVID-19
I have two question, first is about extracting all of the IP Address from an IP Ranges, for e.g: 192.168.1.1-192.255.255.255 (Start and End are variable and will be defined by the user) and for second one, i have a friend that he is Python programmer, he made a IP Parser that it can support large txt files (1TB) and it can parse all of them under 10min and it also supports low-end PCs that have 1 GB RAM!
The list that his program parses are:
#1765497 192.168.1.1 8082 #1765496 192.168.1.1 8084 #1965493 192.168.1.1 8089 #9565495 192.168.1.1 8086 #2565492 192.168.1.1 8081 and it converts very very fast to this:
192.168.1.1:8082 192.168.1.1:8084 192.168.1.1:8089 192.168.1.1:8086 192.168.1.1:8081 I wonder how to do this via AutoIt, if you can help me in this way, i will be happy✌❤
Thanks for your helps.
FIRST_QUESTION_TEST.au3
-
By Alok_Arora
Hello Sir,
While searching for the solution to my problem, I have just gone through some of your old post.
My name is Alok Arora
Email id is *snip*
I am writing a code to store logs for each script I run. This I did by using FileWriteLog function and it is successfully storing logs in txt file.
Now, I have to work on to read the log file and if any script has been mistakenly clicked twice in a day script will pop up a message that task already done for the day by verifying entries in the log file.
I have the logic for it..
I mean a variable will read the log file and will search for the entry and will perform action if entry found or not.
I believe for reading the file I can write a code like
$i =fileread("logfile.txt")
Now I am stuck on how to compare the log entry in log file.
Can you please help me in this?
-
By TheDcoder
Hi, I thought I would never post a C/WinAPI related question in this forum ever, but here we are after a few years and me having learnt enough of C to write a basic console program
My issue is that I am trying to read my child process's stdout output but ReadFile never returns if the child exits or if it is killed... very strange , I have been trying to work my way around this. The options I can think of are:
Create a new thread and check for existance of the process constantly while reading Somehow make the pipe asynchronous (overlapped) so that I can read it in a non-blocking manner Fix ReadFile to return when the process ends Obviously I would prefer No. 3, I just want to make my program work. Here is my code if you guys want to take a look:
// No text highlighting for C/C++ but we have it for C#? Blasphemy! bool allium_start(struct TorInstance *instance, char *config, allium_pipe *output_pipes) { char *cmd; // Figure out the command string for execution if (config) { char *parameters = " -f -"; cmd = malloc(strlen(instance->tor_path) + strlen(parameters) + 1); if (!cmd) return false; strcpy(cmd, instance->tor_path); strcat(cmd, parameters); } else cmd = instance->tor_path; // Prepare startup info with appropriate information SecureZeroMemory(&instance->startup_info, sizeof instance->startup_info); instance->startup_info.dwFlags = STARTF_USESTDHANDLES; SECURITY_ATTRIBUTES pipe_secu_attribs = {sizeof(SECURITY_ATTRIBUTES), NULL, true}; HANDLE pipes[2]; if (output_pipes == NULL) { CreatePipe(&pipes[0], &pipes[1], &pipe_secu_attribs, 0); output_pipes = pipes; } instance->startup_info.hStdOutput = output_pipes[1]; instance->startup_info.hStdError = output_pipes[1]; instance->stdout_pipe = output_pipes[0]; // Stored for internal reference if (config) { // Reuse the pipes array to store standard input pipes CreatePipe(&pipes[0], &pipes[1], &pipe_secu_attribs, 0); instance->startup_info.hStdInput = pipes[0]; } // Create the process bool success = CreateProcessA( NULL, cmd, NULL, NULL, config ? true : false, 0, NULL, NULL, &instance->startup_info, SecureZeroMemory(&instance->process, sizeof instance->process) ); // Free command string if needed if (config) free(cmd); // Write config to Tor's standard input unsigned long bytes_written; if (success) { WriteFile(pipes[1], config, strlen(config), &bytes_written, NULL); // Work around for simulating Ctrl + Z which sends the substitution character (ASCII 26), // this is needed in order for Tor to detect EOT/EOF while reading the config WriteFile(pipes[1], &(char){26}, 1, &bytes_written, NULL); } CloseHandle(pipes[1]); // Return on failure if (!success) return false; } char *allium_read_stdout_line(struct TorInstance *instance) { char *buffer = instance->buffer.data; // Check for valid buffer and allocate if needed if (instance->buffer.size == 0 || !buffer) { buffer = instance->buffer.data = malloc(instance->buffer.size = 80 + 1); if (!buffer) return NULL; } // Process the input unsigned int read_len = 0; while (true) { // Read data unsigned long bytes_read; if (ReadFile(instance->stdout_pipe, buffer, 1, &bytes_read, NULL) == false || bytes_read == 0) return NULL; // Check if we have reached end of line if (buffer[0] == '\n') break; // Proceed to the next character ++buffer; ++read_len; // Resize buffer if it is full if (read_len == instance->buffer.size) { char *new_buffer = malloc(instance->buffer.size += 50); if (new_buffer) memcpy(new_buffer, instance->buffer.data, read_len); free(instance->buffer.data); if (!new_buffer) return NULL; instance->buffer.data = new_buffer; buffer = instance->buffer.data + read_len; } } // Terminate the new line with null character and return // Special handling for Windows, terminate at CR if present buffer[read_len >= 2 && buffer[-1] == '\r' ? -1 : 0] = '\0'; } The allium_start function creates the redirection pipes and the child process, the other allium_read_stdout_line function reads from the stdout pipe created by the first function, ReadFile in this function does not return when the child ends or gets killed.
I appriciate the help of the WinAPI gurus here, thanks in advance!
-
By TheAutomator
I'm writing a recursive decent parser in Autoit!
The programming language i'm making is called HighLevel.
I'm doing this for learning purposes, because it's fun and because I can implement it into my other project:
Fullscreen Console With custom programming language!
It's not easy...
In Autoit you don't have objects like in Java or Visual Basic, so I had to figure out a way to still convert the code to an abstract syntax tree.
I used nested array's and array based dictionary's instead of objects.
The code is still very dirty and I need to make a lot of modifications but if you're careful with testing you'll see what it can do already.
Console window
Because this code eventually will get implemented into my console project I crafted a nice little console window (with a custom sci-fi looking theme, yeah i was a little bored haha).
{ESC} is your panic button for now, it terminates the script completely.
If you get an error while opening a script the text will turn red.
To minimize it press the blue button, to close it use the red one, to drag the gui just grab it on one of the sides.
The console window will display what you write to it with your "HighLevel-script" and some additional information:
How to test it:
Download: HighLevel.Au3, Debug.Au3 (includes a function to display nested arrays for debugging), GUI.bmp (for the console)
Compile the Autoit code to EXE.
The GUI.bmp must be in the same folder as the EXE file!
Write a HighLevel-script (text file) and drag it into the compiled autoit-exe.
The custom made little console window will pop up in the left top corner of your screen and your HighLevel-script (the text file) will be interpreted and executed.
The Language:
exit script: Abort show / hide the console: Show Hide write to/clear the console: Write 'this is a ''string''!' Clear variables: test_var_1 = 123 some_list = ['a', 5, true] some_list[1] = 3 math = 1 + 2 * 3 / 4 - -5 & test_var beep (under construction): Beep F, optD wait X seconds: Wait X Messages: Message 'Hello World!' move/click the mouse: Move X, Y Click send keys (under construction): Send 'HighLevel', True if's: If false ElseIf true # this part will run Else End subs: Sub X # do stuff End Call X for loops: For X = 1 to 10 # X iterates End Values: Input 'Give me input' Random YesNo 'yes or no' operators: + - * / & > = ! < ( ) And Not Or
Example script:
# my first HighLevel script message 'Hello World!' message 'Lets write to the console...' clear # clear the console... list = ['a', 16, true] for i = 0 to 2 write list[i] wait 1 end sub test if YesNo 'would you like to quit?' message 'Goodbye!' abort else write 1 + 2 * 3 & ' math!' end end call test
test script.HighLevel
GUI.bmp
Debug.au3
HighLevel.au3
-
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