OceanOwl Posted July 30, 2013 Share Posted July 30, 2013 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 More sharing options...
Moderators Melba23 Posted July 30, 2013 Moderators Share Posted July 30, 2013 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 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...
OceanOwl Posted July 30, 2013 Author Share Posted July 30, 2013 No AV running Link to comment Share on other sites More sharing options...
Mat Posted July 30, 2013 Share Posted July 30, 2013 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 AutoIt Project Listing Link to comment Share on other sites More sharing options...
OceanOwl Posted July 30, 2013 Author Share Posted July 30, 2013 Thanks Mat for the suggestion using Mod, but the performance remains the same after compile to exe. The script runs instantly when in au3 format Link to comment Share on other sites More sharing options...
Mat Posted July 30, 2013 Share Posted July 30, 2013 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? AutoIt Project Listing Link to comment Share on other sites More sharing options...
OceanOwl Posted August 2, 2013 Author Share Posted August 2, 2013 (edited) 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 August 2, 2013 by OceanOwl Link to comment Share on other sites More sharing options...
OceanOwl Posted August 2, 2013 Author Share Posted August 2, 2013 by the way, I am using ver 3.3.8.1, without UPX Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 2, 2013 Moderators Share Posted August 2, 2013 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. 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...
Mat Posted August 2, 2013 Share Posted August 2, 2013 Have you tried with another, completely different image? Perhaps it is the images themselves that are causing the problem. 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. AutoIt Project Listing Link to comment Share on other sites More sharing options...
OceanOwl Posted August 5, 2013 Author Share Posted August 5, 2013 Hi all thanks for the inputs. Able to share what advance software I can use to monitor the 10s? Link to comment Share on other sites More sharing options...
DW1 Posted August 5, 2013 Share Posted August 5, 2013 You could try procmon. Start the capture just before launching the executable, and stop the capture after it is done executing. 10 seconds is a really long time. No AV at all? I suppose that could ultimately be the issue as well if the machine is full of file infectors and their friends. AutoIt3 Online Help 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