Jump to content

FileInstallr counting bug?


ricky
 Share

Recommended Posts

Hello,

I test the latest FileInstallr v1.3.1.6 and I found a litlle strange thing...

Func _FileList()
    #cs
        No files were found.
    #ce

    Local $iReturn = 0
    $iReturn += FileInstall('', 'C:\Users\ab\Desktop' & '', 1)
    $iReturn += FileInstall('C:\Users\ab\Desktop\ADDERView CATx 1000\Motherboard', 'C:\Users\ab\Desktop' & '\Motherboard', 1)
    $iReturn += FileInstall('C:\Users\ab\Desktop\ADDERView CATx 1000\Firmware', 'C:\Users\ab\Desktop' & '\Firmware', 1)
    $iReturn += FileInstall('C:\Users\ab\Desktop\ADDERView CATx 1000\catxbrochure_7_051212_ web_0.pdf', 'C:\Users\ab\Desktop' & '\catxbrochure_7_051212_web_0.pdf', 1)
    $iReturn += FileInstall('C:\Users\ab\Desktop\ADDERView CATx 1000\avx1000_v1.pdf', 'C:\Users\ab\Desktop' & '\avx1000_v1.pdf', 1)
    $iReturn += FileInstall('C:\Users\ab\Desktop\ADDERView CATx 1000\AdderViewCATx_1000_v1_0e.pdf', 'C:\Users\ab\Desktop' & '\AdderViewCATx_1000_v1_0e.pdf', 1)
    $iReturn += FileInstall('C:\Users\ab\Desktop\ADDERView CATx 1000\Firmware\AdderView CATx1000_1.07.zip', 'C:\Users\ab\Desktop' & '\Firmware\AdderView CATx1000_1.07.zip', 1)
    $iReturn += FileInstall('C:\Users\ab\Desktop\ADDERView CATx 1000\Motherboard\13.11.01.00_Windows_MSM.zip', 'C:\Users\ab\Desktop' & '\Motherboard\13.11.01.00_Windows_MSM.zip', 1)
    Return $iReturn = 8
EndFunc   ;==>_FileList

Why the script count  during all stepsand at the end it send a fixed value?

Thanks for your answer...

Edit: remove space intruced by mistake

Edited by ricky03
Link to comment
Share on other sites

Hello,

I test the latest FileInstallr v1.3.1.6 and I found a litlle strange thing...

Func _FileList()
    #cs
        No files were found.
    #ce

    Local $iReturn = 0
    $iReturn += FileInstall('', 'C:\Users\ab\Desktop' & '', 1)
    $iReturn += FileInstall('C:\Users\ab \Desktop\ADDERView CATx 1000\Motherboard', 'C:\Users\ab\Desktop' & '\Motherboard', 1)
    $iReturn += FileInstall('C:\Users\ab\Desktop\ADDERView CATx 1000\Firmware', 'C:\Users\ab\Desktop' & '\Firmware', 1)
    $iReturn += FileInstall('C:\Users\ab\Desktop\ADDERView CATx 1000\catxbrochure_7_051212_ web_0.pdf', 'C:\Users\ab\Desktop' & '\catxbrochure_7_051212_web_0.pdf', 1)
    $iReturn += FileInstall('C:\Users\ab\Desktop\ADDERView CATx 1000\avx1000_v1.pdf', 'C:\Users\ab\Desktop' & '\avx1000_v1.pdf', 1)
    $iReturn += FileInstall('C:\Users\ab\Desktop\ADDERView CATx 1000\AdderViewCATx_1000_v1_0e.pdf', 'C:\Users\ab\Desktop' & '\AdderViewCATx_1000_v1_0e.pdf', 1)
    $iReturn += FileInstall('C:\Users\ab\Desktop\ADDERView CATx 1000\Firmware\AdderView CATx1000_1.07.zip', 'C:\Users\ab\Desktop' & '\Firmware\AdderView CATx1000_1.07.zip', 1)
    $iReturn += FileInstall('C:\Users\ab\Desktop\ADDERView CATx 1000\Motherboard\13.11.01.00_Windows_MSM.zip', 'C:\Users\ab\Desktop' & '\Motherboard\13.11.01.00_Windows_MSM.zip', 1)
    Return $iReturn = 8
EndFunc   ;==>_FileList

Why the script count  during all stepsand at the end it send a fixed value?

Thanks for your answer...

I'm not 100% sure I understand you, but

Return $iReturn = 8

