Sign in to follow this  
Followers 0
LondonNDIB

Any C++ experts out there? I need to change a program

7 posts in this topic

#1 ·  Posted (edited)

Not sure if this is the place to ask. I have some c++ source code for an app I use. I've been trying and trying to get AutoIt to work with it, but the original app was made in such a way that I keep running into problems with automation.

In particular, the app spits output out VERY FAST to a list type control and I can't for the life of me get AutoIT to read that control. Every other control, but not that one! However, a bigger limitation is that the computer crashes anyway when there's too much data in that control. The software has the option to stream the data to a txt file INSTEAD of displaying it on the control, and that worked fine for awhile until I realized my autoit script, which is reading the last line of the file in a while loop, is missing some lines. I think this means the file is being written to faster than my AutoIt script can execute.

I thought I could probably use STDIO to read STDOUT and act on it, right? But the app as it is now doesn't have anything coming via STDOUT (I tried).

So I figure because I have the source code I could make the app output to STDOUT instead of displaying it to the control or streaming it to a file.

And I'm sure I could have 6months training on how to program in c++ :) But I have no clue and I thought maybe someone out here would be... well... willing and able to just do it for me?? Maybe? Please?

Figured I'd ask anyway.

Thanks.

Sourcecode is available here: http://www.apoxcontrols.com/USBCAN/USBCAN4_EXAMPLE.zip

Edited by LondonNDIB

Share this post


Link to post
Share on other sites



What is fast?

Could you change the app so that it sends each line to the AutoIt script usingh a message? Or each 100 lines for example instead of writing to a control?

Reading the text from a control will be very slow, but if you use a message then not only would it be fast but it would wait untill the message was dealt with so the A3 script would keep up dependinf on what it has to do with the data I suppose.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

500 kbaud is "fast"

I can't change the app at all, because... well... I don't know c++ :) Which is why I made the request, but yes I'm sure what you're suggesting might work. I'm not sure what you mean by "a message"... but yes, reading from the control and/or file is too slow.

Share this post


Link to post
Share on other sites

nevermind.

I sort of figured it out but then I found that version of the software is flawed anyway. The site links to a newer version but the link is dead. Dead end.

Share this post


Link to post
Share on other sites

If your program is reading the last line (FileReadLing("file",-1)) why don't you instead get it to read the next line (which is no parameter)

Also as far as performance, the help file mentions the following:

If a filename is given rather than a file handle - the file will be opened and closed during the function call - for parsing large text files this will be much slower than using filehandles.

From a performance standpoint it is a bad idea to read line by line specifying "line" parameter whose value is incrementing by one. This forces AutoIt to reread the file from the beginning until it reach the specified line.

You could have a loop that will monitor if the size changes (FileGetSize) or if the modified time changes (FileGetTime) and if it does, reread the file.

Share this post


Link to post
Share on other sites

except that FileGetSize/Time won't work with the file being in use. I don't know if that's a universal truth, but it is the case here. That was the first thing I tried.

And without that check, reading the file's next line gives an EOF when it gets to the end, which it is always going to be at.

The good news is that less than an hour ago, the original app's author sent me the latest up to date source. I think I'll get somewhere now. I can modify the source to send the output to console (STDOUT) instead of a file or to the control. That should be fast and direct, and READSTDOUT uses a buffer so I should get all the data.

Share this post


Link to post
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
Sign in to follow this  
Followers 0