mohan93 Posted May 28, 2014 Share Posted May 28, 2014 Guys, This time am struck with the below scenario please assist. Am copying few files to the below location using my script. %AppData%MozillaFirefoxProfiles6zejl8ne.default i need to copy files inside 6zejl8ne.default folder. But the issue is this folder name is not constant, folder name changes for every user. for e.g: user 1 will have: %AppData%MozillaFirefoxProfiles6zejl8ne.default user 2 will have: %AppData%MozillaFirefoxProfiles4qi4qup6.default please assist is ther anyway i have files to the above location. Cheers, Link to comment Share on other sites More sharing options...
jguinch Posted May 28, 2014 Share Posted May 28, 2014 Look at >this topic, in #2 : _FF_ProfilesList() Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
mohan93 Posted May 28, 2014 Author Share Posted May 28, 2014 jguinch, Thanks for your reply, The one you have mentioned about _FF_ProfilesList() doesn't fit my requirement. _FF_ProfilesList() - think its point to @AppDataDir & "MozillaFirefoxprofiles.ini" but my requirement like copying the file like in below script, FileCopy(@TempDir & "Files*.*", @AppDataDir & "MozillaFirefoxProfiles6zejl8ne.defaultextensions") where, 6zejl8ne.default folder will change for every user. is that we can assign that folder to constant so that i can run this script on every machine ? Cheers, Link to comment Share on other sites More sharing options...
jguinch Posted May 28, 2014 Share Posted May 28, 2014 Did you try my code ? No. $aProfiles = _FF_ProfilesList() For $i = 1 To $aProfiles[0][0] FileCopy(@TempDir & "\Files\*.*", $aProfiles[$i][1] & "\extensions\") Next Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
mohan93 Posted May 28, 2014 Author Share Posted May 28, 2014 Used the same code, $aProfiles = _FF_ProfilesList() _ArrayDisplay($aProfiles) For $i = 1 To $aProfiles[0][0] FileCopy(@TempDir & "Files*.*", $aProfiles[$i][1] & "extensions") Next i get error: Unknown Function name $aProfiles = _FF_ProfilesList() $aProfiles = ^ ERROR Link to comment Share on other sites More sharing options...
jguinch Posted May 28, 2014 Share Posted May 28, 2014 (edited) Well, you must add my _FF_ProfilesList() function in your script (with #Include <File.au3>) expandcollapse popup#Include <File.au3> $aProfiles = _FF_ProfilesList() For $i = 1 To $aProfiles[0][0] FileCopy(@TempDir & "\Files\*.*", $aProfiles[$i][1] & "\extensions\") Next Func _FF_ProfilesList() Local $aResult[1][2] = [[0]] Local $sProfiles = @AppDataDir & "\Mozilla\Firefox\profiles.ini" Local $aSections = IniReadSectionNames($sProfiles) If @error OR NOT IsArray($aSections) Then Return SetError(1, 1, 0) For $i = 1 To $aSections[0] If $aSections[$i] <> "General" Then Local $sProfileName = IniRead($sProfiles, $aSections[$i], "Name", "error") Local $bIsRelative = IniRead($sProfiles, $aSections[$i], "IsRelative", "error") Local $sProfilePath = IniRead($sProfiles, $aSections[$i], "Path", "error") If $bIsRelative = "error" OR $sProfilePath = "error" OR $sProfileName = "error" Then ContinueLoop If $bIsRelative = "1" Then $sProfilePath = _PathFull( @AppDataDir & "\Mozilla\Firefox\" & StringReplace($sProfilePath, "/", "\") ) If NOT FileExists($sProfilePath & "\prefs.js") Then ContinueLoop $aResult[0][0] = UBound($aResult) Redim $aResult[ UBound($aResult) + 1][2] If IniRead($sProfiles, $aSections[$i], "Default", "error") = "1" Then $aResult[0][1] = UBound($aResult) - 1 $aResult[UBound($aResult) - 1][0] = $sProfileName $aResult[UBound($aResult) - 1][1] = $sProfilePath EndIf Next If $aResult[0][1] = "" AND $aResult[0][0] > 0 Then $aResult[0][1] = 1 Return $aResult EndFunc Edited May 28, 2014 by jguinch Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
Solution mikell Posted May 28, 2014 Solution Share Posted May 28, 2014 This works for me #include <File.au3> $search = _FileListToArray(@AppDataDir & "\Mozilla\Firefox\Profiles", "*.default", 2) $dest = @AppDataDir & "\Mozilla\Firefox\Profiles\" & $search[1] & "\extensions\" Msgbox(0,"", $dest) ; FileCopy(@TempDir & "\Files\*.*", $dest) mohan93 1 Link to comment Share on other sites More sharing options...
jguinch Posted May 28, 2014 Share Posted May 28, 2014 Mikell, your code is so easy... Mine has just the benefit to only list the profiles defined in the "profiles.ini", but it is not necessarily required. Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
mohan93 Posted May 28, 2014 Author Share Posted May 28, 2014 mikell Great its working Thanks for your assistance. 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