should just be

Return $iReturn

Else it is being set the value of 8 regardless of any success or failure.

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

FileInstall returns either 1 (success) or 0 (failure).

At the end, $iReturn contains the number of successfully FileInstall calls.

The _FileList function returns True or False. I could be written like this :

If $iReturn = 8 Then
    Return 1
Else
    Return 0
EndIf
Edited by jguinch
Link to comment
Share on other sites

also, 1st FileInstall() directs to a folder, which must return 0.

2nd FileInstall has an error in the path (whitespace after the username), so it must also return 0.

given that, relying on final count to indicate overall success seems kind of unreliable.

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
Share on other sites

@jguinch : it's right!!! I mix in my head, and the error don't come from this line!!!

But I have more problems, it creates an empty string in the first line

$iReturn += FileInstall('', 'C:\Users\ab\Desktop' & '', 1)

And don't create the folder on it :

$iReturn += FileInstall('C:\Users\ab\Desktop\ADDERView CATx 1000\Motherboard', 'C:\Users\ab\Desktop' & '\Motherboard', 1)

Why?

Link to comment
Share on other sites

If you want more than True or False returned, then you could get a count of how many failed.

Or you could code some IF statements and get the exact lines where the Install failed.

Func _FileList()    
     #cs         
     No files were found.     
     #ce     
     Local $iReturn = 0, $iFail = "", $iCheck = 0
     $iCheck = FileInstall('', 'C:\Users\ab\Desktop' & '', 1)
     If $iCheck <> 1 Then $iFail = "(1)"
     $iReturn = $iReturn + $iCheck
     $iCheck = FileInstall('C:\Users\ab \Desktop\ADDERView CATx 1000\Motherboard', 'C:\Users\ab\Desktop' & '\Motherboard', 1)     
     If $iCheck <> 1 Then $iFail &= "(2)"
     $iReturn = $iReturn + $iCheck
     $iCheck = FileInstall('C:\Users\ab\Desktop\ADDERView CATx 1000\Firmware', 'C:\Users\ab\Desktop' & '\Firmware', 1)     
     If $iCheck <> 1 Then $iFail &= "(3)"
     $iReturn = $iReturn + $iCheck
     $iCheck = FileInstall('C:\Users\ab\Desktop\ADDERView CATx 1000\catxbrochure_7_051212_ web_0.pdf', 'C:\Users\ab\Desktop' & '\catxbrochure_7_051212_web_0.pdf', 1)     
     If $iCheck <> 1 Then $iFail &= "(4)"
     $iReturn = $iReturn + $iCheck
     $iCheck = FileInstall('C:\Users\ab\Desktop\ADDERView CATx 1000\avx1000_v1.pdf', 'C:\Users\ab\Desktop' & '\avx1000_v1.pdf', 1)     
     If $iCheck <> 1 Then $iFail &= "(5)"
     $iReturn = $iReturn + $iCheck
     $iCheck = FileInstall('C:\Users\ab\Desktop\ADDERView CATx 1000\AdderViewCATx_1000_v1_0e.pdf', 'C:\Users\ab\Desktop' & '\AdderViewCATx_1000_v1_0e.pdf', 1)     
     If $iCheck <> 1 Then $iFail &= "(6)"
     $iReturn = $iReturn + $iCheck
     $iCheck = FileInstall('C:\Users\ab\Desktop\ADDERView CATx 1000\Firmware\AdderView CATx1000_1.07.zip', 'C:\Users\ab\Desktop' & '\Firmware\AdderView CATx1000_1.07.zip', 1)     
     If $iCheck <> 1 Then $iFail &= "(7)"
     $iReturn = $iReturn + $iCheck
     $iCheck = FileInstall('C:\Users\ab\Desktop\ADDERView CATx 1000\Motherboard\13.11.01.00_Windows_MSM.zip', 'C:\Users\ab\Desktop' & '\Motherboard\13.11.01.00_Windows_MSM.zip', 1)     
     If $iCheck <> 1 Then $iFail &= "(8)"
     $iReturn = $iReturn + $iCheck
     If $iReturn <> 8 Then $iReturn = "Some install lines failed, they were - " & $iFail
     Return $iReturn
EndFunc   ;==>_FileList

Just a simple quick approach, that could be streamlined some.

NOTE - I advise you check my coding, because it was all done in my browser, and I kept forgetting not to press TAB, which is why my code was posted before I finished it.

Edited by TheSaint

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

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