Jump to content

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


Blind41
 Share

Recommended Posts

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

  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 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

 

Link to comment
Share on other sites

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, 

 

Link to comment
Share on other sites

  • Moderators

Blind41,

My pleasure as always.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 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

 

Link to comment
Share on other sites

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

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...