AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

AutoHotkey_L : Arrays, Debugger, #If expression, etc.
Goto page Previous  1, 2, 3 ... 24, 25, 26 ... 28, 29, 30  Next
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
Lexikos



Joined: 17 Oct 2006
Posts: 4472
Location: Qld, Australia

PostPosted: Fri Feb 05, 2010 6:53 pm    Post subject: Reply with quote

majkinetor wrote:
and because you have to use Transform ToUnicode with output str's,
You can use "astr", but iirc it only allocates enough buffer space for the actual length of the input string. This really should be changed; perhaps using var capacity where available would be best. Typically the var capacity wouldn't be much greater than the length, except where it's actually needed.
Quote:
(making function that doesn't depend on Transform keyword is feasible, because AHK complains about "ToUnicode").
Did you mean "isn't feasible"? Actually, you can get around load-time validation by specifying at least a single deref (empty or otherwise):
Code:
Transform, out, ToCodePage%IfPossible%, 0, %in%

Tuncay wrote:
why that?
It was almost an afterthought, meant to provoke a comment. Currently the revision number takes a small amount of time and effort to maintain, which adds up, and has to some degree discouraged me from frequent updates. Since you and probably others see benefit to keeping the revision numbers, I will see what I can do to streamline it into my release process.
majkinetor wrote:
What happened with this fix ?
I was reluctant to make that change to my main branch immediately. I will soon.
Quote:
What I get is UTF-8 + BOM Config ini file with garbage.
How did you get it to output UTF-8? I presumed WritePrivateProfileString (and therefore IniWrite) only supported UTF-16 ("Unicode") and ANSI.
Quote:
If the file was created using Unicode characters, the function writes Unicode characters to the file. Otherwise, the function writes ANSI characters.
Source: WritePrivateProfileString Function

majkinetor wrote:
It works when test.ini is UTF8 but doesn't with UTF8+BOM when it returns error 2 (file not found).
Did you put the [Config] key on the first line? I think ERROR_FILE_NOT_FOUND could also mean it couldn't find the section in the file. It works for me, but only if [Config] is not on the first line (i.e. not on the same line as the BOM). This reaffirms my belief that Windows' ini functions do not have any direct support for UTF-8; rather, they reinterpret the UTF-8 data as ANSI.
jackieku wrote:
Some of them may not have "A" version
One thing to watch out for: at least one has an "A" version, a "W" version, and an ANSI version with neither suffix - ExtractIconEx. In that case the "W" suffix must be explicit for the Unicode version to be called, even in a Unicode build.
Back to top
View user's profile Send private message Visit poster's website
majkinetor



Joined: 24 May 2006
Posts: 4116
Location: Belgrade

PostPosted: Fri Feb 05, 2010 8:40 pm    Post subject: Reply with quote

Quote:
Currently the revision number takes a small amount of time and effort to maintain....

I guess you need to update your release script. I don't know what kind of effort you talk about, but its regular practice in automatic build environments to make this...well.. automatic.

Quote:
How did you get it to output UTF-8? I presumed WritePrivateProfileString (and therefore IniWrite) only supported UTF-16 ("Unicode") and ANSI.

I only executed those 2 lines of code I posted above and uploaded ini file generated. File didn't exist before that. (OS was VISTA). Executing the same thing on Win7 gives Unicode and everything works correctly.

Quote:
Did you put the [Config] key on the first line?

Yes.... That also explains why I was getting double Config section.
_________________
Back to top
View user's profile Send private message
Lexikos



Joined: 17 Oct 2006
Posts: 4472
Location: Qld, Australia

PostPosted: Sat Feb 06, 2010 8:00 am    Post subject: Reply with quote

majkinetor wrote:
... its regular practice in automatic build environments to make this...well.. automatic.
It is "automatic" in my release script; the real problem is that my release script isn't integrated with git. Eliminating the revision numbering would've meant one less thing to worry about when I redesign the script. Never mind though; I know what needs to be done.
Quote:
(OS was VISTA). Executing the same thing on Win7 gives Unicode and everything works correctly.
On my XP Pro SP3 32-bit VM, Vista Business 32-bit VM and Windows 7 Pro 64-bit (all "English (Australia)"), it creates the file with UTF-16, which displays correctly when opened in Notepad.
Back to top
View user's profile Send private message Visit poster's website
majkinetor



Joined: 24 May 2006
Posts: 4116
Location: Belgrade

PostPosted: Sat Feb 06, 2010 9:29 am    Post subject: Reply with quote

Quote:
the real problem is that my release script isn't integrated with git.
Yes, in my release scripts with SVN I first query the server via command line about last release number. I also have another technique - I don't have postbuild action but script (on the build computer) that constantly query svn for the logs. Depending on log metadata it checksout that revision, pack it, make necessary changes and ftp it.
_________________
Back to top
View user's profile Send private message
Lexikos



Joined: 17 Oct 2006
Posts: 4472
Location: Qld, Australia

PostPosted: Sat Feb 06, 2010 6:05 pm    Post subject: Reply with quote

I've updated the release script, and pre-built ANSI binaries are once again available.
majkinetor wrote:
Yes, in my release scripts with SVN I first query the server via command line about last release number.
I found that `git describe` will indicate what the last revision was (if it was tagged correctly) and how many commits I've done since then (whether or not I've pushed them to github). My script now uses this instead of a simple counter (IniWrite), and uses it in combinaton with `git log` to grab a rough list of changes since the last revision. I intend to commit more often, running the script only occasionally - to increment the revision number (and commit this change), tag, build, zip, update the version history.html and sync with autohotkey.net.


