Jump to content

  • Log In with Google      Sign In   
  • Create Account

Programming for software intermingling(?)


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
35 replies to this topic

#21 Satharis   Members   -  Reputation: 1362

Like
0Likes
Like

Posted 02 June 2014 - 09:19 AM

I want to do it because of the mundane practice of going through thousands of files checking the same thing over and over and then inputting slightly different values all day. If I can create a program that can do it for me it will free up my time to pursue more worthwhile things maybe even more money for me.

Quite a few people are trying to advise you on good ways to accomplish the task you are talking about, but you seem to be very reluctant about showing exactly -what- you are trying to do.

You might as well be saying, "See I have this play, but I don't know if the script is any good, can anyone tell me?" and not posting any of the play.

Personally my force powers are a bit off these days so I have trouble reading things that aren't around to see.

Edited by Satharis, 02 June 2014 - 09:20 AM.


Sponsor:

#22 lb2024   Members   -  Reputation: 118

Like
0Likes
Like

Posted 02 June 2014 - 10:48 AM

I apologize if I seem vauge. Im not sure what else to say though. In my imagination it seems straightforward. I want to make a program to follow a script of checks and balances to do work for me. A flow chart will be something on the order of:
Open txt file
open folder
check folder contents against txt file
record successful or error
open filename
check measurement
check limit
Record value
create pdf
close file
Insert value into excel

Rinse and repeat


At this point I feel like I just need to start programming away and ask technical questions for portions I am unsure about. I appreciate all the help from you guys. I'll try and whip something up and ask for technical questions from now on.

#23 swiftcoder   Senior Moderators   -  Reputation: 11113

Like
0Likes
Like

Posted 02 June 2014 - 10:54 AM

Is this meant to run on only Windows, or cross-platform? Windows has decent APIs for manipulating folder contents, whereas cross-platform you'll probably want to use something like boost::filesystem.


Tristam MacDonald - Software Engineer @Amazon - [swiftcoding]


#24 lb2024   Members   -  Reputation: 118

Like
0Likes
Like

Posted 02 June 2014 - 10:56 AM

Just windows.

#25 ApochPiQ   Moderators   -  Reputation: 16720

Like
1Likes
Like

Posted 02 June 2014 - 11:08 AM

The process is indeed very straightforward, aside from maybe emitting PDF documents and interacting with Excel (although both are totally possible).

 

I'm honestly a little confused about your level of comfort with programming, though. If you're actually comfortable in C or C++, and you can spell out the logic and requirements, you're 90% of the way to a working program. The rest is just making API calls.

 

The only reason I can see you having such trouble envisioning how to do this is if you're not really very practiced with programming. This is fine - we all start someplace - but it would be better to be upfront about it so we know how best to help you.

 

 

I think the reason for all the questions is we're seeing your posts and assuming you don't know how to do the basic parts. If that's true, then you need to actually work with the posters asking questions, by either providing the information they're looking for, or explaining why you can't. On the flip side, if you've got the basics handled and really just need help with something more specific (say, PDF emission), then please say so.

 

As it stands, I don't think anyone really knows how to be useful to you.



#26 lb2024   Members   -  Reputation: 118

Like
0Likes
Like

Posted 02 June 2014 - 11:29 AM

I would consider myself intermediate in the strictest terms. I've never used c++ to control other software so that is the most difficult portion I see. As of all this back and forth, 'Api's' was the word I apparently was looking for lol. Learning the correct Api's will be my focus moving forward. Any good resources for Api's through c or c++?

#27 SimonForsman   Crossbones+   -  Reputation: 6447

Like
2Likes
Like

Posted 02 June 2014 - 11:55 AM

I would consider myself intermediate in the strictest terms. I've never used c++ to control other software so that is the most difficult portion I see. As of all this back and forth, 'Api's' was the word I apparently was looking for lol. Learning the correct Api's will be my focus moving forward. Any good resources for Api's through c or c++?

 

The documentation for whatever API you intend to use tends to be a good start.

 

From what i understand you don't actually need to "control" other software though, it sounds as if all you need to do is read the contents of those .dat files and generate new files based on their contents.


I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!

#28 lb2024   Members   -  Reputation: 118

Like
0Likes
Like

Posted 02 June 2014 - 12:29 PM

And what is the best method of reading .dat files and having my code understand which portions to change if wrong and which ones to record? Since another software im using generated the .dat and I'll be accessing it through my code.

#29 ApochPiQ   Moderators   -  Reputation: 16720

Like
0Likes
Like

Posted 02 June 2014 - 12:44 PM

There is no such thing as "a .dat file". The three letters mean absolutely nothing. I could rename it to FOO or BAR or (on suitably modern OSes) GIBBERISH and the data would be unaffected. So there is no method for "reading .dat files" because the stuff in the file could literally be anything.

