Jump to content

Slow Loading after compile simple script


Recommended Posts

Below is my script to display an image base on different days of month.
Au3 display the image immediately.
But after compile to exe, it takes about 10s to load.
What am I doing wrong?
 
=========================================
#include <Misc.au3>
#include <Date.au3>
 
Local $hDLL = DllOpen("user32.dll")
Local $sJulDate = _DateToDayValue(@YEAR, @MON, @MDAY)
Local $RefDate = 2456293
Local $DDays = $sJulDate - $RefDate
Local $PageDay = $DDays
 
While $PageDay>31
   $PageDay=$PageDay-31
WEnd
 
$PageDay = Round($PageDay)
 
$destination = "C:LoginScreenImage" & $PageDay & ".jpg"
 
SplashImageOn("Login Screen", $destination, @DesktopWidth, @DesktopHeight, -1, -1,1)
Sleep(1000)
 
While 1
   If _IsPressed("1B", $hDLL) Then
      exitloop
   EndIf
WEnd
 
SplashOff()
 
=========================================
Link to comment
Share on other sites

  • Moderators

OceanOwl,

Welcome to the AutoIt forum. :)

What am I doing wrong?

Probably nothing - I imagine it is just your AV taking its time to check the executable. ;)

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

You may be interested to know that this loop here:

While $PageDay>31
    $PageDay=$PageDay-31
WEnd

Is the equivalent of the Mod() function (See Modulo operation):

$PageDay = Mod($PageDay, 31)

With the exception of when $PageDay is an exact multiple of 31 (when Mod will return 0 and your loop will return 31). To get around that just add an if test:

$PageDay = Mod($PageDay, 31)
If $PageDay = 0 Then $PageDay = 31

You'd also want to round it before you use Mod rather than after, as Mod will truncate the value (as if using the Floor or Int function) and you want to use Round.

No idea why your image isn't loading but I thought you might want to learn something new :)

Link to comment
Share on other sites

10s to load is a bit vague.

There are two or three possibilities. The first is that after clicking the exe it is taking 10s for the exe to actually run. Autoit might be taking 10s to start running the script. Or there is something in your script taking 10s to work.

If you have a message box at the start of the script then does it show instantly?

Link to comment
Share on other sites

I'll tested the adding the 1st line with a msgbox, it takes 10s to load.

So it is the decompiling (running) of the compiled exe takes long.

You can use the script to test out if it is the same in your machine?

From a 2kb AU3 script, when compile it becomes 722kb.

Edited by OceanOwl
Link to comment
Share on other sites

  • Moderators

OceanOwl,

I compiled your script (using my .jpg file) with v3.3.8.1 and no upx - it loaded instantly. :)

Have you tried with another, completely different image? Perhaps it is the images themselves that are causing the problem. :huh:

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

Have you tried with another, completely different image? Perhaps it is the images themselves that are causing the problem. :huh:

That's what I was trying to find out by asking whether a message box at the beginning worked instantly. It did, therefore the issue is with the computer running the exe, rather than anything his code is doing.

These sorts of problems are most likely AVs scanning the exe before it's run, but the OP has already said this can't be the problem.

I very much doubt the problem is anything to do with AutoIt. 10 seconds is a long time and no-one else has seen anything like this.

OceanOwl, does this same problem occur with other compiled autoit scripts on your pc? You are going to have to provide a bit more information about your setup as well (os version, basic computer specs maybe).

Other than that, this is an issue with the OS before it even gets as far as running AutoIt, so I'm not sure how much help we can be. There are a few advanced program monitors that could tell you what the computer is doing in those 10 seconds which could help, but with something as big and complex as windows its a little tricky to track down a quiet error like this.

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...