SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 7 of 7
  1. #1
    Senior Member
    Join Date
    Nov 2008
    Posts
    119
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Retrieving folder size/or that there are contents

    Hi all,

    I'm writing a simple uninstall install script, but I also want to check to make sure that the folder i've specified the program to install to, was installed correctly in that sub folder.


    Example: The program should install under C:\Program Files\Folder\Subfolder



    I have tried so far:

    FileSystem Object
    The built in aqFileSystem

    But they always through back a VB script error when it gets to that line of code. Can anyone help me find this so that it will return the value back to me, either in the log, msg box etc?



    Example: The program should install under C:\program Files\Folder\Subfolder

  2. #2
    Senior Member
    Join Date
    Jul 2008
    Posts
    1,049
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Retrieving folder size/or that there are contents

    Hi dana1047,

    Please describe the task you need to accomplish in detail. Also, please post the problematic script and the error message you get to this forum so we can try to find the cause of the problem you face.
    Regards,
    Allen - SmartBear Support

  3. #3
    Member
    Join Date
    Jan 2008
    Location
    Logan, Utah
    Posts
    33
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Retrieving folder size/or that there are contents

    Sorry this is in Jscript, but if you are simply trying to identify whether or not files and folders exist or not here is an example from my project.

    <font class="small">Code:</font><hr /><pre> var LocalStorage = "C:\\ProgramData\\IsolatedStorage"
    var user = Sys.UserName
    var UserStorage = "C:\\Users\\"+user+"\\AppData\\Local\\IsolatedStor age"

    if(aqFileSystem.Exists(LocalStorage))
    aqFileSystem.DeleteFolder(LocalStorage, true)
    if(aqFileSystem.Exists(UserStorage))
    aqFileSystem.DeleteFolder(UserStorage, true)</pre><hr />

    Does this answer your question?
    Russell Leikis
    Software QA Engineer - Automation Lead
    Ophir-Spiricon, Inc.

  4. #4
    Senior Member
    Join Date
    Nov 2008
    Posts
    119
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Retrieving folder size/or that there are contents

    Russ-

    That Sorta answers my question but I don't want to delete the folder. I am walking through an installation and at the end I want to check to make sure that the file installed in the correct folder,therefore I figured I could just grabe the foldersize (the folder always exists on the harddrive even after app is uninstalled). Knowing that if the foldersize is greater than 0, then the app installed correctly. Hopefully that makes sense. I am working with name mapping to make it easier. Here is my script so far which works, but when I try to use aqfilesystem.getfolderinfo(path) it gives me the red x like the code is having a syntax error.

    Here is my code for the install. After it logs that installation is complete is when I wanted to check the folderinfo:

    Sub Install 'To install edoc and check installation folders
    Dim edocinstall
    Dim InstallWindowNext
    Dim InstallWindowNext2
    TestedApps.edoc.Run
    Set edocinstall=Aliases.Sys.edoc.Installer
    Set InstallWindowNext=edocinstall.Next
    BuiltIn.Delay(8000)
    InstallWindowNext.ClickButton
    edocinstall.Yes.ClickButton
    Set InstallWindowNext2=edocinstall.Next2
    InstallWindowNext2.ClickButton
    InstallWindowNext.ClickButton
    InstallWindowNext2.ClickButton
    edocinstall.Next8.ClickButton
    InstallWindowNext.ClickButton
    BuiltIn.Delay(75000)
    Log.Picture(Sys.Desktop) 'Screenshot is taken of add-ins during installation and added to log.
    edocinstall.Finish.ClickButton
    Log.Message("Installation is complete")
    End Sub

  5. #5
    Member
    Join Date
    Jan 2008
    Location
    Logan, Utah
    Posts
    33
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Retrieving folder size/or that there are contents

    I wrote this and it works, I'm not sure why it would be flagging a syntax error for you. From the little I understand about VBscript, I got errors when using Set on the path and size variables, but had to use Set on fInfo because GetFolderInfo returns an object. (I think that's right..) That was the worst part for me. There are a few VB experts on here that may be able to help more than I can.

    <font class="small">Code:</font><hr /><pre>Sub test
    Dim path, fInfo, size
    path = "C:\New Folder"
    Set fInfo = aqFileSystem.GetFolderInfo(path)
    size = StrToInt(fInfo.Size)
    If size = 0 Then
    Log.Error("Folder is Empty. Application was not installed.")
    End If
    End Sub</pre><hr />

    Hope that helps. Let us know if this snippet doesn't work for you.
    Russell Leikis
    Software QA Engineer - Automation Lead
    Ophir-Spiricon, Inc.

  6. #6
    Senior Member
    Join Date
    Jul 2008
    Posts
    1,049
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Retrieving folder size/or that there are contents

    Hi dana1047,

    The code you posted was parsed successfully by our VBScript parser. If the routine provided by Russell does not suit your needs or if you have problems with some other code, please post the problematic code here so we can try to help you.
    Regards,
    Allen - SmartBear Support

  7. #7
    Senior Member
    Join Date
    Nov 2008
    Posts
    119
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Retrieving folder size/or that there are contents

    Russell and Allen,

    The script you wrote did work successfully! I tweaked the if then statement a little to suit my needs and log a message if it is successful and another if it is not.

    The exact problem I was getting was because I did not use set finfo=aqfilesystem.

    I followed the help file and did not use set and it was throwing errors!

    Thanks so much!

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 10.71%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 04:01 AM.

Copyright BetaSoft Inc.