AutoHotkey Community

It is currently May 27th, 2012, 5:40 am

All times are UTC [ DST ]




Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 1036 posts ]  Go to page Previous  1 ... 26, 27, 28, 29, 30, 31, 32 ... 70  Next
Author Message
 Post subject: AHK_L Bug
PostPosted: March 9th, 2010, 11:33 am 
Offline

Joined: December 7th, 2005, 8:29 am
Posts: 345
Hi,

I am using the latest build of AHK_L Unicode.

When running the following code I get the value "Error":
Genre_Renamer.ahk
Code:
Ini_File=%A_ScriptDir%\Genre_Renamer.ini

IniRead, MediaPath, %Ini_File%,Settings,Media_Path

msgbox, %MediaPath%


Genre_Renamer.ini
Code:
[Settings]
Media_Path=d:\series


Both file are UTF-8 the AHK script and the INI file. Does the Unicode version
Suppose to read UTF-8 files?

I get the error only if the INI is in UTF-8 encoding when reverting it to ANSI it works :shock:...

Attached is a zip file with both files:
Virus scan result
Download


Can you help?

_________________
(\__/) This is Bunny.
(='.'=) Cut, copy, and paste bunny onto your sig.
(")_(") Help Bunny gain World Domination.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 9th, 2010, 11:35 am 
Offline

Joined: May 27th, 2007, 9:41 am
Posts: 4999
@twhyman already discussed earlier in this thread I believe.

_________________
AHK FAQ
TF : Text files & strings lib, TF Forum


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 9th, 2010, 12:44 pm 
Offline

Joined: December 7th, 2005, 8:29 am
Posts: 345
@hugov: what was discussed earlier in this thread?

_________________
(\__/) This is Bunny.
(='.'=) Cut, copy, and paste bunny onto your sig.
(")_(") Help Bunny gain World Domination.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 9th, 2010, 12:47 pm 
Offline

Joined: May 27th, 2007, 9:41 am
Posts: 4999
@twhyman: ini format in UTF / unicode format so you are not reporting anything new if I remember correctly.

_________________
AHK FAQ
TF : Text files & strings lib, TF Forum


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 9th, 2010, 1:03 pm 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
twhyman, begin at majkinetor's post.

IniRead does little more than call GetPrivateProfileString, a standard Windows function. FYI, even ANSI builds of AutoHotkey support UTF-16 (as long as the OS supports it), the only difference is that extra conversions are done.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 11th, 2010, 1:01 am 
Greetings............. 8)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 13th, 2010, 1:24 am 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
Hi Lexikos,

I would like following to work for dynamic function call for objects, could you implement that?

Additionally it will save one character :)
Code:
obj := Object("base",Object("__Get", "Get"))

obj[1] ;currently possible and works as it should
obj.1 ;This line does not contain a recognized action.
Get(clr, name){
   MsgBox % name
}
;----------------Following requires AutoHotkey_H.exe -----------------
A:=WinDlls("Sleep")
start:=A_TickCount
A.Sleep.1000
MsgBox % A_TickCount - start
;--------------- Same script in one line works already -----------------
A:=WinDlls(),start:=A_TickCount,A.Sleep.1000
MsgBox % A_TickCount - start

_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 13th, 2010, 4:28 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
Sean wrote:
BTW, just for minor syntatic convenience.
Code:
cch  := pdoc.Characters.Count, pdoc.Close
This works without any error message, but, the following produces an error.
Code:
cch  := pdoc.Characters.Count
pdoc.Close ; have to use pdoc.Close()
[Original Post]

Lexikos wrote:
I made it a point not to allow that on its own since it shouldn't, by nature, have a side-effect; like writing "array%n%" alone on a line. Perhaps the minor convenience outweighs the "error-detection" and small risk of confusion (i.e. pdoc.close works but not pdoc.write "some text")?
[Original Post]

Sean wrote:
Actually I'm not particularly fond of it, I may exclusively use Excel.Quit(). I, probably some other users too, just don't like to remember exceptions like
Code:
ret := Excel.Quit ; allowed
Excel.Quit ; not allowed
[Original Post]


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 13th, 2010, 12:45 pm 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
I see, thanks.

