Sign in to follow this  
Followers 0
FLASHCODER1

Get (*filter) only prefs.js and store in array

11 posts in this topic

Hi,

I have this code (http://pastebin.com/5fB5KrvK) and I'd like get (*filter) only prefs.js filename with full your path without use _ArrayDisplay function, something like: 

$prefs @AppDataDir&"MozillaFirefoxProfilese23e2.defaultprefs.js"

and after make changes in this specific file as: 

If FileExists($prefs) Then

;make my changes here

EndIf

 

Can you help me, please?

Thank in advance!

Share this post


Link to post
Share on other sites



$Path = @AppDataDir & "\Mozilla\Firefox\Profiles"
$Array = _RecFileListToArray($Path, "prefs.js", 0, 1, 0)

$Array will contain a list of prefs.js files.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

$Path = @AppDataDir & "\Mozilla\Firefox\Profiles"
$Array = _RecFileListToArray($Path, "prefs.js", 0, 1, 0)

$Array will contain a list of prefs.js files.

 

OK Richard, Thanks. I understood.

Then how I do for search the string (prefs.js) into $Array variable and after test in FileExists function? Some idea?

Edited by FLASHCODER1

Share this post


Link to post
Share on other sites

Yes, a For loop, with stringinstr.


Spoiler

Paster - Main function is to paste text, but has more functions.

OpenW - Open With... alternative, Open any file with any application, set it's icon, set application as default.

Renamer - Rename files and folders, remove portions of text from the filename etc.

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Yes, a For loop, with stringinstr.

 

I want something like this:

MsgBox(0,"",$Path&$ArrayPrefs)  ;Return as : C:UsersGREATEST VIEWAppDataRoamingMozillaFirefoxProfileszxl43z7i.defaultprefs.js

and then make changes in prefs file like this:

If FileExists($Path&$ArrayPrefs) Then

;manipulate prefs file here

EndIf

Edited by FLASHCODER1

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Like this?

#include "RecFileListToArray.au3"
$Path = @AppDataDir & "\Mozilla\Firefox\Profiles\"
$Array = _RecFileListToArray($Path, "prefs.js", 1, 1, 0, 2)
For $i = 1 To $Array[0]
    MsgBox(64, 'Array nº'&$i,$Array[$i])
    ConsoleWrite('Array nº'&$i&' = '&$Array[$i] &@CRLF)
    $OpenHDL = FileOpen($Array[$i])
    ;Do stuff
    FileClose($OpenHDL)
Next
Edited by careca

Spoiler

Paster - Main function is to paste text, but has more functions.

OpenW - Open With... alternative, Open any file with any application, set it's icon, set application as default.

Renamer - Rename files and folders, remove portions of text from the filename etc.

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

 

Share this post


Link to post
Share on other sites

I see you want, but what have you done so far? Previous post gives you the path to the file, what did you try after that?

 

I tried, but return nothing, only in _ArrayDisplay function :( Could give me a example? Thank

Share this post


Link to post
Share on other sites

Edited the post, check again.


Spoiler

Paster - Main function is to paste text, but has more functions.

OpenW - Open With... alternative, Open any file with any application, set it's icon, set application as default.

Renamer - Rename files and folders, remove portions of text from the filename etc.

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

 

Share this post


Link to post
Share on other sites

Edited the post, check again.

 

That's it @careca! you got :thumbsup:  Thank you very very much guy!

Share this post


Link to post
Share on other sites

That function is included in AutoIt, but is _FileListToArrayRec().


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

That function is included in AutoIt, but is _FileListToArrayRec().

 

OK @guinness!

Share this post


Link to post
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
Sign in to follow this  
Followers 0