Blind41 Posted October 31, 2017 Share Posted October 31, 2017 Hello, I'm new on this forum and it's the first time I use AutoIT. I'm trying to create an .exe that 'll copy the content of a folder "contenttocopy" in another folder "mysoftware" using an AD account that is local Admin of the workstation. My script works like a charm in the IDE and with the .au3 extension but when I compile it in .exe it doesn't work at all. It's not an AV issue, I already turned off the AV and it still doesn't work. I tried to compile it with nearly all the options in SciTE (Shift + F7) . I really don't understand why it doesn't work. As I'm a newbie in AutoIT maybe I missed something ? #include <FileConstants.au3> $sSourceFolder = "\\myfileserver\mysoftware\contenttocopy" $sDestFolder = "C:\Program Files (x86)\mysoftware" $sUserName = "myusername" $sPassword = "mypassword" $sDomain = "mydomain" RunAs($sUserName, $sDomain , $sPassword, 0, @AutoItExe & ' /AutoIt3ExecuteLine "DirCopy(''' & $sSourceFolder & ''', ''' & $sDestFolder & ''', ''' & $FC_OVERWRITE & ''')"') Could you please help me to solve this issue ? Many Thanks Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 31, 2017 Moderators Share Posted October 31, 2017 Blind41, Welcome to the AutoIt forums. Quote Important Notes However, the executable must have been compiled with the #pragma compile(AutoItExecuteAllowed, True) directive as the default setting does not permit use of the /AutoItExecuteScript or /AutoItExecuteLine parameters. So I suggest adding that line at the top of the script and see if it works then. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Blind41 Posted October 31, 2017 Author Share Posted October 31, 2017 Hello Melba23 and thank you very much for your help ! You were right that was just this little line I missed , now everything works fine ! Thank you very much Here is the full script for those who desire to make the same thing : #pragma compile(AutoItExecuteAllowed, True) #include <FileConstants.au3> $sSourceFolder = "\\myfileserver\mysoftware\contenttocopy" $sDestFolder = "C:\Program Files (x86)\mysoftware" $sUserName = "myusername" $sPassword = "mypassword" $sDomain = "mydomain" RunAs($sUserName, $sDomain , $sPassword, 0, @AutoItExe & ' /AutoIt3ExecuteLine "DirCopy(''' & $sSourceFolder & ''', ''' & $sDestFolder & ''', ''' & $FC_OVERWRITE & ''')"') Best regards, Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 31, 2017 Moderators Share Posted October 31, 2017 Blind41, My pleasure as always. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
TheDcoder Posted October 31, 2017 Share Posted October 31, 2017 Not related to your question, but I would personally prefer making my script accept custom parameters like /copy "source" "destination" instead of using /AutoIt3ExecuteLine EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion 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