Sign in to follow this  
Followers 0
skafreak_510

folder move

15 posts in this topic

Ok so after I compile this script it creates the Dir but it doesn't copy the files. Ascripts is a folder and I want it to copy the files inside the folder.

its not working

#NoTrayIcon

AutoItSetOption("RunErrorsFatal", 0)
AutoItSetOption("TrayIconHide", 1)
Break(0)
$USERNAME = "Administrator"
$PASSWORD = "*"
$RUN = 0   ; run indicator

; retrieve the cycle from commandline
If $CMDLINE[0] = 1 Then $RUN = $CMDLINE[1]
If $RUN = 0 Then
   RunAsSet($USERNAME, @ComputerName, $PASSWORD)
   Run('"' & @ScriptFullPath & '" " 1"')
   If @error Then MsgBox(4096+32,"Error", "Error starting under admin mode")
   Exit
EndIf

   DirCreate ( "C:\Program Files\Ascripts" )

   FileCopy ( @DesktopDir & "\Ascripts", "C:\Program Files\Ascripts" ,1)

RunAsSet()

any ideas,

thanks

Share this post


Link to post
Share on other sites



Keep in mind that @DesktopDir wil refer to the Administrator's desktop... is this what you were expecting?


[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Share this post


Link to post
Share on other sites

Keep in mind that @DesktopDir wil refer to the Administrator's desktop... is this what you were expecting?

no, should I add this to the begining then?

$desktop = @DesktopDir

and then add the var to where the other @DesktopDir?

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

According to help

@DesktopDir.... path to current user's Desktop

i don't see the Administrators reference there????

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

no, should I add this to the begining then?

$desktop = @DesktopDir

and then add the var to where the other @DesktopDir?

this

$desktop = @DesktopDir

is one-in-the-same

it doesn't matter if you use the variable or the @...

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

According to help

i don't see the Administrators reference there????

8)

$USERNAME = "Administrator"
$PASSWORD = "*"
$RUN = 0 ; run indicator

; retrieve the cycle from commandline
If $CMDLINE[0] = 1 Then $RUN = $CMDLINE[1]
If $RUN = 0 Then
   RunAsSet($USERNAME, @ComputerName, $PASSWORD)
   Run('"' & @ScriptFullPath & '" " 1"')

So the script is being run as Admistrator, loading the admin profile. This has been my problem, and the change I made doesn't work.

any ideas?

I changed it to a var because I thought I would be able to get the state of the current user before it ran as admin.

Actully it would be better if I was just able to get the file off of a local server seeing as I have to do it for several comps.

FileCopy ( $local server folder & "\Ascripts.*.*", "C:\Program Files\Ascripts\" ,1)

but I don't know how to get the address for the folder

Edited by skafreak_510

Share this post


Link to post
Share on other sites

Shoot me down if I am wrong but should you not be using DirCopy which will create the directory structure if it does not exist.



Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

Shoot me down if I am wrong but should you not be using DirCopy which will create the directory structure if it does not exist.

DirCopy? I'm using DirCreate and FileCopy.

Share this post


Link to post
Share on other sites

DirCopy? I'm using DirCreate and FileCopy.

The point I am makeing is that if you use DirCopy you do not need to use Dircreate and FileCopy. If you want to keep useing your version should you not be using \Ascripts\*.* to copy the files in the folder.


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

The point I am makeing is that if you use DirCopy you do not need to use Dircreate and FileCopy. If you want to keep useing your version should you not be using \Ascripts\*.* to copy the files in the folder.

thanks

But how do I write the address for a folder on my local server that is compadible with Autoit?

Share this post


Link to post
Share on other sites

thanks

But how do I write the address for a folder on my local server that is compadible with Autoit?

You could use DriveMapAdd and later use DriveMapDel to remove the mapping.


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

So the script is being run as Admistrator, loading the admin profile. This has been my problem, and the change I made doesn't work.

any ideas?

I changed it to a var because I thought I would be able to get the state of the current user before it ran as admin.

see the options... read the entire help file

RunAsSet ( ["user", "domain", "password" [, options]] )

Parameters

username [optional] The user name to use.

domain [optional] The domain name to use.

password [optional] The password to use.

options [optional] 0 = do not load the user profile, 1 = (default) load the user profile, 2 = use for net credentials only

Actully it would be better if I was just able to get the file off of a local server seeing as I have to do it for several comps.

FileCopy ( $local server folder & "\Ascripts.*.*", "C:\Program Files\Ascripts\" ,1)

but I don't know how to get the address for the folder

here is a test for you

$output = FileOpen("\\YOUR COMPUTER NAME\c on stelth\temp\test2.txt",1); this worked on mine ....AND ALL MY OTHERS TOO @!@! 8)

filewriteline($output,"This was written successfully by " & @ComputerName)

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

It works well thanks.

Share this post


Link to post
Share on other sites

It works well thanks.

Which version worked. I ask so that anyone with a similar problem in the future will find the correct solution by searching the forums.


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

Which version worked. I ask so that anyone with a similar problem in the future will find the correct solution by searching the forums.

#NoTrayIcon

$Desktop = @DesktopDir

AutoItSetOption("RunErrorsFatal", 0)
AutoItSetOption("TrayIconHide", 1)
Break(0)
$USERNAME = "Administrator"
$PASSWORD = "*"
$RUN = 0   ; run indicator

; retrieve the cycle from commandline
If $CMDLINE[0] = 1 Then $RUN = $CMDLINE[1]
If $RUN = 0 Then
   RunAsSet($USERNAME, @ComputerName, $PASSWORD)
   Run('"' & @ScriptFullPath & '" " 1"')
   If @error Then MsgBox(4096+32,"Error", "Error starting under admin mode")
   Exit
EndIf

   DirCopy ( "\\local server\Ascripts\", "C:\Program Files\Ascripts\" ,1)
RunAsSet()

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