Jump to content
Blind41

My compiled .exe script doesn't work but in IDE it works fine

Recommended Posts

Blind41

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 

Share this post


Link to post
Share on other sites
Melba23

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._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Blind41

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  :D

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, 

 

Share this post


Link to post
Share on other sites
Melba23

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._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
TheDcoder

Not related to your question, but I would personally prefer making my script accept custom parameters like /copy "source" "destination" instead of using /AutoIt3ExecuteLine :)


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Spoiler

My contributions to the AutoIt Community

Some messages & Apologizes:

If I hurt you, Please accept my apologies, I never (regardless of the situation) mean to hurt anybody!!!

Also, I am very busy with my project so I will appear in the last row of the online list, if you want to contact me: Email@TheDcoder.xyz

Or you can have a nice chat with me in freenode, I use the same nick on freenode too!

3fHNZJ.gif

PLEASE JOIN ##AutoIt AND HELP THE IRC AUTOIT COMMUNITY!

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

×

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.