Sign in to follow this  
Followers 0
ricky

FileInstallr counting bug?

8 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
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.


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

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

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

@obs : the space is my mistake, I modify it manually!

I agree with the test made by jguinch.

We will have more info if guinness post...

Share this post


Link to post
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?

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

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

AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

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

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