Jump to content

compiling question


Recommended Posts

I know you can use fileinstall to add your AU3 to an executeable. However, I was thinking about making a fun example of an adventure game as part of my learning the GUI code. Now, if I were to have sound files, images, and animations in this I wouldn't want the user to see these. They may give away information in the game right.

So, here's my question.. can I compile them directly into the EXE? I don't seem to see any mention of it. Or will fileinstall do this as well? I just have not seen any examples of it used in this manner.

Also if it is fileinstall I need to use.. "These included files can then be "extracted" during execution of the compiled script" does this mean the call to the image, sound file, or animation should be done by their name as it is.. and also just call it directly as if it's in the same folder? or does it "extract" to a default location?

:D

thanks

moo

Link to comment
Share on other sites

It won't put the file that has been compiled into the final exe in the destination until it reaches that call. What about creating something that could extract the files as required, all from within the same script? Here is an example of what I'm talking about. When you need one of the files, just call the script again with the file that you need as a paramater:

If $CmdLine[0] = 1 Then
  If $CmdLine[1] = "File1" Then
    FileInstall("C:\My_source_directory\pic1.bmp", @ScriptDir & "\temp\")
  ElseIf $CmdLine[1] = "File2" Then
    FileInstall("C:\My_source_directory\pic2.bmp", @ScriptDir & "\temp\")
  EndIf
  Exit
EndIf

;when you need to create one of these files, just do:
Run(@ScriptFullPath & " File1")

Just be sure to clean up when you are done. You could also include a password as the 1st or 2nd paramater so that the user couldn't just run "game.exe file1" to get access to the files without the proper password as a paramater.

Minor typo fixed

Edited by pekster

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Link to comment
Share on other sites

so it does extract them from the file then? sorry.. I'm a bit confused.. it looks like your code is installing the images upon specific flags.

The way file install appears to work is that it takes the file and simply appends it to the final exe with the name of the file embedded inside.

My only concernes are

A: how do I call the image when I need it if it's embedded "\pic1.bmp" or "C:\default extract location\pic.bmp"

B: if it does extract where does it go? can that be defined

C: if extracted does it stay there? or is it only there as long as it's needed in the script

Now, if it is extracted and called expernaly.. is there a way in the next version for this to not happen?

Basically what I want is a final EXE that contains all it's required filles and no one can get to them to see our hear them untill experienced within the "game"

moo

Link to comment
Share on other sites

Basically what I want is a final EXE that contains all it's required filles and no one can get to them to see our hear them untill experienced within the "game"

Doesn't my method do that? You can't get the files out without knowing the proper password (if you use my password suggestion.) If you juts run "game.exe" it will start the game. Also, how could the user get the files out if they can't use the proper switches?

If you think that it's appended in plain text to the exe, I just tested that. I created a plaintext file, and fileinstalled it to the script's directory. When I searched for some text that it contained, I didn't find it anywhere in the EXE when I viewed the compiled EXE with notepad.

Minor edit

Edited by pekster

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Link to comment
Share on other sites

Sorry, don't think I answered all your questions. Here's a 2nd attempt to answer everything I missed in my post above.

so it does extract them from the file then? sorry.. I'm a bit confused.. it looks like your code is installing the images upon specific flags.

The FileInstall change what it does depending on if it is being run from source or a compiled EXE. If you are running an au3 file, it just does a file copy. It will copy the first argument (your source file) to the directory or file listed in the 2nd argument. So my source just tells it to "Install" the file from the listed source directory.

When you compile the script, it actually includes the file in the file (the EXE) so that the user doesn't have to have the source file. In this mode, it will extract the file to the listed destination location when it hits the FileInstall command.

A: how do I call the image when I need it if it's embedded "\pic1.bmp" or "C:\default extract location\pic.bmp"

Just use the FileInstall command as normal. Remember, the source path and file only need to exist on the computer that compiles the script. Once it's an EXE the file is included in the file.

B: if it does extract where does it go? can that be defined

It will be placed in whatever directory is listed as the 2nd paramater (see the helpfile for more info.) You can also give it a full path name including a file name if you wish to change the name of the file from your source path.

C: if extracted does it stay there? or is it only there as long as it's needed in the script

It'll stay there until it is deleted. It's just like a "copy" command, but the source will be included in the EXE. Why not create a global array of files you've installed, and at the end of your script just go through and delete them all?

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Link to comment
Share on other sites

it would be better if it simply called to them *within* the EXE perhaps that can be done in a future version of Autoit.

That way someone wouldn't be able to run the program.. take the files and then close it before they are deleted.

Link to comment
Share on other sites

That way someone wouldn't be able to run the program.. take the files and then close it before they are deleted.

My method doesn't allow that to happen. The reason behind it is that you don't actually extract the files until they are needed. Let's say you're making an RPG with 5 stages, and you don't want the user to be able to use any stage file where they haven't yet been. You simply don't call the Run(@ScriptFullPath & " <password> filename") command until you want to use that image/ sound/ text file/ whatever. Just running the application does not extract it. I'll code a quick example and upload it to my server as an example in a few minutes.

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Link to comment
Share on other sites

This will do what you want to do .

http://trondoc.ezwebtech.com/theWRAP/

fixed typo

This doesn't do what cowsmanaut is looking for since it won't stop the user from running the wrapper to see the file we don't want the user to have access to. Plus you have to pay to include more than 17 files :D .

Also, sorry my function is taking so long. I was going to use a different method, but realised that was a failure, so started over doing it the right way. It'll be up eventually :huh2:

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Link to comment
Share on other sites

I understand that it only extracts what is currently being used. So say I have a picture of the sea and it needs to be displayed when they go out on a boat. Well it goes and extracts the sea graphic and displays it.. when they leave that area I can have it delete the image and extract the next image.

This covers them not seeing anything untill they get to that point in the game. It doesn't however prevent them from taking those images or sounds or AVI's when they reach that point though.. I suppose it's not too big a deal because if they *really* wanted them they can get at them otherways. However for those who might consider follwing the idea of using autoit for an adventure game or a multimedia presentation or other things of this sort. They may not want anyone to have easy access to their media files. Just a future reffrence thing. :D

Anyway, if you're up to helping me put this together I'll put more time into the Graphics :) BTW That is my main skill set 3D/2D graphics and games.. it explains my interest in trying to do this in the first place :lol:

Something other than the scripts I'm writing for the college.. but some of those have been fun too :huh2:

moo

Link to comment
Share on other sites

My example is finally complete, and it does do slightly more than you imply that I can't do. You can delete the file after it has been displayed (or played, or whatever) because it's in RAM at that point, so the computer doesn't need to read it from the disk anymore. My example only deals with 2 text files, but they could be pictures, or whatever. You just delete them as soon as you have read them (or called the GUI that they are on if you are using images or avi's.)

The file is called On-The-Fly FileInstall.zip and is avaiable in my /Examples directory of my projects FTP server (see link in my signature.)

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Link to comment
Share on other sites

No offence meant for my implications.. I was thinking about it being stored in ram so that it could be deleted immediately.. but wasn't sure. Nice to have that confirmed. :D Thanks!

happened nice and fast too.. good job.. let's hope images go as fast :huh2:

Link to comment
Share on other sites

It's not exactly confirmed.  Depending on the application used to display the file, it may be locked and not deletable until it is closed.

I'm sure my example could be expanded to continue trying to delete recently installed files until the list is empty. Something like the use of a global array to store files you've opened, and an AdLib that runs every X ms to try and delete the files that are still opened. As soon as the array is empty or blank, the AdLib could disable itself having done its job of removing the no-longer in-use files.

If you also put the files in some burried temp directory, I doubt many users could gain access to them, even if they were locked (and visable) for a few moments.

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Link to comment
Share on other sites

when creating a folder one could always set it to hidden too.. You can do that can't you? I'm sure at the very least there would be a commandline method to do this.

again.. this will keep out all but the most tenacious. There is always a way :D

moo

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