AutoHotkey Community

It is currently May 27th, 2012, 3:37 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 563 posts ]  Go to page Previous  1 ... 14, 15, 16, 17, 18, 19, 20 ... 38  Next
Author Message
 Post subject:
PostPosted: July 3rd, 2010, 12:41 pm 
HotKeyIt wrote:
@coder, what happens when you run a script with original AutoHotkey.exe without using dll?



i'm not user original AutoHotkey.exe, i use AutoHotkey_H (ANSI)


HotKeyIt wrote:
ANSI version cannot work with unicode path.


it work fine, but if line (var, path, etc) have symbol "я" -- it alert error.

example:
0) create script "msgbox, тестовая проверка"
1) save script in UTF-8 encoding
2) run script in ANSI build -- Autohotkey alert error

0) remove from script symbol "я" (script = "msgbox, тестова проверка")
1) save script in UTF-8 encoding
2) run script in ANSI build -- no error


0) create script "msgbox, тестовая проверка" (original script, without changes)
1) save script in UTF-8 encoding
2) run script in Unicode build -- no error


HotKeyIt wrote:
Did you try that


tried, and i found where bug...

1) compile script
2) type "cd c:" in the cmd
3) run compiled exe from console

if script like this:

Code:
#Persistent
If 0
   FileInstall,AutoHotkey.dll,AutoHotkey.dll
MsgBox % A_ScriptDir

Thread_Auto =
(`%
msgbox, %A_ScriptDir%
)

auto_dll:=AhkDllThread("AutoHotkey.dll")
auto_dll.ahktextdll("#NoTrayIcon`n" Thread_Auto)
auto_dll2:=AhkDllObject("AutoHotkey.dll")
auto_dll2.ahktextdll("#NoTrayIcon`n" Thread_Auto)

#Include %A_ScriptDir%\func_threads_init.ahk



it say - "c:\test"; "c:"; "c:"


if script like this:
Code:
#Persistent
If 0
   FileInstall,AutoHotkey.dll,AutoHotkey.dll
MsgBox % A_ScriptDir

Thread_Auto =
(
msgbox, %A_ScriptDir%
)

auto_dll:=AhkDllThread("AutoHotkey.dll")
auto_dll.ahktextdll("#NoTrayIcon`n" Thread_Auto)
auto_dll2:=AhkDllObject("AutoHotkey.dll")
auto_dll2.ahktextdll("#NoTrayIcon`n" Thread_Auto)

#Include %A_ScriptDir%\func_threads_init.ahk


all msgbox say "c:\test"

It's strange... =)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 3rd, 2010, 1:14 pm 
HotKeyIt wrote:
so when you run your httpQuery script without using dll does it crash as well?


I not tested... now i wrote 2 simple script (with ahkdll, and without) and run their... after ~24 hours I'll write about of results... =)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 3rd, 2010, 6:23 pm 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
For me it displays ???????? ???????? in both cases when using ANSI version :?

For the second one it displays C:\Test in all cases, note the script for the other (A_ScriptDir) is not dynamic.
Also note!
MSDN GetCurrentDirectory wrote:
Multithreaded applications and shared library code should not use the GetCurrentDirectory function and should avoid using relative path names. The current directory state written by the SetCurrentDirectory function is stored as a global variable in each process, therefore multithreaded applications cannot reliably use this value without possible data corruption from other threads that may also be reading or setting this value. This limitation also applies to the SetCurrentDirectory and GetFullPathName functions. The exception being when the application is guaranteed to be running in a single thread, for example parsing file names from the command line argument string in the main thread prior to creating any additional threads. Using relative path names in multithreaded applications or shared library code can yield unpredictable results and is not supported.

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 4th, 2010, 5:17 am 
Offline

Joined: December 23rd, 2006, 6:02 pm
Posts: 424
Location: Russia
HotKeyIt wrote:
For me it displays ???????? ???????? in both cases when using ANSI version

The ANSI code for "я" is 0xFF. Just use the character from your ANSI charset that has that code.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: ahkFunction crashing
PostPosted: July 6th, 2010, 12:24 am 
Guest_AutoHotkey_L wrote:
tinku99 wrote:
I have fixed ahkFunction so it doesn't crash. I have also cleaned up its implementation a little.

Thanks for taking a look and working on a fix.

I confirmed that there is no more crashing :) I don't seem to be getting back the strings I'm expecting from ahkFunction though...

Should I try to provide some code to reproduce?

Any comments on this?

The crashing from before seems gone, but for the cases I've tested, ahkFunction doesn't appear to be returning the string values I expect. I see only '1'.

