AutoHotkey Community

It is currently May 27th, 2012, 10:49 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 30 posts ]  Go to page Previous  1, 2
Author Message
 Post subject:
PostPosted: August 29th, 2008, 4:48 pm 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
Many thanks for all explanation Lexikos, you are right all in all.
It looks like the pipe is even slower, possibly because of DLL calls.

My Idea was to have all scripts like a variable in exe, which would take more load time but less executing time, but it looks it would cost even more time to execute.

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 7th, 2008, 5:07 pm 
Offline

Joined: April 30th, 2006, 6:23 pm
Posts: 358
Location: Shigle Springs
I use a SSD in my laptop.. Its kind of like a big USB drive. Fast...
A USB drive will be faster than HD in most cases.. (depending upon compression of the memory)

For really fast performance, use a RAM virtual drive.

_________________
CPULOCK.com
virusSWAT.com
Computer Repair Computer Service.com
911PCFIX.com


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 4th, 2008, 4:32 pm 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
Is there a way to have your build exe to work as AutoHotkey.exe as well?


So if I run my exe with files parameters it would work same as AutoHotkey and without parameters it would do what it is designed to?

I would like to run dynamic script without AutoHotkey.exe.

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 5th, 2008, 1:25 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
Theoretically possible, but not simple. I will not be working on it.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 5th, 2008, 8:37 am 
Offline

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

What needs to be done therefore, can you give a rough idea?

Is a change to AutoHotkeySC.bin is requiered or can it be done with a script?

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 5th, 2008, 9:51 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
The section of C++ code that loads script is conditionally compiled to work differently for AutoHotkey.exe and AutoHotkeySC.bin. You would need to modify this section to load from a file or from memory as appropriate.

Most syntax checking is also omitted from AutoHotkeySC.bin, and there may be other differences. I suppose you would need to base the modifications on the Release build rather than the SC build.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 25th, 2009, 9:10 pm 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
Hi Lexikos, can you check why it does not work using AutoHotKey 1.0.48?
Hope it's no problem to solve, I need that :cry:

_________________
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 26th, 2009, 9:21 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
After a lot of stuffing around, I think the problem is just an incorrect value:
Code:
FileExtract(Source, Dest, Flag=0) {
    static init
    if !init
        cb := RegisterCallback("FileExtract_")
        ; cb->func->mJumpToLine->mActionType := ACT_FILEINSTALL
        , NumPut(159, NumGet(NumGet(cb+28)+4), 0, "UChar")
        , DllCall("GlobalFree", "uint", cb)
    return FileExtract_(Source, Dest, Flag)
}
In v1.0.48, ACT_WHILE is inserted into the enum_act (action type) enumeration at 105, so 159 (ACT_FILEINSTALL) in the code above must be changed to 160.

Edit: I've updated the code in my original post to handle v1.0.48 correctly without breaking compatibility with earlier versions.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 26th, 2009, 1:50 pm 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
Thank you very much for your quick reply :)

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 24th, 2009, 9:03 am 
Offline

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

Could you change the function to extract main script when parameter Source is empty :)
Code:
pData:=0
pDataSize:=0
FileExtract_ToMem("", pData, pDataSize)
ThisScript:=GetStrN(pData, pDataSize)
MsgBox % ThisScript

This way you could reuse main script or parts of it inside a pipe.

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 24th, 2009, 9:51 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
Why? The example in my first post shows how to extract the script itself.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 24th, 2009, 11:46 am 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
Lexikos wrote:
Why? The example in my first post shows how to extract the script itself.

I didn't notice that, thank you. :roll:

EDIT:
Thank you very much again for this excellent function :D

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 28th, 2010, 12:10 pm 
Offline

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

I cannot get it working with current AHK_L versions, can you take a look what is wrong?

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 1st, 2010, 10:19 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
I've updated the main script to be Unicode-compatible. Specifically, GetProcAddress always accepts a multi-byte string, i.e. "str" in standard AHK/ANSI AHKL or "astr" in ANSI/Unicode AHKL. Also, GetStrN in the example script won't work; StrGet should be used instead, specifying the correct encoding.
Code:
astr := A_IsUnicode ? "astr" : "str"
ConnectNamedPipe := DllCall("GetProcAddress", "uint", hKernel32, astr, "ConnectNamedPipe")
ReadFile         := DllCall("GetProcAddress", "uint", hKernel32, astr, "ReadFile")
GlobalReAlloc    := DllCall("GetProcAddress", "uint", hKernel32, astr, "GlobalReAlloc")
Code:
GuiOut(StrGet(pData, DataSize, "UTF-8"))


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 21st, 2012, 1:24 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
Posted in response to a recent help request:
Lexikos wrote:
Those functions are not compatible with recent versions of AutoHotkey_L.

With v1.1.01 or later, FileInstall stores the data as a Win32 resource, so you can retrieve the data using the Win32 Resource APIs. For example:
Code:
; LoadResourceDemo.ahk
SelfCompile()

; Load resource and retrieve address and size.
if data := LoadScriptResource("LoadResourceDemo.ahk", size)
{
    ; Retrieve text, assuming UTF-8 encoding.
    text := StrGet(data, size, "UTF-8")
    ; Display text in GUI.
    Gui Add, Edit, ReadOnly W600 H400, %text%
    Gui Show
    return
}
else
    MsgBox 16,, Failed to load resource.

GuiClose:
GuiEscape:
ExitApp

LoadScriptResource(Name, ByRef DataSize = 0, Type = 10)
{
    lib := DllCall("GetModuleHandle", "ptr", 0, "ptr")
    res := DllCall("FindResource", "ptr", lib, "str", Name, "ptr", Type, "ptr")
    DataSize := DllCall("SizeofResource", "ptr", lib, "ptr", res, "uint")
    hresdata := DllCall("LoadResource", "ptr", lib, "ptr", res, "ptr")
    return DllCall("LockResource", "ptr", hresdata, "ptr")
}

SelfCompile()
{
    if A_IsCompiled
        return
    ; Self-compile-and-run.
    RunWait, %A_AhkPath%\..\Compiler\Ahk2Exe.exe /in "%A_ScriptFullPath%"
    Run LoadResourceDemo.exe
    ExitApp
   
    ; Not executed by AutoHotkey, but interpreted by Ahk2Exe:
    FileInstall, LoadResourceDemo.ahk, ~
}


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 30 posts ]  Go to page Previous  1, 2

All times are UTC [ DST ]


Who is online

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