Jump to content

< Solved >I need some help


Borje
 Share

Recommended Posts

Hi everybody good programmers

I have some problem to have the example 1 to work but in the example 2 all works my question is what is wrong in

example 1 in line Filedelete ? It deletes not the 0 zize files in example 1

Can anybody tell me why this not works in the example 1 and tell what i have done for

Example #1

; #Include

$var1 = RegRead("HKEY_CURRENT_USER\Software\IncrediMail\Identities", "")

$file = _filelisttoarray(@UserProfileDir & "\Lokala Inställningar\Application Data\IM\Identities\"&$var1, "*",1)

for $i=1 to UBound($file)-1

$file_size = FileGetSize(@UserProfileDir & "\Lokala Inställningar\Application Data\IM\Identities\"&$var1 & $file[$i])

if $file_size = 0 Then

FileDelete(@UserProfileDir & "\Lokala Inställningar\Application Data\IM\Identities\"& $var1 & $file[$i])

endif

next

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

Example #2

; $file = _filelisttoarray(@UserProfileDir & "\Lokala Inställningar\Application Data\IM\Identities\{F9F78C8F-C4D1-4D35-9A40-39333FA992F0}\", "*",1)

;for $i=1 to UBound($file)-1

;$file_size = FileGetSize(@UserProfileDir & "\Lokala Inställningar\Application Data\IM\Identities\{F9F78C8F-C4D1-4D35-9A40-39333FA992F0}\" & $file[$i])

;if $file_size = 0 Then

;FileDelete(@UserProfileDir & "\Lokala Inställningar\Application Data\IM\Identities\{F9F78C8F-C4D1-4D35-9A40-39333FA992F0}\" & $file[$i])

;endif

;next

Edited by Borje
Link to comment
Share on other sites

hmmm, small sample worked for me

maybe try adding

MsgBox(0,"",$file_size)

after the FileGetSize

just to be sure that the file is actually 0 bytes.

*edit*

Because of the location of the folder you wish to delete files from, you may need to use admin rights

Edited by kaotkbliss

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Link to comment
Share on other sites

@OP,

No error checking in your code leaves you (and us) blind. Maybe the value is not Default, or something else, like the missing 64 suffix if you run x64, or ???

_ArrayDisplay what you get would also help.

BTW, use Code markup to wrap your source.

If the file string is bad, the value is likely to remain at 0, so this doesn't show much.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

Thanks kaotkbliss

I have already check this but now I have found the problem I missed backward in array please look $var2...

$var1 = RegRead("HKEY_CURRENT_USERSoftwareIncrediMailIdentities","")

$var2 = $var1 &""

$file = _filelisttoarray(@UserProfileDir & "Lokala InställningarApplication DataIMIdentities"&$var2, "*",1)

for $i=1 to UBound($file)-1

$file_size = FileGetSize(@UserProfileDir & "Lokala InställningarApplication DataIMIdentities"&$var2 & $file[$i])

if $file_size = 0 Then

FileDelete(@UserProfileDir & "Lokala InställningarApplication DataIMIdentities"& $var2 & $file[$i])

endif

next

This code works...

Thanks all

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