Jump to content

Including files with compiled version of script


texan
 Share

Recommended Posts

I have a script that reads various Excel files for input data. The end user will need to select which Excel file to use for input. I was hoping to give each user a single EXE file for the script and not have to include sending them the Excel files. One EXE would be easier to distribute plus I don't really want the user having the ability to mess with the data conained in the Excel files.

I was wondering if there was some way to created a "compiled" version of my script that is a single .EXE file but somehow contains these Excel files for input?

Link to comment
Share on other sites

As long as you don't want to make edits to the file, you can use FileInstall(). This will compile it with the exe and allows you to output it wherever you want, then use it for input. Before the program closes, don't forget to delete the file.

Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Link to comment
Share on other sites

  • 2 weeks later...

FileInstall() does accomplish what I need. I am wondering if there is "best pratices" for using FileInstall(). I currently have it coded as this:

FileInstall("MyExcelFile.xlsx", @TempDir & "MyExcelFile.xlsx", 1)

Any reason this would not work? Many of the end users might not have access to their C: on the PCs. Would @TempDir still work even if they don't have C: drive access?

Link to comment
Share on other sites

Maybe the path in the first section needs to be complete

From the helpfile

The source path of the file to compile. This must be a literal string; it cannot be a variable or the result of a function call. It can be a relative path (using . or .. in the path) to the source file (.au3).

FileInstall("C:test.bmp", "D:mydirtest.bmp")

An example of one of mine

FileInstall("F:Backup Utilitycompilerobocopy.exe", @SystemDir, 1)
Edited by Chimaera
Link to comment
Share on other sites

I also wonder if using an Excel file is the best option for what I am doing. I am only using Excel because that is the format the data came to me. The data in the Excel file is not going to change regularly. I will probably get an update to the data once every year at which time I would plan to send out a new version of my AutoIt .exe file. The end users are not all on the same LAN so I can't just place the Excel file there.

The data in the Excel file is not that big, maybe a few thousand lines. I just read it into an array and use it from there. Is there some other way to include this data other than compiling the Excel file with the AutoIt program?

Edited by texan
Link to comment
Share on other sites

texan,

I am only using Excel because that is the format the data came to me.

Does this mean that you get the data from excel, or, is the data in a flat file in comma seperated value format?

kylomas

edit: spelling

Edited by kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Link to comment
Share on other sites

Does this mean that you get the data from excel, or, is the data in a flat file in comma seperated value format?

The data is in Excel and I use _ExcelReadSheetToArray to put it in an Array. The rest of my AutoIt program works with the Array.
Link to comment
Share on other sites

texan,

As a general rule you do not want to couple data with your program. However, your situation may be an exception to this given the static nature of the data and disparate user base. The real issue will be program/data maintenance. This is one of those "it's your call..." kind of things.

Good Luck,

kylomas

edit: spelling

Edited by kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

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