Jump to content

need my code tested


Bert
 Share

Recommended Posts

I'm designing a script, and I need to make sure what I designed works the way it should. In my testing, it works as expected, but I only have my laptop to check it on. The script is pretty basic. In its current form, it is simply a window with a input field put to read only. I have a button that allows you to select a folder. I put in a filter that will check to see if certain drives are selected, a error will occur with a msgbox. If the selection passed the filter, the data is written to a ini file, and the input field is updated.

What I need to make sure of is that the filter works as designed. I would be thankful if some folks would check the script.

; Script will have includes from the original design. 

#include<Date.au3>
#Include<GuiConstants.au3>
#Include<File.au3>
#include<Array.au3>
#include<Process.au3>
#include<Misc.au3>

DIM $ini1
DIM $savepath
DIM $ini = @ScriptDir & "/PCT_tool.ini"
;-----------------------------------------------------------------------------------------------------------
GuiCreate("PC Transplant Automation Tool", 785, 326,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$lable_1 = GUICtrlCreateLabel("Final Backup Location: " & $ini1, 10,9, 220, 20)

$button_1 = GUICtrlCreateButton("Change", 315, 24, 50, 22);Final Backup Location:

$Edit_1 = GuiCtrlCreateEdit("", 590, 70, 180, 230);list the profiles
$edit_2 = GUICtrlCreateInput("", 10, 25, 300, 20, $ES_READONLY)
GUICtrlSetData($edit_2,IniRead($ini, @UserName, '1',''))

$group_1 = GUICtrlCreateGroup("", 3, 0, 370, 50)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $button_1
        _FinalDestination()
    Case Else
        ;;;
    EndSelect
WEnd
Exit


func _FinalDestination()
    While 1
        $savepath = FileSelectFolder("Select the final location the PC Transplant backups will be placed", "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}", 7)
        $filter1 = 'D:\E:\F:\G:\H:\I:\J:\K:\L:\M:\N:\O:\P:\Q:\R:\S:\T:\U:\V:\W:\X:\Y:\Z:\'
        $check_left = StringLeft($savepath, 3)
        $ccc = StringInStr($filter1, StringStripWS($check_left, 8))
        Select
            case $savepath = ""
                ExitLoop
            case $ccc > 0
                IniWrite($ini, @UserName, "1", $savepath)
                GUICtrlSetData($edit_2,$savepath)
                ExitLoop                
            Case $ccc = 0
                MsgBox(16, 'Error', "The Final Location you select: "&@CRLF&""&@CRLF&"   """&$savepath&""""&@CRLF&""&@CRLF&"is not supported. Please select again.")
        EndSelect
    WEnd    
EndFunc
Link to comment
Share on other sites

I think it works for me. I'm a little confused on what it is doing. I picked a folder, and it wrote to the ini file the name of it.

[my username here]

1=E:\folder name\blahblah\blah

Like that. It worked for folders in my E: drive, but wasn't working for the C, and gave me the msgbox you mentioned.

If that's all it's doing, then it works for me.

I'm running XP Pro.

Link to comment
Share on other sites

What it is supposed to do is not allow you to select any LOCAL drives: A:\, C:\.

"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}" - CLSID for "My Computer". What OS are you running?

While I was out to dinner, I thought I would need to add support for a networked computer.

I do not plan to support 95, 98, or ME. I'm making the script for 2000, XP, and possibly Vista, depending on if Vista doesn't have a security issue with it. Knowing my luck with Vista, the script will be pegged as bad and not allowed to run at all.

If you have used PC transplant, you know the tool lets you transplant your settings and data from one PC to another. The problem is you have to plug in a bunch of settings each time you use it. Also, if you save the transplant file locally first, you run the risk of messing up. (been there, done that, got yelled at by the user when I lost their stuff) I'm making a front end that has all the settings I need, and some safety features such as space checks and alarms to let you know the job is done.

Edited by Volly
Link to comment
Share on other sites

Well, if LOCAL means the drive is physically contained within my system unit, then my E: drive is local. I have two hard drives.

One has two partitions, C and E, the other is F. Windows is on C, on the same hard drive, but a different partition than E. It let me choose E.

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