Anyway, to the real purpose of my post: obj.() vs %obj%(). It suddenly occurred to me (at 2:30am, incidentally) that the latter form would be possible and would probably be clearer/more intuitive. After a bit of searching, I found that I'd already figured it out months ago and written this comment in L31:
Code:
//if (deref->marker == cp && !cp[deref->length] && (deref+1)->is_function && deref->var->IsObject()) // L31: %varContainingObject%().  Possible future use: functions-as-values.
//{
//}
Which do you think is more appropriate: func.() or %func%()?
Back to top
View user's profile Send private message Visit poster's website
majkinetor



Joined: 24 May 2006
Posts: 4116
Location: Belgrade

PostPosted: Sat Feb 06, 2010 9:22 pm    Post subject: Reply with quote

I personally hate % % syntax. One of the features I was looking forward in mainstream ahk was $var (it was mentioned couple of time even by Chris iirc). Anyway, I care about functionality, so altho I prefer obj.() syntax I am ok with alternative. Obj.() is clearer to me because it clearly makes the difference between "default method call of an object" and "dynamic function call".

About your new release script, that was exactly I was talking about. I just recently switched to previously mentioned method of metasymbols in commit log. Its kinda cool, because you don't even have to launch build script. When I commit, if the log starts with *** version ... *** , my constantly looping build script sees it, it checkout it, then launches release procedure.
_________________
Back to top
View user's profile Send private message
Lexikos



Joined: 17 Oct 2006
Posts: 4472
Location: Qld, Australia

PostPosted: Sun Feb 07, 2010 1:43 am    Post subject: Reply with quote

majkinetor wrote:
Obj.() is clearer to me because it clearly makes the difference between "default method call of an object" and "dynamic function call".
I think that with values which represent functions, no distinction should be made between objects and names. This could be important; for instance, I've used code like f:=x.y, %f%(x) to ensure x is passed as a parameter to f - even if y is defined directly rather than through x.base. Currently it only works if y is a simple function name.

On the other hand, I can see that a distinction might be helpful in some cases, so I'll consider implementing both.
Back to top
View user's profile Send private message Visit poster's website
Lexikos



Joined: 17 Oct 2006
Posts: 4472
Location: Qld, Australia

PostPosted: Mon Feb 08, 2010 5:52 am    Post subject: Reply with quote

Quote:
Revision 45 - February 8, 2010
  • Added _GetAddress; _SetCapacity/_GetCapacity may now operate on a given field. [more info]
  • Added workaround for WM_PAINT infinite loop often caused by subclassing.
  • Allow obj.() as a means to call the default method of an object; equivalent to obj[""]().
  • Dev: Added solution and project files for MSBuild 4.0 & VS2010. [more info]
  • Fixed (Unicode): 'Running' column in ListHotkeys.
Source: AutoHotkey_L

Some things about x._SetCapacity(y,z) that I haven't mentioned in the documentation:
  • It will always attempt to resize the field, even if z is less than the current capacity.
  • Data is preserved where possible, but shrinking the field will truncate data.
  • The actual capacity in Unicode builds is always a multiple of two bytes.
  • One character is always reserved for a null-terminator; this is excluded from the capacity passed to _SetCapacity and returned from _SetCapacity and _GetCapacity.
obj.() and %obj%() were more complicated than I was expecting. Instead of removing a validation check for obj.(), I had to add an exception for '('. Wink Invalid syntax like obj.-1 or obj. spaced is still disallowed. %obj%() would've required some nasty hacks since it would need to insert a parameter between the object and parameter list; I've deferred it for a future revision, where I'll probably implement it as a separate built-in pseudo-function (like ObjCall).
majkinetor wrote:
What happened with this fix ?
As you can see, I've added it in this revision. Unfortunately I had lost the original source code for the test build I had given you. It was quite difficult to reproduce the fix at first; somehow the Unicode builds exhibited strange behaviour, only after applying the fix. Eventually I realized it was because your test case was calling CallWindowProcA, then the rest was easy. Laughing
Back to top
View user's profile Send private message Visit poster's website
majkinetor