_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 14th, 2010, 8:43 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
Quote:
Revision 49 - March 14, 2010
  • Added obj._NewEnum().
  • Added ObjMethod(obj) for each built-in obj._Method().
  • Changed: ObjSet/Get/Call can no longer be called/overridden by script.
  • Fixed: Potential crash caused by VK_PACKET check added in L48.
  • Fixed: Character codes in VK_PACKET events were potentially misinterpreted as scancodes.
  • Fixed: ExcludeText was ineffective after the first matching control. (See bug report.)
Source: AutoHotkey_L

Code:
; Create some sample data.
obj := Object("red", 0xFF0000, "blue", 0x0000FF, "green", 0x00FF00)

; Enumerate!
enum := obj._NewEnum()
While enum[k, v]
    t .= k "=" v "`n"
MsgBox % t


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 14th, 2010, 3:46 pm 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
Enum works great and very fast, thank you ;)

_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 14th, 2010, 6:04 pm 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
I'm just curious, why you took the route of obj._NewEnum() than for each. Of course obj._NewEnum() is more flexible than for each. BTW, I was tempted to use the following in this case, but you seemed to disallow it?
Code:
While enum[k] := v


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 16th, 2010, 3:47 am 
Sean wrote:
I'm just curious, why you took the route of obj._NewEnum() than for each.
I plan to implement for k,v in enum-expression over the top of _NewEnum, but deferred it since commands can currently only accept strings or variables (return is a special case).
Quote:
BTW, I was tempted to use the following in this case, but you seemed to disallow it?
Right. I think it only serves to mislead those not in the know, without adding any real meaning or convenience. I also think the main benefit of the _NewEnum approach is that a scripted object could override it; if that is done, Enum[k,v] and Enum[k]:=v would be ambiguous.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 16th, 2010, 6:44 am 
Offline

Joined: November 30th, 2008, 1:51 pm
Posts: 73
Hello,

I just apply some changes to AutoHotkeyU. It added shared file accesses
supports to FileOpen(), since I found it may be useful for some situations.

Perhaps you could apply this patch to AHK_L.

New flags:
Code:
SHARE_READ = 0x00000100
SHARE_WRITE = 0x00000200
SHARE_DELETE = 0x00000400


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 16th, 2010, 1:29 pm 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
Thanks. I've applied the patch and updated the downloads.


On a related note, I think we should replace (or supplement) the numeric flags with a more intuitive options string. I don't like having to refer to the documentation every time I want to call FileOpen. Perhaps something like this:
Code:
;First character indicates access mode
r   read
w   write
a   append
u   update (read/write)

;Subsequent characters are optional flags
r   SHARE_READ
w   SHARE_WRITE
d   SHARE_DELETE
`n  translate between `r`n and `n
`r  replace standalone `r with `n when reading

;Example
f := FileOpen(fn, "ar`n")  ; append and share read access

On another note, the methods used by some commands were implicitly (fopen) or explicitly (CreateFile) "sharing" the file. Some commands in AHKL/U were changed to use the TextStream class, so lock the file now - this might be problematic. The script below demonstrates these issues (keep in mind that in the real-world, the file could be read/written by some other application while the script is writing/reading it):
Code:
Loop, Read, %A_ScriptFullPath%
{   FileRead, s, %A_ScriptFullPath%
    break
}MsgBox % ErrorLevel

Loop, Read, %A_ScriptFullPath%
{   FileAppend, `n`;testing, %A_ScriptFullPath%
    break
}MsgBox % ErrorLevel
Standard AHK: both work.
Current builds: both fail.
Previous builds: FileRead works.

FileRead has the following comment:
Code:
// It seems more flexible to allow other processes to read and write the file while we're reading it.
// For example, this allows the file to be appended to during the read operation, which could be
// desirable, especially it's a very large log file that would take a long time to read.


It'll probably be easily fixed, when I get around to it. It'll be slightly less work now that the TextStream SHARE_* flags are in place. ;)


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 1036 posts ]  Go to page Previous  1 ... 26, 27, 28, 29, 30, 31, 32 ... 70  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group