
autocart
Active Members-
Posts
34 -
Joined
-
Last visited
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
autocart's Achievements

Seeker (1/7)
3
Reputation
-
TurionAltec reacted to a post in a topic: Working ImageSearch - (Moved)
-
Hi Atoxis, I kind of "wrapped" the ImageSearch command from ... *cough* ... cannot say it out loud in here ... (*whispering*) AutoHotKey ... to an AutoIt function. Of course a separate dll must be downloaded from here: https://hotkeyit.github.io/v2/ Either one of the dll packages (v1 or v2) should do the trick. Just don't use the help file of v1. It's confusing and misleading. Even the author says on that page that it is outdated. Don't know why it is still packaged with the v1 zip package. So make sure to at least download v2 for the help file. And, if you want it, v1 for the possibly more stable version? If you should be using the 32-bit v1 version after all, make sure to be using the "w" version, not the "a". I am not an expert with dll calls. So the code underneath is the result of trial and error based on reading the help files rather than of always exactly knowing what must be coded. I also did not do much error catching in the code - or none at all - but the code is not so complicated nor long. It also might not be the fastest ImageSearch-code out there, but hey, the code works for me (on Win 8.1 x64 and with both 32-bit and 64-bit AutoIt) and I think it is fairly simple to implement. But I am willing to work on improving the code upon feedback. (The additional plus of this code is that you can practically wrap any ahk command or fuction to AutoIt by copying and slightly adapting the code. Not that there would be much need for that but who knows, maybe tomorrow one of us stumbles upon another case like ImageSearch.) Hope it helps either you, Atoxis, or someone else in the future. Regards, S. $searchAreaX1 = xxxxx ;//upper left X value of search area $searchAreaY1 = yyyyy ;//upper left Y value of search area $searchAreaX2 = xxxxxx ;//lower right X value of search area $searchAreaY2 = yyyyyy ;//lower right Y value of search area $OptionsAndImageFile = "..." ;//e.g. "*20 *TransBlack (relative) path to image.png", see https://www.autohotkey.com/docs/commands/ImageSearch.htm ;~ $ImageSearchCoordMode = "..." ;//Specify whether all coordinates are relative to "Screen|Window|Client". Can be skipped. Default is "Window" (meaning the one active while the ImageSearch function runs). see also https://www.autohotkey.com/docs/commands/CoordMode.htm WinActivate(".......", "") ;//if coordinates are relative to window, it makes sense to activate the desired window before performing the search WinWaitActive("[LAST]") $imageFoundAt = ImageSearch_ahk_wrapped($searchAreaX1, $searchAreaY1, $searchAreaX2, $searchAreaY2, $OptionsAndImageFile) If $imageFoundAt[0] Then MsgBox(0, "ImageSearch results", "Image found at the coordinates: X " & $imageFoundAt[0] & ", Y " & $imageFoundAt[1]) Else MsgBox(0, "ImageSearch results", "Image not found.") EndIf ;// VVV BEGINNING OF "WRAPPER"-FUNCTION: VVV Func ImageSearch_ahk_wrapped($searchAreaX1, $searchAreaY1, $searchAreaX2, $searchAreaY2, $OptionsAndImageFile, $ImageSearchCoordMode = "Window") ;// >>> IN THE NEXT 4 LINES OF CODE CHOOSE THE DLL OF YOUR CHOICE SO THAT IT FITS THE BIT-VERSION OF YOUR DESIRED AUTOIT.EXE BY COMMENTING THE OTHER LINES OUT. THIS WAY THE CODE CAN BE REUSED/REVISITED AND QUICKLY ADAPTED. ;// >>> IN THE NEXT 6 LINES OF CODE ADAPT THE PATHS/STRINGS TO YOUR LOCAL CIRCUMSTANCES. ;~ $path_to_AutoHotkey_dll = ".\ahkdll-v1-release-master\Win32w\AutoHotkey.dll" ;~ $path_to_AutoHotkey_dll = ".\ahkdll-v1-release-master\x64w\AutoHotkey.dll" ;~ $path_to_AutoHotkey_dll = ".\ahkdll-v2-release-master\Win32w\AutoHotkey.dll" $path_to_AutoHotkey_dll = ".\ahkdll-v2-release-master\x64w\AutoHotkey.dll" $part_of_path_identifying_version1 = "ahkdll-v1-release-master" $part_of_path_identifying_version2 = "ahkdll-v2-release-master" $hDll = DllOpen($path_to_AutoHotkey_dll) DllCall($hDll, "UINT_PTR:cdecl", "ahkdll", "wstr", "", "wstr", "", "wstr", "") If StringInStr($path_to_AutoHotkey_dll, $part_of_path_identifying_version1) Then DllCall($hDll, "BOOLEAN:cdecl", "ahkExec", "wstr", "CoordMode Pixel, " & $ImageSearchCoordMode) DllCall($hDll, "BOOLEAN:cdecl", "ahkExec", "wstr", "ImageSearch foundX, foundY, " & $searchAreaX1 & ", " & $searchAreaY1 & ", " & $searchAreaX2 & ", " & $searchAreaY2 & ", " & $OptionsAndImageFile) ElseIf StringInStr($path_to_AutoHotkey_dll, $part_of_path_identifying_version2) Then DllCall($hDll, "BOOLEAN:cdecl", "ahkExec", "wstr", "CoordMode ""Pixel"", """ & $ImageSearchCoordMode & """") DllCall($hDll, "BOOLEAN:cdecl", "ahkExec", "wstr", "ImageSearch foundX, foundY, " & $searchAreaX1 & ", " & $searchAreaY1 & ", " & $searchAreaX2 & ", " & $searchAreaY2 & ", """ & $OptionsAndImageFile & """") EndIf $foundX = DllCall($hDll, "wstr:cdecl", "ahkgetvar", "wstr", "foundX", "UInt", 0) $foundY = DllCall($hDll, "wstr:cdecl", "ahkgetvar", "wstr", "foundY", "UInt", 0) Local $returnArray[2] $returnArray[0] = $foundX[0] $returnArray[1] = $foundY[0] DllClose($hDll) Return $returnArray EndFunc
- 8 replies
-
- imagesearch
- image
-
(and 2 more)
Tagged with:
-
Thank you very much! ah, I did not realize that the two brackets () must be there. works now. thx again.
- 250 replies
-
- isn autoit studio
- isn
-
(and 3 more)
Tagged with:
-
Alrighty, 1 bug, 1 suggestion: note: I am running ISN AutoIt Studio in "au3-mode" (not compiled) bug: parameter editor does not work (see attached image) suggestion: It seems that when checked in settings to use some or all file types (au3, isn, isp, icp) with ISN AutoIt Studio, then on each program start it not only checks if those file types still are associated but if not then it overwrites the file associations WITHOUT warning or asking. This is not good. At least the user should be asked once if this should always be done like that and it should be possible to turn this behaviour off or on in the settings. Also, Studio will insert file associations to only a compiled version of Studio (Autoit_Studio.exe). Since I am using the au3-version, this behaviour is not desired but hindering. When using the uncombiled au3-version, Studio should really create associations like this: "C:\Program Files (x86)\AutoIt3\AutoIt3.exe" "C:\....\ISN AutoIt Studio\Autoit_Studio.au3" "%1" With both of the above described behaviours regarding associations in combination, I almost smashed my monitor to pieces getting mad at Windows. Turned out, the culprit was Studio itself after all. At least my neighbors now know that I am at home. :-| Regards, S.
- 250 replies
-
- isn autoit studio
- isn
-
(and 3 more)
Tagged with:
-
Hi ISI360! Hi all! I just discovered and installed ISN AutoIt Studio so I can not yet say much but the first impression is being emotionally blown away. THANK YOU, ISI360 for developing this!!!!!! I "love" you for that! Now I havee to use it and come back with ideas for even further improvement and in almost all software as of yet I have also found some bugs as well. Keep it up! Regards, S. P.S.: A word to the modorators & admins here: I really don't know why this thread is not sticky and in a more prominent sub-forum. It is not intuitive to look for AutoIt IDE's in the sub forum "AutoIt Example Scripts". I also found this only because I googled for it and then first found the thread over at the German forum. I only found it here after I did a forum search for the full explicit name "ISN AutoIt Studio". This should be sticky in the sub-forum "AutoIt Technical Discussion" for lack of an even better fitted place.
- 250 replies
-
- isn autoit studio
- isn
-
(and 3 more)
Tagged with:
-
Xandy reacted to a post in a topic: How to get the address to a variable?
-
autocart reacted to a post in a topic: How to get the address to a variable?
-
How to get the address to a variable?
autocart replied to autocart's topic in AutoIt General Help and Support
ok - I am g o n e ..... -
How to get the address to a variable?
autocart replied to autocart's topic in AutoIt General Help and Support
Oh, ah, I think it just clicked. You also said in the other thread: "It's very simple, if you are using dllstruct with/for anything that doesn't absolutely need it then you are abusing it." If I read it correctly, the emphasise could be on "with/for anything that doesn't absolutely need it". So, if I think I need it and can't find another way of how to achieve the desired functionality, then will always be completely ok to use it, right? In connection of the above together with this thought it now makes (enough) sense to me. Hope I am right. Thx again for your patience. -
trancexx reacted to a post in a topic: How to get the address to a variable?
-
How to get the address to a variable?
autocart replied to autocart's topic in AutoIt General Help and Support
Thx for the link and anyway for all your replies, trancexx. The basic reasons that I saw you explaining there, seem to be: "Using dllstructs that way goes directly against the typing paradigm of the language. On top of that dllstruct is not safe type because data is also accessible through pointer." Honestly I don't understand the dangers in either. But that may be because I am only a bad hobby programmer. I mean - no harm meant - who cares about typing paradigms or "safeness of type regarding accessibility through pointer", unless it could be accessed through pointer accidently and then make me loose data or even worse cause my windows system to crash and loose the current windows session (blue screen & loss of currently not saved data). If that is not the case, I don't know what should be "unsafe" about it? What I wonder about is, maybe you and your colleagues speak heavily against its widespread usage, because otherwise it would spread throughout scripts on the net and be a bother to stumble upon / work with and maybe cause uncontrollable side effects like in Terminator, or so. ;-) If this is the case, then just say so and I would understand. Thanks again for your help, in any case. Regards, Stephan -
How to get the address to a variable?
autocart replied to autocart's topic in AutoIt General Help and Support
Woah,... *shock* .... it is? And in this case it also would be safe to do it? Please, allow me the question: How do I then determine when it is safe and when it is not? -
How to get the address to a variable?
autocart replied to autocart's topic in AutoIt General Help and Support
Yes, sorry, had not seen her post fast enough. Up above is the link to the original code now. -
How to get the address to a variable?
autocart replied to autocart's topic in AutoIt General Help and Support
again, did not see it until posting my post, sorry I am only a very bad hobby programmer, sorry, and as such I was only trying to tranlate this code from ahk to au3: http://www.autohotkey.com/board/topic/55299-strput-strget/?p=592069 notice the last code line before the return, where the function recursively calls itself: String := StrGet(&String, char_count, 1200)EDIT: The function should do the same as http://ahkscript.org/docs/commands/StrPutGet.htm -
How to get the address to a variable?
autocart replied to autocart's topic in AutoIt General Help and Support
thx for not giving up, this sound a little bit more as if you know what you are talking about. no harm meant. BTW, does "Developer" (regarding your forum-title) mean that you are a developer of the AutoIt language itself, or that you are maybe an outstanding, registered or whatever "Developer" of programs using the AutoIt language. Or maybe you also could be a "Developer" of this forum. I am not fully sure what it means. -
How to get the address to a variable?
autocart replied to autocart's topic in AutoIt General Help and Support
LOL, unfortunately you are surrounded by a lot of stupid people who cannot see the obvious. I still can't. If you know a way of how to explain it better then yes, please. -
How to get the address to a variable?
autocart replied to autocart's topic in AutoIt General Help and Support
ah, ok, overlapping of replies. anyway, it does not change the fact that in the end there is no real explaination. I would always ask why. But as I said, I'll see if I can do it differently first. -
How to get the address to a variable?
autocart replied to autocart's topic in AutoIt General Help and Support
Thx M23, for your intput. I am trying to port some code from ahk to autoit3. I will try it differently and if it does not work then maybe I will try structs but I will see. Guinness, you say all this without any understandable / weighty reason. Even in the link no reason is given and who, for crying out loud, is trancexx? He/She gives no real explaination either, exactly like you. M23, at least gives some more background info that seems to have some more importance and that I can understand a little bit. But to say it "is for the Windows API only" and no further explaination, this simply is not good enough. Thx for answering and keeping the thread going, though. At least it was entertaining. -
How to get the address to a variable?
autocart replied to autocart's topic in AutoIt General Help and Support
Ok, wow, thanks to everybody for all those answers while I was gone. So, IF I did want to build a function or script in such a way that I definitely want to use the address of respectively pointer to a variable then I could declare that variable from the very beginning as part of a DllStruct (instead of a "normal" Autoit3-variable) and work with the "variable" inside the DllStruct like that and then use DllStructGetPtr to get and use the address to the "variable" inside the struct. Is this correct, does it work and is it valid and allowed? Besides that it is "abusing" the language and more clumsy to work with, are there any other real disadvantages?