Joined: 24 May 2006
Posts: 4116
Location: Belgrade

PostPosted: Mon Feb 08, 2010 10:15 am    Post subject: Reply with quote

Thx for updates. Smile Lolzor @ CallWindowProcA (I appreciate the underscore too)
_________________
Back to top
View user's profile Send private message
twhyman



Joined: 07 Dec 2005
Posts: 310

PostPosted: Mon Feb 08, 2010 4:28 pm    Post subject: Reply with quote

Hi,

Just downloaded the latest build from your site Revision 45.
placed autohotkey.exe in his place and placed the AutoHotkeySC.bin
Under the compiler folder.

When trying to compile to exe i get an error from the compiler:
Code:
Error: Error opening the destination file.


Am i doing something wrong?

Thanks,
Twhyman
_________________
(\__/) This is Bunny.
(='.'=) Cut, copy, and paste bunny onto your sig.
(")_(") Help Bunny gain World Domination.
Back to top
View user's profile Send private message
ruespe



Joined: 17 Jun 2008
Posts: 139

PostPosted: Mon Feb 08, 2010 10:19 pm    Post subject: Reply with quote

twhyman wrote:

Am i doing something wrong?

Thanks,
Twhyman
Yes. Close the already running compiled program first.
_________________
Greetings
Rog
Back to top
View user's profile Send private message
kakarukeys



Joined: 28 Sep 2009
Posts: 85

PostPosted: Tue Feb 09, 2010 5:01 am    Post subject: Reply with quote

I understand now the AHK_U is merged into AHK_L and there is a limited set of Unicode characters supported. Is there a plan to support Asian characters? Let me know what help is needed. I'm good in Chinese characters, if testing is needed, I may be able to help.
_________________
TypingAid autocompletion program made with AHK.
Back to top
View user's profile Send private message
twhyman



Joined: 07 Dec 2005
Posts: 310

PostPosted: Tue Feb 09, 2010 6:34 am    Post subject: Reply with quote

ruespe wrote:
twhyman wrote:

Am i doing something wrong?

Thanks,
Twhyman
Yes. Close the already running compiled program first.



Hi,

This is not the problem... Rolling Eyes I have tried many scripts to compile, Two computers, And when reverting to the the old AutoHotkeySC.bin the script is being compiled just fine.

Can someone try to compile using the latest version?

Any more ideas?

Thanks,
Twhyman
_________________
(\__/) This is Bunny.
(='.'=) Cut, copy, and paste bunny onto your sig.
(")_(") Help Bunny gain World Domination.
Back to top
View user's profile Send private message
Lexikos



Joined: 17 Oct 2006
Posts: 4472
Location: Qld, Australia

PostPosted: Tue Feb 09, 2010 10:29 am    Post subject: Reply with quote

kakarukeys wrote:
... and there is a limited set of Unicode characters supported.
No. Did you save the script as UTF-8 (or UTF-16) with BOM (Byte Order Mark)? If not, your script file is loaded according to the active code page, not Unicode.
twhyman wrote:
Can someone try to compile using the latest version?
Hmm, something's gone seriously wrong - those bin files are much larger than they should be. My latest build is half the size, which is still larger than I'd expect. I'll look into it.

Edit: Try downloading the files again. My post-build script had broken when I switched my main AutoHotkey.exe with a Unicode build. Specifically, FileRead was automatically converting the bin files from ANSI to UTF-16 (interpreting them as text). The last batch must've had the post-build script run twice without the bin being rebuilt in-between, thus quadrupling the size. Serves me right for neither using the new file I/O functionality nor being patient enough to do clean rebuilds. Smile
Back to top
View user's profile Send private message Visit poster's website
twhyman



Joined: 07 Dec 2005
Posts: 310

PostPosted: Tue Feb 09, 2010 11:41 am    Post subject: Reply with quote

Hi,

I re-downloaded the bin files, And its working now Very Happy I was wondering too why the SC bin file was 2Mb Cool

P.S
How can i change the ahk_class of the GUI window from AutoHotkeyGUI to a string I like, In the regular AHK I did that by Hex editing the SC bin file, Now I cannot find that string anymore.

Thanks and keep up the very good and impressive work you do,
Twhyman
_________________
(\__/) This is Bunny.
(='.'=) Cut, copy, and paste bunny onto your sig.
(")_(") Help Bunny gain World Domination.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2, 3 ... 24, 25, 26 ... 28, 29, 30  Next
Page 25 of 30

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group