Jump to content
Sign in to follow this  
StOngeCompany

Simple Move Directory Script

Recommended Posts

StOngeCompany

Hello AutoIt Forums,

I'm trying to create a simple script that perfoms the following functions:

1) Collect User Name

2) Move directories from a network drive (W:\) to the local computer

3) Organize directories on the local computer

Here is my script so far:

; Gather User Name

$user = InputBox("SOCO AutoCAD Installer", "Please enter your User Name.")

; Create Directory

DirCreate("C:\Program Files\AutoCAD 2010\SOCO")

; Copy Directories

DirCopy("W:\Installs\SOCAD_r7.0", "C:\Program Files\AutoCAD 2010\SOCO", 1)
DirCopy("C:\Program Files\AutoCAD 2010\SOCO\setup\support\acad_pgp", "C:\Users\" & $user & "\AppData\Local\AutoDesk\AutoCAD 2010\R16.2\enu\Support")
DirCopy("C:\Program Files\AutoCAD 2010\SOCO\setup\support\acad_lsp", "C:\Program Files\AutoCAD 2010\Support")
DirCopy("C:\Program Files\AutoCAD 2010\SOCO\setup\support\acad_cui", "C:\Users\" & $user & "\AppData\Local\AutoDesk\AutoCAD 2010\R16.2\enu\Support")
DirCopy("C:\Program Files\AutoCAD 2010\SOCO\setup\support\ToolPalette", "C:\Users\" & $user & "\AppData\Local\AutoDesk\AutoCAD 2010\R16.2\enu\Support\ToolPalette")
DirCopy("C:\Program Files\AutoCAD 2010\SOCO\setup\support\RegisteredTools", "C:\Users\" & $user & "\AppData\Local\AutoDesk\AutoCAD 2010\R16.2\enu\Support\RegisteredTools")
DirCopy("C:\Program Files\AutoCAD 2010\SOCO\setup\support\Profiles", "C:\Users\" & $user & "\AppData\Local\AutoDesk\AutoCAD 2010\R16.2\enu\Support\Profiles")
DirCopy("C:\Program Files\AutoCAD 2010\SOCO\plotters", "C:\Users\" & $user & "\AppData\AutoDesk\Local\AutoCAD 2010\R16.2\enu\Plotters")

; Delete File

FileDelete("C:\Users\" & $user & "\AppData\Local\AutoDesk\AutoCAD 2010\R16.2\enu\Support\acad.mnr")

; Inform User of Completion

MsgBox(4096, "SOCO AutoCAD Installer", "SOCO AutoCAD installation complete!")

The script creates the AutoCAD directory but doesn't copy any directories! Is DirCopy not the command I should be using?

Thanks so much for any help!,

DJ Berndt

Share this post


Link to post
Share on other sites
ahmed9100

Hello AutoIt Forums,

I'm trying to create a simple script that perfoms the following functions:

1) Collect User Name

2) Move directories from a network drive (W:\) to the local computer

3) Organize directories on the local computer

Here is my script so far:

; Gather User Name

$user = InputBox("SOCO AutoCAD Installer", "Please enter your User Name.")

; Create Directory

DirCreate("C:\Program Files\AutoCAD 2010\SOCO")

; Copy Directories

DirCopy("W:\Installs\SOCAD_r7.0", "C:\Program Files\AutoCAD 2010\SOCO", 1)
DirCopy("C:\Program Files\AutoCAD 2010\SOCO\setup\support\acad_pgp", "C:\Users\" & $user & "\AppData\Local\AutoDesk\AutoCAD 2010\R16.2\enu\Support")
DirCopy("C:\Program Files\AutoCAD 2010\SOCO\setup\support\acad_lsp", "C:\Program Files\AutoCAD 2010\Support")
DirCopy("C:\Program Files\AutoCAD 2010\SOCO\setup\support\acad_cui", "C:\Users\" & $user & "\AppData\Local\AutoDesk\AutoCAD 2010\R16.2\enu\Support")
DirCopy("C:\Program Files\AutoCAD 2010\SOCO\setup\support\ToolPalette", "C:\Users\" & $user & "\AppData\Local\AutoDesk\AutoCAD 2010\R16.2\enu\Support\ToolPalette")
DirCopy("C:\Program Files\AutoCAD 2010\SOCO\setup\support\RegisteredTools", "C:\Users\" & $user & "\AppData\Local\AutoDesk\AutoCAD 2010\R16.2\enu\Support\RegisteredTools")
DirCopy("C:\Program Files\AutoCAD 2010\SOCO\setup\support\Profiles", "C:\Users\" & $user & "\AppData\Local\AutoDesk\AutoCAD 2010\R16.2\enu\Support\Profiles")
DirCopy("C:\Program Files\AutoCAD 2010\SOCO\plotters", "C:\Users\" & $user & "\AppData\AutoDesk\Local\AutoCAD 2010\R16.2\enu\Plotters")

; Delete File

FileDelete("C:\Users\" & $user & "\AppData\Local\AutoDesk\AutoCAD 2010\R16.2\enu\Support\acad.mnr")

; Inform User of Completion

MsgBox(4096, "SOCO AutoCAD Installer", "SOCO AutoCAD installation complete!")

The script creates the AutoCAD directory but doesn't copy any directories! Is DirCopy not the command I should be using?

Thanks so much for any help!,

DJ Berndt

im not an expert on auto it but may by because u r using (w:\) but network using an ip address or user name like

\\192.168.0.1 or \\username

Share this post


Link to post
Share on other sites
SKlocke

Can you enter the user name of the windows user that is logged in?

This way, you could verify that it is not because of some access rights restrictions that could apply.

Share this post


Link to post
Share on other sites
GEOSoft

Are you sure you are even connecting to drive w:? All of that code should be re-written anyway but try it one or two steps at a time and verify what's happening.

#include<array.au3> ;; For test purposes only
$aDrives = DriveGetDrive("Network")
If Not @error Then
    _ArrayDisplay($aDrives, "Network Drives")
    For $i = 1 To Ubound($aDrives) -1
        $sMap = DriveGetMap($aDrives[$i])
        MsgBox(0, "Results", "Error code: " & @Error & @CRLF & "Drive " & $aDrives[$i] & " is mapped to: " & $sMap)
    Next
EndIf

This should show if something is not correct before you even think of the copy process. That part comes at a later stage, and it comes WITH error checks or you will be in for major disappointments at some point.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites
StOngeCompany

The reason it wasn't copying is because of a permissions issue. I am running Windows 7 and the script worked fine under my XP virtual machine. Does anyone know of a way to run the script without turning off UAC? I

Share this post


Link to post
Share on other sites
omikron48

#RequireAdmin?

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.