Jump to content

Double Quote usage


TehWhale
 Share

Recommended Posts

So, basically im tring to make a Standalone chrome.exe, so i have a _FileListToArray array of files, and i want to output like this, for example, it would be:

FileInstall("Chrome\locales\vi.dll", @TempDir&"\Chrome\locales\vi.dll")

Using filewrite and such, so in the script, it'll be like:

_FileListToArray(@ScriptDir&"\Chome\locales\", "*.*", 1)

Then, I know im using locales folder, so

For $i=1 to $FileArray[0]

FileWrite(@ScriptDir&"\blah.au3", "FileInstall('Chrome\locales\'& $FileArray[0]&', @TempDir&'\'&"&$FileArray[$i])

Next

And that's always giving me errors...

Just to clarify, I want the variable in the script, the file, but i want @TempDir written, not MY temporoary directory.

Edited by SwiftBurns
Link to comment
Share on other sites

Link to comment
Share on other sites

You can't use a variable in the source. Ever. End of story.

Please explain :)

EDIT:

He means in file install. Look it up in the helpfile peeps. >_<

Edited by BrettF
Link to comment
Share on other sites

Yes it will. Look in the helpfile. It specifically states you can't use a variable for the source so don't even try. Even if you String() the expression it's still containing a variable and thus won't work.

FileInstall

--------------------------------------------------------------------------------

Include and install a file with the compiled script.

FileInstall ( "source", "dest" [, flag] )

Parameters

source The source path of the file to compile. This must be a literal string; it cannot be a variable.

Edit: Added helpfile line. Edited by dbzfanatic
Link to comment
Share on other sites

You can't use a variable in the source. Ever. End of story.

He's not. His script is creating another script where the variable will already be parsed into a literal string when written into the FileInstall() line of the new script.

To generate the formatted text and test it, try this:

; Simulated output of _FileListToArray()
Global $FileArray[3] = [2, "Test1.txt", "Test2.txt"]

; Loop to output generated FileInstall() script lines
For $n = 1 To $FileArray[0]
; Note double backslashes (see help file under StringFormat()
    $sString = StringFormat("FileInstall('Chrome\\locales\\%s', @TempDir & '\\%s')", $FileArray[$n], $FileArray[$n])
    ConsoleWrite($sString & @LF)
Next

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...