Tried to reproduce with a smaller set of code which is below. I think it demonstrates some issue, but the results don't appear to be the same as in the full-blown scenario (still seems problematic though):

With the AutoHotkey.dll in the ReleaseA directory of the HotkeyIt zip file (1.
0.48.05.L52dllH17 SHA-1: fb41686713b7319e2e85e3b3409b606c55ad8870) ahkFunction appears to return strings as expected.

With the most recent tinku99 AutoHotkey.dll I have here (SHA-1: 0e4c7daf198dc56524757015dea46f48b7400ec1) ahkFunction appears to return an empty string.

ahkFunctionReturnValue.ahk
Code:
#NoEnv
#Persistent

OutputDebug, % "-------"

OutputDebug, % "A_AhkVersion: " . A_AhkVersion

AHKDllPath := A_ScriptDir . "\AutoHotkey.dll"

OutputDebug, % "About to call LoadLibrary"
handleLibrary
  := DllCall("LoadLibrary"
           , "Str", AHKDllPath)
If (ErrorLevel != 0)
{
  OutputDebug, % "DllCall (LoadLibrary) set ErrorLevel to: " . ErrorLevel
  ExitApp
}
OutputDebug, % "DLLCall (LoadLibrary) returned: " . handleLibrary

OutputDebug, % "About to call ahkdll"
Result
  := DllCall(AHKDllPath . "\ahkdll"
           , "Str", A_ScriptDir . "\helper.ahk"
           , "Str", ""
           , "Str", ""
           , "Cdecl UInt")
If (ErrorLevel != 0)
{
  OutputDebug, % "DllCall (ahkdll) set ErrorLevel to: " . ErrorLevel
  ExitApp
}
OutputDebug, % "DllCall (ahkdll) returned: " . Result

Parameter := "Hoping this comes back"
OutputDebug, % "About to call ahkFunction"
Result
  := DllCall(AHKDllPath . "\ahkFunction"
           , "Str", "InHelper"
           , "Str", Parameter
           , "Cdecl Str")
If (ErrorLevel != 0)
{
  OutputDebug, % "DllCall (ahkFunction) set ErrorLevel to: " . ErrorLevel
}
OutputDebug, % "DllCall (ahkFunction) returned: " . Result
If (Result == "")
{
  OutputDebug, % "  Result appears to be empty..."
}

OutputDebug, % "About to call FreeLibrary"
Result
  := DllCall("FreeLibrary"
           , "UInt", handleLibrary)
If (ErrorLevel != 0)
{
  OutputDebug, % "DllCall (FreeLibrary) set ErrorLevel to: " . ErrorLevel
  ExitApp
}
OutputDebug, % "DllCall (FreeLibrary) returned: " . Result

ExitApp


helper.ahk
Code:
#Persistent

OutputDebug, % "Via DLL: A_AhkVersion: " . A_AhkVersion

InHelper(PassedThing)
{
  OutputDebug, % "Via DLL: InHelper entered with: " . PassedThing
  Return PassedThing
}


Report this post
Top
  
Reply with quote  
 Post subject: Re: ahkFunction crashing
PostPosted: July 6th, 2010, 6:47 am 
Offline

Joined: August 3rd, 2007, 8:01 am
Posts: 555
Location: Houston, TX
Guest_AutoHotkey_L wrote:
I confirmed that there is no more crashing :) I don't seem to be getting back the strings I'm expecting from ahkFunction though...
Thanks for the bug report. Fixed. Try it now: redownload
Also, fixed ahkgetvar()


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: ahkFunction crashing
PostPosted: July 6th, 2010, 12:06 pm 
tinku99 wrote:
Guest_AutoHotkey_L wrote:
I confirmed that there is no more crashing :) I don't seem to be getting back the strings I'm expecting from ahkFunction though...
Thanks for the bug report. Fixed. Try it now: redownload
Also, fixed ahkgetvar()

So far it's looking much better!

Thanks for the fix :)


Report this post
Top
  
Reply with quote  
 Post subject: Re: ahkFunction crashing
PostPosted: July 11th, 2010, 2:20 am 
Guest_AutoHotkey_L wrote:
tinku99 wrote:
Guest_AutoHotkey_L wrote:
I confirmed that there is no more crashing :) I don't seem to be getting back the strings I'm expecting from ahkFunction though...
Thanks for the bug report. Fixed. Try it now: redownload
Also, fixed ahkgetvar()

So far it's looking much better!

Thanks for the fix :)

Any chance of the change(s) making it into HotkeyIt's version too? (The dates for the files in HotkeyIt's zip suggest to me that this hasn't happened there yet, but may be that's off.)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 11th, 2010, 10:49 am 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
AutoHotkey_H is now up to date.

