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, x64, COM, #If expression ...
Goto page Previous  1, 2, 3 ... 28, 29, 30 ... 68, 69, 70  Next
 
This topic is locked: you cannot edit posts or make replies.    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
twhyman



Joined: 07 Dec 2005
Posts: 339

PostPosted: Tue Mar 09, 2010 10:33 am    Post subject: AHK_L Bug Reply with quote

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

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.
Back to top
View user's profile Send private message
SoLong&Thx4AllTheFish



Joined: 27 May 2007
Posts: 4999

PostPosted: Tue Mar 09, 2010 10:35 am    Post subject: Reply with quote

@twhyman already discussed earlier in this thread I believe.
_________________
AHK Wiki FAQ
TF : Text files & strings lib, TF Forum
Back to top
View user's profile Send private message
twhyman



Joined: 07 Dec 2005
Posts: 339

PostPosted: Tue Mar 09, 2010 11:44 am    Post subject: Reply with quote

@hugov: what was discussed earlier in this thread?
_________________
(\__/) 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
SoLong&Thx4AllTheFish



Joined: 27 May 2007
Posts: 4999

PostPosted: Tue Mar 09, 2010 11:47 am    Post subject: Reply with quote

@twhyman: ini format in UTF / unicode format so you are not reporting anything new if I remember correctly.
_________________
AHK Wiki FAQ
TF : Text files & strings lib, TF Forum
Back to top
View user's profile Send private message
Lexikos



Joined: 17 Oct 2006
Posts: 7299
Location: Australia

PostPosted: Tue Mar 09, 2010 12:03 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message Visit poster's website
Guest






PostPosted: Thu Mar 11, 2010 12:01 am    Post subject: Reply with quote

Greetings............. Cool
Back to top
HotKeyIt



Joined: 18 Jun 2008
Posts: 4653
Location: AHK Forum

PostPosted: Sat Mar 13, 2010 12:24 am    Post subject: Reply with quote

Hi Lexikos,

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

Additionally it will save one character Smile
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
Back to top
View user's profile Send private message
Lexikos



Joined: 17 Oct 2006
Posts: 7299
Location: Australia

PostPosted: Sat Mar 13, 2010 3:28 am    Post subject: Reply with quote

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]
Back to top
View user's profile Send private message Visit poster's website
HotKeyIt



Joined: 18 Jun 2008
Posts: 4653
Location: AHK Forum

PostPosted: Sat Mar 13, 2010 11:45 am    Post subject: Reply with quote

I see, thanks.
_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun Wink
Back to top
View user's profile Send private message
Lexikos



Joined: 17 Oct 2006
Posts: 7299
Location: Australia

PostPosted: Sun Mar 14, 2010 7:43 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
HotKeyIt



Joined: 18 Jun 2008
Posts: 4653
Location: AHK Forum

PostPosted: Sun Mar 14, 2010 2:46 pm    Post subject: Reply with quote

Enum works great and very fast, thank you Wink
_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun Wink
Back to top
View user's profile Send private message
Sean



Joined: 12 Feb 2007
Posts: 2462

PostPosted: Sun Mar 14, 2010 5:04 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
lexikos*
Guest





PostPosted: Tue Mar 16, 2010 2:47 am    Post subject: Reply with quote

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.
Back to top
jackieku



Joined: 30 Nov 2008
Posts: 73

PostPosted: Tue Mar 16, 2010 5:44 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
Lexikos



Joined: 17 Oct 2006
Posts: 7299
Location: Australia

PostPosted: Tue Mar 16, 2010 12:29 pm    Post subject: Reply with quote

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. Wink
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This topic is locked: you cannot edit posts or make replies.    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2, 3 ... 28, 29, 30 ... 68, 69, 70  Next
Page 29 of 70

 
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