ReconX Posted April 30, 2014 Share Posted April 30, 2014 I am using "FileInstall" & "FileCopy". Everytime I execute the script, it adds the "bgimage.jpg" to the place the script is located and the Temp Directory. Here is the code. If Not FileExists(@ScriptDir & "\bgimage.jpg") Then FileInstall("C:\Users\Marc\Desktop\FixIt Script\Images\bgimage.jpg", @ScriptDir & "\", 1) FileCopy(@ScriptDir & "\bgimage.jpg", @TempDir, 1) I want it to only display in the Temp Directory instead of the source location of the script. Thanks in advanced. Link to comment Share on other sites More sharing options...
orbs Posted April 30, 2014 Share Posted April 30, 2014 I want it to only display in the Temp Directory instead of the source location of the script. Thanks in advanced. and why would this not work? If Not FileExists(@TempDir & "\bgimage.jpg") Then FileInstall("C:\Users\Marc\Desktop\FixIt Script\Images\bgimage.jpg", @TempDir & "\", 1) Signature - my forum contributions: Spoiler UDF: LFN - support for long file names (over 260 characters) InputImpose - impose valid characters in an input control TimeConvert - convert UTC to/from local time and/or reformat the string representation AMF - accept multiple files from Windows Explorer context menu DateDuration - literal description of the difference between given dates Apps: Touch - set the "modified" timestamp of a file to current time Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes SPDiff - Single-Pane Text Diff Link to comment Share on other sites More sharing options...
ReconX Posted April 30, 2014 Author Share Posted April 30, 2014 I may have worded that wrong. LOL After doing some research, I came to the conclusion, but I could be wrong, that using the "FileInstall" in this context: If Not FileExists(@ScriptDir & "\bgimage.jpg") Then FileInstall("C:\Users\Marc\Desktop\FixIt Script\Images\bgimage.jpg", @ScriptDir & "\", 1) would copy the file into the compiled script, that way having access to it on whatever computer I run the compiled EXE on. And that using "FileCopy" in this context: FileCopy(@ScriptDir & "\bgimage.jpg", @TempDir, 1) would copy it out of the compiled EXE, to the Temp Directory so that the program could use it. My problem is, that when you run the EXE, it copies the "bgimage.jpg" to the same directory of the EXE, the Desktop, and the Temp Directory. I only want the "bgimage.jpg" to appear in the Temp Directory. Link to comment Share on other sites More sharing options...
orbs Posted April 30, 2014 Share Posted April 30, 2014 i believe you misunderstand FileInstall(). you do not need to FileInstall() into the script directory in order to have it available anywhere. when you compile your script to exe, FileInstall() embeds your file into the exe - using only the 1st parameter. when you run the exe, FileInstall() extracts the embedded file - using only the 2nd parameter. and it is a bad practice to FileInstall() to the @ScriptDir because someone may launch the exe from a read-only directory, where FileInstall() cannot extract the file. @TempDir is always usable. Signature - my forum contributions: Spoiler UDF: LFN - support for long file names (over 260 characters) InputImpose - impose valid characters in an input control TimeConvert - convert UTC to/from local time and/or reformat the string representation AMF - accept multiple files from Windows Explorer context menu DateDuration - literal description of the difference between given dates Apps: Touch - set the "modified" timestamp of a file to current time Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes SPDiff - Single-Pane Text Diff Link to comment Share on other sites More sharing options...
ReconX Posted April 30, 2014 Author Share Posted April 30, 2014 (edited) i believe you misunderstand FileInstall(). you do not need to FileInstall() into the script directory in order to have it available anywhere. when you compile your script to exe, FileInstall() embeds your file into the exe - using only the 1st parameter. when you run the exe, FileInstall() extracts the embedded file - using only the 2nd parameter. and it is a bad practice to FileInstall() to the @ScriptDir because someone may launch the exe from a read-only directory, where FileInstall() cannot extract the file. @TempDir is always usable. Thanks, I understand it now. Basically, FileInstall("The location of the file that you want to add to the compile.", @TheDirTheExePutsTheFileToUse & "\SAME") What is the best way that you would suggest to compile the file, such as a background, to the compiled script to avoid running into the Read-only problem? Edited April 30, 2014 by ReconX Link to comment Share on other sites More sharing options...
Solution orbs Posted April 30, 2014 Solution Share Posted April 30, 2014 What is the best way that you would suggest to compile the file, such as a background, to the compiled script to avoid running into the Read-only problem? extract to one of the following: @TempDir @LocalAppDataDir @TempDir may get cleaned-up every now and then, so @LocalAppDataDir is preferred. in any case, better create a subfolder. Signature - my forum contributions: Spoiler UDF: LFN - support for long file names (over 260 characters) InputImpose - impose valid characters in an input control TimeConvert - convert UTC to/from local time and/or reformat the string representation AMF - accept multiple files from Windows Explorer context menu DateDuration - literal description of the difference between given dates Apps: Touch - set the "modified" timestamp of a file to current time Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes SPDiff - Single-Pane Text Diff Link to comment Share on other sites More sharing options...
ReconX Posted April 30, 2014 Author Share Posted April 30, 2014 Thank you for all of your help. Link to comment Share on other sites More sharing options...
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