
KutayAltinoklu
-
Posts
10 -
Joined
-
Last visited
Reputation Activity
-
KutayAltinoklu got a reaction from ALEJANDROMAZO in ImageSearch Usage Explanation
Thank You Very Much You Just Saved My Life
I Have Signed Up To Say Thank You But I Think I Love Autoit So I will use my account to.
-
KutayAltinoklu got a reaction from respech0505 in ImageSearch Usage Explanation
Thank You Very Much You Just Saved My Life
I Have Signed Up To Say Thank You But I Think I Love Autoit So I will use my account to.
-
KutayAltinoklu got a reaction from truonghieuhust in ImageSearch Usage Explanation
Thank You Very Much You Just Saved My Life
I Have Signed Up To Say Thank You But I Think I Love Autoit So I will use my account to.
-
KutayAltinoklu got a reaction from guestscripter in ImageSearch Usage Explanation
Thank You Very Much You Just Saved My Life
I Have Signed Up To Say Thank You But I Think I Love Autoit So I will use my account to.
-
KutayAltinoklu reacted to CrypticKiwi in Getting Error Using Case With Varibles
like water said switch doesn't work that way i guess you should change switch part
While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE Exit Case $BilgiGonder $UserData1 = GUICtrlRead($Ext) $UserData2 = GUICtrlRead($Colour) $UserData3 = GUICtrlRead($HexCode) ExitLoop EndSwitch WEndAlso you might need to declare $Test
and remove the extra comma at line 19
$HexCode = GUICtrlCreateInput("", 50, 109, 193, 20,)
-
KutayAltinoklu reacted to guinness in _FileWriteLog Not Working İn Function
Or another way is create a logging API that opens the file once and closes at the end e.g.
#include <File.au3> Global $g_hLogFile = -1 ; Close on AutoIt shutdown OnAutoItExitRegister(Log_Shutdown) Example() Func Example() ; Start logging Log_Startup() ; Write to the log file For $i = 0 To 1000 Log_Write($i) Next ; Stop logging. NOTE: Done automatically due to registering the function at the start for when AutoIt exists ; Log_Shutdown() EndFunc ;==>Example ; Tidy up our resources. Returns True or False Func Log_Shutdown() If $g_hLogFile <> -1 Then Return FileClose($g_hLogFile) > 0 EndIf Return False EndFunc ;==>Log_Shutdown ; Start the logging API. Returns True or False Func Log_Startup() $g_hLogFile = FileOpen(@ScriptDir & "\Log\Error.log", BitOR($FO_APPEND, $FO_CREATEPATH)) Return $g_hLogFile <> -1 EndFunc ;==>Log_Startup ; Write a log message. Returns True or False Func Log_Write($sLogEntry) If $g_hLogFile == -1 Then Return False Local $iReturn = _FileWriteLog($g_hLogFile, $sLogEntry) Return SetError(@error, @extended, $iReturn > 0) EndFunc ;==>Log_Write
-
KutayAltinoklu reacted to kylomas in _FileWriteLog Not Working İn Function
KutayAltinoklu,
is not really describing the problem, just that there is a problem. When I ran this I get
"Unable to open file = c:\..."
That can be easily fixed using the following code...
#include <File.au3> Local $ErrorFile = FileOpen(@ScriptDir & "\Log\Error.log", $FO_APPEND + $FO_CREATEPATH) Func logTest() _FileWriteLog($ErrorFile, "Test") EndFunc Call ("logTest") shellexecute(@ScriptDir & "\Log\Error.log")Note the addition of a parm to the FileOpen function.
While that works, it is not terribly useful to hardcode a value to write in a function. Lets change it slightly...
1 - add a parm that contains the string to write to the log function
2 - open/close the error file with each call to the function
3 - invoke function directly, not with Call stmt
#include <File.au3> Func logTest($sLogEntry) Local $ErrorFile = FileOpen(@ScriptDir & "\Log\Error.log", $FO_APPEND + $FO_CREATEPATH) _FileWriteLog($ErrorFile, $sLogEntry) fileclose($ErrorFile) EndFunc logtest('My latest entry') logtest('and another...') shellexecute(@ScriptDir & "\Log\Error.log")If any of this does not make sense read about functions in general and the function that you are using in the Help file.
kylomas
edit: @Guinness - While I was trying to get the screen print to work I see you beat me to it...
-
KutayAltinoklu reacted to guinness in _FileWriteLog Not Working İn Function
Don't use call like that, instead use logTest() Don't forget to tidy up your resources using FileClose() Learn how to error check. Did you place a console write underneath _FileWriteLog() with @error? Anyway it's pretty simply with a bit of thought process. Use $FO_APPEND + $FO_CREATEPATH in FileOpen(), as your path probably doesn't exist. How do I know? Well FileOpen was returning -1.
-
KutayAltinoklu reacted to guestscripter in ImageSearch Usage Explanation
I just got it to work!
I was having much trouble, reading all the threads and posts related to ImageSearch, and I'd like to help others now.
Now got it to work as a x64 and also as a x32 script using both DLLs accordingly (on a Windows 8.1 x64 PC)
One of the steps I took in debugging was putting this into (the top of) my script:
$sOSArch = @OSArch ;Check if running on x64 or x32 Windows ;@OSArch Returns one of the following: "X86", "IA64", "X64" - this is the architecture type of the currently running operating system. ConsoleWrite("$sOSArch=" & $sOSArch & @CR) $sAutoItX64 = @AutoItX64 ;Check if using x64 AutoIt ;@AutoItX64 Returns 1 if the script is running under the native x64 version of AutoIt. ConsoleWrite("$sAutoItX64=" & $sAutoItX64 & @CR)In any case you want to be consistent about 32bit or 64bit usage, and use the right DLL etc.
What also really helped was putting in lots of debugging and error handling to zoom in on whatever specific part isn't working and why.
Credits to Centrally (very helpful usage explanation and re-uploading the files) and kangkeng for making this possible in AutoIt, as well Miguel7 from the AutoHotKey forum who also posted some helpful advice.
I've attached a zipped folder containing all of the needed Dlls and my customised Library, which also contains an example and some debugging: ImageSearch2015.zip
Take a look inside ImageSearch2015.au3 here if you like:
Edit: also uploaded "ImageSearch15.au3", a version of "my" ImageSearch Library without the built-in Example and Debugging
(will require the Dlls in the .zip file though): ImageSearch15.au3
I hope this helps somebody! Let me know any feedback/issues.