What we've been asking for is an example of what is inside this file. You need to open the file in a hex editor or other tool and look at the data inside it.

#30 Waterlimon   Crossbones+   -  Reputation: 2713

Like
0Likes
Like

Posted 02 June 2014 - 12:44 PM

The format of those files is probably application specific. You need to either:

-Find documentation for the file format (for the specific application, not for .dat files in general)

-Reverse engineer the file format yourself to figure out how information is stored in it


o3o


#31 swiftcoder   Senior Moderators   -  Reputation: 11113

Like
1Likes
Like

Posted 02 June 2014 - 12:46 PM


And what is the best method of reading .dat files and having my code understand which portions to change if wrong and which ones to record?

That requires you to know the format of the file. The '.dat' file extension is just a generic notation for files containing data - there isn't any implied structure to the data.

 

To do anything useful with the data, you have to know how it is formatted. Either by reading a format specification provided by the author of the software which created that file, or by opening up the file in a text/hex editor, and reverse-engineering the structure.

 

If you open up the file in Notepad and you find you can read the contents easily, then it is a plain-text format, and will be fairly easy to interpret. If you open it in Notepad and it is just gibberish, then it is a binary format, and reverse engineering will be a painstaking process conducted with a hex editor, and healthy supply of caffeinated beverages.

 

If you are able to upload a sample of such a file, one of us can take a look and tell you if this is feasible.


Tristam MacDonald - Software Engineer @Amazon - [swiftcoding]


#32 lb2024   Members   -  Reputation: 118

Like
0Likes
Like

Posted 02 June 2014 - 01:51 PM

Thanks so much guys!!! It's easily read through notepad, so I'm getting the feeling this won't be too hard. So, since I know it's plain-text format, what do I need to do next? I assume what I'm reading are variables but I need to know how to check the values since they will change depending on the file. Here is what it reads like in the notepad:

 

**Note if I'm doing anything wrong looking at this file through a Hex editor or posting this let me know. I don't want to be doing anything illegal or unethical. I'm just trying to create something to read these and determine if it is good or needs to be changed.

 

*edit deleted code. (nothing was too important)



Edited by lb2024, 08 June 2014 - 11:36 AM.


#33 swiftcoder   Senior Moderators   -  Reputation: 11113

Like
0Likes
Like

Posted 02 June 2014 - 02:43 PM

Ok, yes, that data format is dead simple. Basically an INI file, with the additional of tab-delimited columns.

 

You may well find there is an off-the-shelf INI parsing library that would load this, but if not, you want to follow the basic steps:

- open the file, read it a line at a time:

  + if the first character is a '#', ignore the line

  + if the first character is an '<', treat it as a section header

  + if the line contains a '=', assume everything up to the '=' is the key name, everything after is values separated by tabs

 

Probably simple enough you can get away with using a C-style scanf() to parse the actual values.


Edited by swiftcoder, 02 June 2014 - 02:43 PM.

Tristam MacDonald - Software Engineer @Amazon - [swiftcoding]


#34 lb2024   Members   -  Reputation: 118

Like
0Likes
Like

Posted 02 June 2014 - 04:19 PM

But to recheck before I cry triumph, let me gather if I got my logic down right.

For me to check a folder and it's content, I will need to learn about "api's" (ie. I have a folder with data and a txt file in which shows what should be in the folder I use some type of reader to crosscheck txt file and filenames in folder)

For me to check the values of the contents of my data file, I load the data file into possibly scanf() and search for specific strings and record my values. I then will print out the values in a txt format for use later.

I still haven't figured out how to input it into excel automatically, but I'm assuming the "api's" will have something to do with it.

Am I on the right track?



#35 swiftcoder   Senior Moderators   -  Reputation: 11113

Like
0Likes
Like

Posted 02 June 2014 - 05:15 PM

Sort of. In brief:

 

- Reading files is built into the C++ standard library. Go learn about file streams.

- Parsing values from text can be accomplished in many ways, you'll probably either want to use file streams directly or the scanf() functions.

- Directory manipulation is not built into C++, so you might look at the aforementioned boost::filesystem.

- Modifying Excel files is not built in either, but there are 3rd-party libraries to help you out.

 

That said, I don't at this point have a good feel for your experience programming in C++, so a bunch of that may require significant other reading before you tackle it.


Tristam MacDonald - Software Engineer @Amazon - [swiftcoding]


#36 lb2024   Members   -  Reputation: 118

Like
0Likes
Like

Posted 02 June 2014 - 05:48 PM

Im intermediate. Might be a small curve but I feel confident in a month I could figure it out. Plus you guys been so helpful once I start coding I'll ask for help if I get stuck somewhere. Thanks for the help for real.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS