Jump to content

Need Help with firefox cleanup script


am632
 Share

Recommended Posts

Hi, i need help with a script to delete firefox files - (Browsing & download history, form & search history, cookies, cache, active logins & site preferences)

theres a couple of things i need help with - i guess i just use 'FileDelete()' with the directory of the firefox temp files, but if my user account name is 'user' how would you make it clean all users or just the current user? also the cache files are located at C:\Users\user\AppData\Local\Mozilla\Firefox\Profiles\dpbfn4a8.default\Cache but are @ C:\Users\user\AppData\Local\Mozilla\Firefox\Profiles\ypgng3a7.default\Cache on my other computer. and because these directories are slightly different, i cant hardcode the directory in the script.

can any one help me out please. im using vista on this laptop btw, and xp on the other machine.

thanks

Edited by am632
Link to comment
Share on other sites

Why not just go to options/privacy and check Always clear my private data when I close Firefox and set the settings?

The Wheel of Time turns, and Ages come and pass, leaving memories that become legend. Legend fades to myth, and even myth is long forgotten when the Age that gave it birth comes again.

Link to comment
Share on other sites

Thanks for the tip.

The point im trying to get at tho is how would you remove files from a changing directory.

for example... lets say there is a folder called temp of 50 computers, and each computer has a different username. the directory would be different for each user as their name would be different such as

C:\Users\username1\Desktop\TEMP & C:\Users\username2\Desktop\TEMP

so rather than hardcode the directories for each user cant you substitute the username with something else? i remember seeing something once somewhere else like %user%

eg

C:\Users\%user%\Desktop\TEMP

Do you get what i mean?

tnx

Link to comment
Share on other sites

Thanks for the tip.

The point im trying to get at tho is how would you remove files from a changing directory.

for example... lets say there is a folder called temp of 50 computers, and each computer has a different username. the directory would be different for each user as their name would be different such as

C:\Users\username1\Desktop\TEMP & C:\Users\username2\Desktop\TEMP

so rather than hardcode the directories for each user cant you substitute the username with something else? i remember seeing something once somewhere else like %user%

eg

C:\Users\%user%\Desktop\TEMP

Do you get what i mean?

tnx

AutoIt macro: @TempDir

Look it up.

Link to comment
Share on other sites

tnx for the tip Manadar - the simple line of code i was looking for is...

DirRemove(@HomeDrive & "\Users\" & @UserName & "\AppData\Local\Mozilla\Firefox\Profiles\", 1)  DirCreate(@HomeDrive & "\Users\" & @UserName & "\AppData\Local\Mozilla\Firefox\Profiles\")

(easy when u kno what your looking for)

one more question plz...

i would like to run the code

FileDelete(@HomeDrive & "\Users\" & @UserName & "\AppData\Roaming\Mozilla\Firefox\Profiles\bc168gcb.default\cookies.sqlite")

however on my other computers the "bc168gcb.default" is different each time - firefox says its for extra security reasons. how would i go about a substitute for this... like a kinda wildcard but not if u get what i mean so i can run the script on all computers?

Link to comment
Share on other sites

This:

@HomeDrive & "\Users\" & @UserName & "\AppData\

is also in a macro called

@AppDataDir
:D

It's better to use @AppDataDir, because for example: Windows XP don't have a Users folder but they have "Documents and Settings" instead. Also, not everyone has their \Users\ folder on the homedrive.

Wildcards work with FileDelete (not sure if you can use this):

FileDelete(@HomeDrive & "\Users\" & @UserName & "\AppData\Roaming\Mozilla\Firefox\Profiles\*.default\cookies.sqlite")
Link to comment
Share on other sites

This:

@HomeDrive & "\Users\" & @UserName & "\AppData\

is also in a macro called

@AppDataDir
:D

It's better to use @AppDataDir, because for example: Windows XP don't have a Users folder but they have "Documents and Settings" instead. Also, not everyone has their \Users\ folder on the homedrive.

Wildcards work with FileDelete (not sure if you can use this):

FileDelete(@HomeDrive & "\Users\" & @UserName & "\AppData\Roaming\Mozilla\Firefox\Profiles\*.default\cookies.sqlite")

Oh ryt, so I can use the same script on xp and vista to save me doing a seperate one, kwl, tnx for that. I already tried the *.default too but no luck there...

Jus an idea, could i possibly create a new macro for this, 'cos for example - correct me if im wrong but if @AppDataDir can detect the directory for thhe temp folder, could a macro detect the randomly generated foldername?

tnx

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