skafreak_510 Posted October 26, 2005 Share Posted October 26, 2005 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 Link to comment Share on other sites More sharing options...
Skruge Posted October 26, 2005 Share Posted October 26, 2005 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] Link to comment Share on other sites More sharing options...
skafreak_510 Posted October 27, 2005 Author Share Posted October 27, 2005 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 = @DesktopDirand then add the var to where the other @DesktopDir? Link to comment Share on other sites More sharing options...
Valuater Posted October 27, 2005 Share Posted October 27, 2005 (edited) According to help@DesktopDir.... path to current user's Desktopi don't see the Administrators reference there????8) Edited October 27, 2005 by Valuater Link to comment Share on other sites More sharing options...
Valuater Posted October 27, 2005 Share Posted October 27, 2005 no, should I add this to the begining then?$desktop = @DesktopDirand then add the var to where the other @DesktopDir?this$desktop = @DesktopDiris one-in-the-sameit doesn't matter if you use the variable or the @...8) Link to comment Share on other sites More sharing options...
skafreak_510 Posted October 27, 2005 Author Share Posted October 27, 2005 (edited) According to helpi 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 October 27, 2005 by skafreak_510 Link to comment Share on other sites More sharing options...
BigDod Posted October 27, 2005 Share Posted October 27, 2005 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. 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 Link to comment Share on other sites More sharing options...
skafreak_510 Posted October 27, 2005 Author Share Posted October 27, 2005 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. Link to comment Share on other sites More sharing options...
BigDod Posted October 27, 2005 Share Posted October 27, 2005 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. 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 Link to comment Share on other sites More sharing options...
skafreak_510 Posted October 27, 2005 Author Share Posted October 27, 2005 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.thanksBut how do I write the address for a folder on my local server that is compadible with Autoit? Link to comment Share on other sites More sharing options...
BigDod Posted October 27, 2005 Share Posted October 27, 2005 thanksBut 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. 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 Link to comment Share on other sites More sharing options...
Valuater Posted October 27, 2005 Share Posted October 27, 2005 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 fileRunAsSet ( ["user", "domain", "password" [, options]] ) Parametersusername [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 onlyActully 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 folderhere 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) Link to comment Share on other sites More sharing options...
skafreak_510 Posted October 27, 2005 Author Share Posted October 27, 2005 It works well thanks. Link to comment Share on other sites More sharing options...
BigDod Posted October 27, 2005 Share Posted October 27, 2005 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. 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 Link to comment Share on other sites More sharing options...
skafreak_510 Posted October 27, 2005 Author Share Posted October 27, 2005 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() Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now