flippertie Posted January 3, 2005 Share Posted January 3, 2005 Autoit Newb here. I've been looking for a quick way to dump current date and time to the windows clipboard. I have a hotkey app that will run an exe - but couldnt find anything to generate the current date/time. But I found Autoit instead. So my first script is below. And it works! I type "dat", hit the F8 button and the date is inserted in my document. Simple stuff but it makes me happy! Questions: Would it be faster to compress the lscript down to one long line of code? Does it make much difference to the speed of execution if I compile the script? or copy code from <date.au3> instead of including it? Do you have any rough measurement of how much difference ? Obviously in a 2 line script it doesnt matter much, but when I grow into a code generating machine ;-) it might. and the scripts I write will mostly be hotkey/text related so saving a fraction of a second here and there makes a difference to the perception of how well it works. Thanks for any comments. ;---------------------------------------------------------------------------- ; AutoIt Version: 3.0 ; Date: 21-Dec-2004 ; Function: Push current date/time to clipboard and paste to current app ; Format = dd-MMM-yy hh:mm ; ---------------------------------------------------------------------------- ; Include preprogrammed Date functions #include <date.au3> ; $iformat 0 = Long name of the month 1 = Abbreviated name of the month $shortmonth = _DateMonthOfYear(@mon, 1 ) $MyTime = @hour & ":" & @min & " " $mydate = @mday & "-" & $shortmonth& "-" & StringRight( @year, 2 ) & " " ;MsgBox(1, "Test ", $mydate & $MyTime ,4 ) Send ( $mydate & $MyTime ) ClipPut ( $mydate & $MyTime ) Link to comment Share on other sites More sharing options...
buzz44 Posted January 3, 2005 Share Posted January 3, 2005 (edited) Autoit Newb here.Questions: Would it be faster to compress the lscript down to one long line of code?Does it make much difference to the speed of execution if I compile the script? or copy code from <date.au3> instead of including it? Do you have any rough measurement of how much difference ?Obviously in a 2 line script it doesnt matter much, but when I grow into a code generating machine ;-) it might. and the scripts I write will mostly be hotkey/text related so saving a fraction of a second here and there makes a difference to the perception of how well it works.question 1... wat is lscript, typo? and how are u going to compress itquestion 2... i dont think having the script compiled or not makes any difference, and if it did it would be very minimal, ie. milliseconds?hope that helps , im also very new to autoit too so dont just take my "advice", u should confirm with other ppl to Edited January 3, 2005 by burrup qq Link to comment Share on other sites More sharing options...
flippertie Posted January 3, 2005 Author Share Posted January 3, 2005 question 1... wat is lscript, typo? and how are u going to compress it Yup typo. Compress by putting it all in one statement - something like this: Send ( @mday & "-" & $shortmonth& "-" & StringRight( @year, 2 ) & " " & @hour & ":" & @min & " "). I could probably get the shortmonth into there as well. My real question is for the developers - When a script is compiled is there much performance penalty for splitting a long line of code into shorter ones. Short ones are easler to read but fewer lines compile faster code. Or that'w what I remember from a previous life when I was a programmer (Cobo?, Basic anyone....) Thanks, Link to comment Share on other sites More sharing options...
sugi Posted January 3, 2005 Share Posted January 3, 2005 "Compilation" for AutoIt only adds an wrapper to the AU3 script that interprets the script everytime you run the EXE-file. So there's practically no difference between a compiled script and an au3 scriptfile except that you only need to distribute the EXE-file if you want others to run your script. Link to comment Share on other sites More sharing options...
flippertie Posted January 5, 2005 Author Share Posted January 5, 2005 "Compilation" for AutoIt only adds an wrapper to the AU3 script that interprets the script everytime you run the EXE-file. So there's practically no difference between a compiled script and an au3 scriptfile except that you only need to distribute the EXE-file if you want others to run your script.<{POST_SNAPBACK}>Thanks for that. I guess that means trying to fit as much as possible into one line would make for fractionally faster scripts that are almost unreadable...Flip 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