 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
coder Guest
|
Posted: Sat Jul 03, 2010 11:41 am Post subject: |
|
|
| 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... =) |
|
| Back to top |
|
 |
coder Guest
|
Posted: Sat Jul 03, 2010 12:14 pm Post subject: |
|
|
| 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... =) |
|
| Back to top |
|
 |
HotKeyIt
Joined: 18 Jun 2008 Posts: 4653 Location: AHK Forum
|
Posted: Sat Jul 03, 2010 5:23 pm Post subject: |
|
|
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  |
|
| Back to top |
|
 |
YMP
Joined: 23 Dec 2006 Posts: 418 Location: Russia
|
Posted: Sun Jul 04, 2010 4:17 am Post subject: |
|
|
| 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. |
|
| Back to top |
|
 |
Guest_AutoHotkey_L Guest
|
Posted: Mon Jul 05, 2010 11:24 pm Post subject: Re: ahkFunction crashing |
|
|
| 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
}
|
|
|
| Back to top |
|
 |
tinku99
Joined: 03 Aug 2007 Posts: 513 Location: Houston, TX
|
Posted: Tue Jul 06, 2010 5:47 am Post subject: Re: ahkFunction crashing |
|
|
| 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() |
|
| Back to top |
|
 |
Guest_AutoHotkey_L Guest
|
Posted: Tue Jul 06, 2010 11:06 am Post subject: Re: ahkFunction crashing |
|
|
| 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  |
|
| Back to top |
|
 |
Guest_AutoHotkey_L Guest
|
Posted: Sun Jul 11, 2010 1:20 am Post subject: Re: ahkFunction crashing |
|
|
| 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.) |
|
| Back to top |
|
 |
HotKeyIt
Joined: 18 Jun 2008 Posts: 4653 Location: AHK Forum
|
|
| Back to top |
|
 |
Guest_AutoHotkey_L Guest
|
Posted: Sun Jul 11, 2010 12:45 pm Post subject: |
|
|
| 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! |
|
| Back to top |
|
 |
Guest_AutoHotkey_L Guest
|
Posted: Fri Jul 16, 2010 11:05 am Post subject: Clipboard variable content |
|
|
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?"
|
|
|
| Back to top |
|
 |
HotKeyIt
Joined: 18 Jun 2008 Posts: 4653 Location: AHK Forum
|
|
| Back to top |
|
 |
Guest_AutoHotkey_L Guest
|
Posted: Fri Jul 16, 2010 11:34 pm Post subject: |
|
|
| HotKeyIt wrote: | | Thanks for reporting, this is now fixed. |
Seems to be working better here -- thanks for fixing  |
|
| Back to top |
|
 |
HotKeyIt
Joined: 18 Jun 2008 Posts: 4653 Location: AHK Forum
|
Posted: Sun Jul 18, 2010 8:23 pm Post subject: |
|
|
| 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  |
|
| Back to top |
|
 |
Guest_AutoHotkey_L Guest
|
Posted: Mon Jul 19, 2010 9:00 am Post subject: H18 and H20 difference? |
|
|
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
|
|
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|