I have not renamed LowLevel functions like Alias to __Alias because I like them to be accessible even when using Lexikos LowLevel() functions (otherwise they are overridden).

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 11th, 2010, 1:45 pm 
HotKeyIt wrote:
AutoHotkey_H is now up to date.

Just downloaded and tested some of the bits in ReleaseA -- seems fine so far :) Thanks a lot!


Report this post
Top
  
Reply with quote  
PostPosted: July 16th, 2010, 12:05 pm 
For A_AhkVersion: 1.0.48.05.L52H18, the Clipboard variable seems functional initially but although the clipboard may not be empty, in subsequent ahktextdll invocations, the Clipboard variable looks empty.

Am I doing something wrong?

Code:
#Include AhkDllObject.ahk
;
OutputDebug, % "A_AhkVersion: " . A_AhkVersion
;
AHKDLLObj := AhkDllObject(A_ScriptDir . "\AutoHotkey.dll")
If (!IsObject(AHKDLLObj))
{
  OutputDebug, % "Failed to initialize AhkDllObject"
  ExitApp
}
;
MsgBox, % "Please put something in the clipboard and run dbgview or equivalent"
Result :=
  DynaCall(AHKDLLObj.ahktextdll
         , "OutputDebug, % ""First Clipboard: "" . Clipboard")
Result :=
  DynaCall(AHKDLLObj.ahktextdll
         , "OutputDebug, % ""Second Clipboard: "" . Clipboard")
MsgBox, % "Why does the variable Clipboard appear to be empty for the second DynaCall invocation?"


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 16th, 2010, 6:48 pm 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
Thanks for reporting, this is now fixed.

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 17th, 2010, 12:34 am 
HotKeyIt wrote:
Thanks for reporting, this is now fixed.

Seems to be working better here -- thanks for fixing :)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 18th, 2010, 9:23 pm 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
AutoHotkey_H20 wrote:
- Fixed a bug for dll when it was in root folder
- DynaCall is now managed trough internal DynaToken, similar to objects but less functional and much faster.
- - This DynaToken object is used same way as an object but can be used to call DynaToken only. You can also store them in objects.
- DynaCall can set default parameters now, so you can call the function later with less or even witout parameters: func.()
- A DynaToken can be created multiple times for the same function

Thanks Lexikos for his great help.

Small example:
Code:
DllCall("LoadLibrary","Str",dll:="AutoHotkey.dll")
ahk:=Object( "run1",DynaCall(dll . "\ahktextdll","ui=sss","MsgBox run1")
            ,"run2",DynaCall(dll . "\ahktextdll","ui=sss","MsgBox run2")
            ,"get",DynaCall(dll . "\ahkgetvar","s=sui","a")
            ,"set",DynaCall(dll . "\ahkassign","ss") )
ahk.run1()
ahk.set.a := "test" ;same as ahk.set("a","test") or ahk.set["a","test"]
MsgBox % ahk.get()
ahk.run2()
MsgBox % ahk.get()

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject: H18 and H20 difference?
PostPosted: July 19th, 2010, 10:00 am 
The following code works as expected for H18, but for H20, ErrorLevel is set to -2. (The versions I'm mentioning here are based on what I see for A_AhkVersion.)

FWIW, when testing I made one directory for H18 and one for H20 and put corresponding AutoHotkey.exe, AutoHotkey.dll, AhkDllObject.ahk, and the script below (testh20.ahk) in each directory. The .exe and .dll files were taken from ReleaseU. The test script was then run from the command line in each directory using:

Code:
AutoHotkey.exe testh20.ahk

Is there something I need to change? Or may be there's some pilot error. Please advise.

Code:
#Persistent
;
#Include AhkDllObject.ahk
;
OutputDebug, % "A_AhkVersion: " . A_AhkVersion
;
AHKDLLObj := AhkDllObject(A_ScriptDir . "\AutoHotkey.dll")
If (!IsObject(AHKDLLObj))
{
  OutputDebug, % "Failed to initialize AhkDllObject"
  ExitApp
}
;
Result
  := DynaCall(AHKDLLObj.ahktextdll
            , "MsgBox Hello")
If (ErrorLevel != 0)
{
  OutputDebug, % "DynaCall set ErrorLevel to: " . ErrorLevel
  ExitApp
}
OutputDebug, % "DynaCall result was: " . Result


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 563 posts ]  Go to page Previous  1 ... 14, 15, 16, 17, 18, 19, 20 ... 38  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 6 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