-
Posts
655 -
Joined
-
Last visited
-
Days Won
1
Reputation Activity
-
Realm got a reaction from mLipok in Seconds since Epoch (a.k.a. Unix Timestamp)
After Several Minutes searching the forums for a simple solution to calculating for the Unix Time, as required for another project I am working on, I was astonished to not find one clean and universal solution. After looking over the helpfile, I noticed one simple solution given in the example with _DateDiff(). However it did not account for my current timezone or daylight savings time.
Without further ado... This is my example of Calculating for a current Unix Time stamp or seconds since Jan, 1st, 1970 00:00:00 GMT.
This function will account for your timezone as well as for daylight savings time.
Update: v0.3
-Added Function to revert a Unix Time stamp into Date form.
-Added parameter to original _GetUnixTime() allowing for a custom date since Jan 1st 1970 to be passed and converted to Unix Time.
#include <Date.au3> #include <Array.au3> #include <Constants.au3> Local $iUnixTime1 = _GetUnixTime() MsgBox($MB_SYSTEMMODAL, "Unix Timestamp", "Seconds Since Jan, 1st, 1970 00:00:00 GMT" & @CRLF & $iUnixTime1) Local $sUnixDate1 = _GetDate_fromUnixTime($iUnixTime1) MsgBox($MB_SYSTEMMODAL, "Unix Timestamp", "Get Date from Unix Timestamp in Local Time" & @CRLF & $sUnixDate1) $sUnixDate1 = _GetDate_fromUnixTime($iUnixTime1, False) MsgBox($MB_SYSTEMMODAL, "Unix Timestamp", "Get Date from Unix Timestamp with $iReturnLocal = False which returns UTC Time" & @CRLF & $sUnixDate1) Local $iUnixTime2 = _GetUnixTime('2013/01/01 00:00:00') MsgBox($MB_SYSTEMMODAL, "Unix Timestamp", "Seconds since 2013/01/01 00:00:00" & @CRLF & $iUnixTime2) ; Get timestamp for input datetime (or current datetime). Func _GetUnixTime($sDate = 0);Date Format: 2013/01/01 00:00:00 ~ Year/Mo/Da Hr:Mi:Se Local $aSysTimeInfo = _Date_Time_GetTimeZoneInformation() Local $utcTime = "" If Not $sDate Then $sDate = _NowCalc() If Int(StringLeft($sDate, 4)) < 1970 Then Return "" If $aSysTimeInfo[0] = 2 Then ; if daylight saving time is active $utcTime = _DateAdd('n', $aSysTimeInfo[1] + $aSysTimeInfo[7], $sDate) ; account for time zone and daylight saving time Else $utcTime = _DateAdd('n', $aSysTimeInfo[1], $sDate) ; account for time zone EndIf Return _DateDiff('s', "1970/01/01 00:00:00", $utcTime) EndFunc ;==>_GetUnixTime ;$blTrim: Year in short format and no seconds. Func _GetDate_fromUnixTime($iUnixTime, $iReturnLocal = True) Local $aRet = 0, $aDate = 0 Local $aMonthNumberAbbrev[13] = ["", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] Local $timeAdj = 0 If Not $iReturnLocal Then Local $aSysTimeInfo = _Date_Time_GetTimeZoneInformation() Local $timeAdj = $aSysTimeInfo[1] * 60 If $aSysTimeInfo[0] = 2 Then $timeAdj += $aSysTimeInfo[7] * 60 EndIf $aRet = DllCall("msvcrt.dll", "str:cdecl", "ctime", "int*", $iUnixTime + $timeAdj ) If @error Or Not $aRet[0] Then Return "" $aDate = StringSplit(StringTrimRight($aRet[0], 1), " ", 2) Return $aDate[4] & "/" & StringFormat("%.2d", _ArraySearch($aMonthNumberAbbrev, $aDate[1])) & "/" & $aDate[2] & " " & $aDate[3] EndFunc ;==>_GetUnixDate Enjoy!
Realm
Update: >Added some functionality and a suggestion from FireFox
-
Realm got a reaction from maniootek in Seconds since Epoch (a.k.a. Unix Timestamp)
After Several Minutes searching the forums for a simple solution to calculating for the Unix Time, as required for another project I am working on, I was astonished to not find one clean and universal solution. After looking over the helpfile, I noticed one simple solution given in the example with _DateDiff(). However it did not account for my current timezone or daylight savings time.
Without further ado... This is my example of Calculating for a current Unix Time stamp or seconds since Jan, 1st, 1970 00:00:00 GMT.
This function will account for your timezone as well as for daylight savings time.
Update: v0.3
-Added Function to revert a Unix Time stamp into Date form.
-Added parameter to original _GetUnixTime() allowing for a custom date since Jan 1st 1970 to be passed and converted to Unix Time.
#include <Date.au3> #include <Array.au3> #include <Constants.au3> Local $iUnixTime1 = _GetUnixTime() MsgBox($MB_SYSTEMMODAL, "Unix Timestamp", "Seconds Since Jan, 1st, 1970 00:00:00 GMT" & @CRLF & $iUnixTime1) Local $sUnixDate1 = _GetDate_fromUnixTime($iUnixTime1) MsgBox($MB_SYSTEMMODAL, "Unix Timestamp", "Get Date from Unix Timestamp in Local Time" & @CRLF & $sUnixDate1) $sUnixDate1 = _GetDate_fromUnixTime($iUnixTime1, False) MsgBox($MB_SYSTEMMODAL, "Unix Timestamp", "Get Date from Unix Timestamp with $iReturnLocal = False which returns UTC Time" & @CRLF & $sUnixDate1) Local $iUnixTime2 = _GetUnixTime('2013/01/01 00:00:00') MsgBox($MB_SYSTEMMODAL, "Unix Timestamp", "Seconds since 2013/01/01 00:00:00" & @CRLF & $iUnixTime2) ; Get timestamp for input datetime (or current datetime). Func _GetUnixTime($sDate = 0);Date Format: 2013/01/01 00:00:00 ~ Year/Mo/Da Hr:Mi:Se Local $aSysTimeInfo = _Date_Time_GetTimeZoneInformation() Local $utcTime = "" If Not $sDate Then $sDate = _NowCalc() If Int(StringLeft($sDate, 4)) < 1970 Then Return "" If $aSysTimeInfo[0] = 2 Then ; if daylight saving time is active $utcTime = _DateAdd('n', $aSysTimeInfo[1] + $aSysTimeInfo[7], $sDate) ; account for time zone and daylight saving time Else $utcTime = _DateAdd('n', $aSysTimeInfo[1], $sDate) ; account for time zone EndIf Return _DateDiff('s', "1970/01/01 00:00:00", $utcTime) EndFunc ;==>_GetUnixTime ;$blTrim: Year in short format and no seconds. Func _GetDate_fromUnixTime($iUnixTime, $iReturnLocal = True) Local $aRet = 0, $aDate = 0 Local $aMonthNumberAbbrev[13] = ["", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] Local $timeAdj = 0 If Not $iReturnLocal Then Local $aSysTimeInfo = _Date_Time_GetTimeZoneInformation() Local $timeAdj = $aSysTimeInfo[1] * 60 If $aSysTimeInfo[0] = 2 Then $timeAdj += $aSysTimeInfo[7] * 60 EndIf $aRet = DllCall("msvcrt.dll", "str:cdecl", "ctime", "int*", $iUnixTime + $timeAdj ) If @error Or Not $aRet[0] Then Return "" $aDate = StringSplit(StringTrimRight($aRet[0], 1), " ", 2) Return $aDate[4] & "/" & StringFormat("%.2d", _ArraySearch($aMonthNumberAbbrev, $aDate[1])) & "/" & $aDate[2] & " " & $aDate[3] EndFunc ;==>_GetUnixDate Enjoy!
Realm
Update: >Added some functionality and a suggestion from FireFox
-
Realm got a reaction from ak59000 in Where have my posts gone ?
He better not try, He will get his IP banned, then He will not be able to read the site either.
-
Realm reacted to QuickWhiteWolf in Back to my roots- Thank you AutoIT Community!
Hi everyone,
I was previously a member of this forum under the username Wombat. It's been years and multiple email accounts closed since then so I decided to start fresh and take a moment to thank you all... (Admins/Mods let me know if we need to discuss this...)
I started programming with AutoIT while working as a scrap catcher for a machine that chopped scrap into pieces for easier moving, I learned styles and gained strengths from some of the best members on this forum by reverse engineering their code. I gained the confidence of our IT manager by making a boast that I could write an application to replace a p.o.s. cobalt based app we were using on the floor at that time, needless to say I was way in over my head but he saw that I had potential and I luckily had built several other apps on the side that were of equal or greater value to the company. I've been working as help-desk for the past 3 years and writing software as well to facilitate the help desk and solve recurring issues with our users. I was given an office and moved out of help-desk about a year ago, after 5 years of hard work I've actually landed the title of Jr. Developer moving into mid level title/pay this year! The company has already set out an improvement path that sees me with 4 certs and a bachelors in 4 more years making great money. Before this I had only ever worked at gas stations, fast food and manual labor jobs. If you're ever worried about your life, want something more, or just want a change you can do it. It's not easy, not at all, but it's possible and software programming is a very rewarding field if you like to make things and see how others interact with them.
I utilized AutoIT to bring a company into the twenty-first century, away from paper trails and sticky notes improving the quality of life for the employees on the floor (where I started before learning AutoIT). I was given the go ahead to purchase visual studio and I learned VB.Net and built an awesome piece of Zebra labeling software (Utilizing ZPL code translated froma graphical editor) for our shipping department. Now I'm diving head first into C# and we have another programmer on board as we move on to MS Team Services and begin to tackle a sweet new project involving real time awareness of our product on the factory floor utilizing RFID and windows 10 tablets.
That's a long way to come in just 4 years, and I couldn't have done it without the gigantic heart this community has and the mentorship provided for people looking to get into programming.
So from the bottom of my heart, with immense respect.... Thank you so much AutoIT community
-
Realm got a reaction from vovanluan94 in Why this controlclick doesn't work
Hello lichadec,
Welcome to the AutoIt Forums
The way your script is using the pixel coords may differ from the way you obtained them.
Use 'AutoIt Window Info' tool to obtain the correct coords. it has 3 options in which to grab the coords:
1. Screen - Utilizes pixel coords based on your full screen (which is the default for which scripts search with)
2. Window - Utilizes pixel coords based on the entire window in which you are active in.
3. Client - utilizes pixel coords based on the client section of the window which you are active in.
After which you can use Opt() or AutoItSetOption() to tell your script how to use pixel coords with these examples:
Opt('PixelCoordMode',0) ;Uses pixel coords relative to the defined Window Opt('PixelCoordMode',1) ;Uses pixel coords relative to the absolute screen coordinates Opt('PixelCoordMode',2) ;Uses pixel coords relative to the client area fo the defined Window AutoItSetOption('PixelCoordMode',0) ;Uses pixel coords relative to the defined Window AutoItSetOption('PixelCoordMode',1) ;Uses pixel coords relative to the absolute screen coordinates AutoItSetOption('PixelCoordMode',2) ;Uses pixel coords relative to the client area fo the defined Window
Realm
-
Realm got a reaction from thegebi in Seconds since Epoch (a.k.a. Unix Timestamp)
After Several Minutes searching the forums for a simple solution to calculating for the Unix Time, as required for another project I am working on, I was astonished to not find one clean and universal solution. After looking over the helpfile, I noticed one simple solution given in the example with _DateDiff(). However it did not account for my current timezone or daylight savings time.
Without further ado... This is my example of Calculating for a current Unix Time stamp or seconds since Jan, 1st, 1970 00:00:00 GMT.
This function will account for your timezone as well as for daylight savings time.
Update: v0.3
-Added Function to revert a Unix Time stamp into Date form.
-Added parameter to original _GetUnixTime() allowing for a custom date since Jan 1st 1970 to be passed and converted to Unix Time.
#include <Date.au3> #include <Array.au3> #include <Constants.au3> Local $iUnixTime1 = _GetUnixTime() MsgBox($MB_SYSTEMMODAL, "Unix Timestamp", "Seconds Since Jan, 1st, 1970 00:00:00 GMT" & @CRLF & $iUnixTime1) Local $sUnixDate1 = _GetDate_fromUnixTime($iUnixTime1) MsgBox($MB_SYSTEMMODAL, "Unix Timestamp", "Get Date from Unix Timestamp in Local Time" & @CRLF & $sUnixDate1) $sUnixDate1 = _GetDate_fromUnixTime($iUnixTime1, False) MsgBox($MB_SYSTEMMODAL, "Unix Timestamp", "Get Date from Unix Timestamp with $iReturnLocal = False which returns UTC Time" & @CRLF & $sUnixDate1) Local $iUnixTime2 = _GetUnixTime('2013/01/01 00:00:00') MsgBox($MB_SYSTEMMODAL, "Unix Timestamp", "Seconds since 2013/01/01 00:00:00" & @CRLF & $iUnixTime2) ; Get timestamp for input datetime (or current datetime). Func _GetUnixTime($sDate = 0);Date Format: 2013/01/01 00:00:00 ~ Year/Mo/Da Hr:Mi:Se Local $aSysTimeInfo = _Date_Time_GetTimeZoneInformation() Local $utcTime = "" If Not $sDate Then $sDate = _NowCalc() If Int(StringLeft($sDate, 4)) < 1970 Then Return "" If $aSysTimeInfo[0] = 2 Then ; if daylight saving time is active $utcTime = _DateAdd('n', $aSysTimeInfo[1] + $aSysTimeInfo[7], $sDate) ; account for time zone and daylight saving time Else $utcTime = _DateAdd('n', $aSysTimeInfo[1], $sDate) ; account for time zone EndIf Return _DateDiff('s', "1970/01/01 00:00:00", $utcTime) EndFunc ;==>_GetUnixTime ;$blTrim: Year in short format and no seconds. Func _GetDate_fromUnixTime($iUnixTime, $iReturnLocal = True) Local $aRet = 0, $aDate = 0 Local $aMonthNumberAbbrev[13] = ["", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] Local $timeAdj = 0 If Not $iReturnLocal Then Local $aSysTimeInfo = _Date_Time_GetTimeZoneInformation() Local $timeAdj = $aSysTimeInfo[1] * 60 If $aSysTimeInfo[0] = 2 Then $timeAdj += $aSysTimeInfo[7] * 60 EndIf $aRet = DllCall("msvcrt.dll", "str:cdecl", "ctime", "int*", $iUnixTime + $timeAdj ) If @error Or Not $aRet[0] Then Return "" $aDate = StringSplit(StringTrimRight($aRet[0], 1), " ", 2) Return $aDate[4] & "/" & StringFormat("%.2d", _ArraySearch($aMonthNumberAbbrev, $aDate[1])) & "/" & $aDate[2] & " " & $aDate[3] EndFunc ;==>_GetUnixDate Enjoy!
Realm
Update: >Added some functionality and a suggestion from FireFox
-
Realm reacted to mLipok in String Regular Expression Pattern
Could you try this:
#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w 7 #Tidy_Parameters=/sort_funcs /reel #include <array.au3> #include <date.au3> #include <MsgBoxConstants.au3> #include "XML.au3" ; This COM Error Hanlder will be used globally (excepting inside UDF Functions) Global $oErrorHandler = ObjEvent("AutoIt.Error", ErrFunc_CustomUserHandler_MAIN) #forceref $oErrorHandler ; This is SetUp for the transfer UDF internal COM Error Handler to the user function _XML_ComErrorHandler_UserFunction(ErrFunc_CustomUserHandler_XML) Example_1__XML_SelectNodes() #Region XML__Examples.au3 - Function Func Example_1__XML_SelectNodes() ; first you must create $oXmlDoc object Local $oXMLDoc = _XML_CreateDOMDocument(Default) If @error Then MsgBox(0, '_XML_CreateDOMDocument @error:', XML_My_ErrorParser(@error)) Else ; Load file to $oXmlDoc Local $sXML_Content = "" & _ "<Checkin>" & _ "<Item CatalogID='ID_15674'>" & _ " <SUPPLIER_NAME_STRING id='ID1014_161'/>" & _ " <BRANDNAME_STRING id='ID1043_111'/>" & _ " <QRYTEXT_STRING id='ID1082_8519'/>" & _ " <RARITY_STATUS id='ID1164_2'/>" & _ " <ARTID value='27700'/>" & _ " <SUPPLIER_NUMBER value='127700'/>" & _ " <OFFSET_ID value='ID_22265'/>" & _ " <STAMP value='256/350'/>" & _ " <STYLE value='1'/>" & _ " <IS_PROMOTIONAL value='0'/>" & _ "</Item>" & _ "<Item CatalogID='ID_15675'>" & _ " <SUPPLIER_NUMBER value='389844'/>" & _ " <OFFSET_ID value='ID_15674'/>" & _ " <IS_COMPLETED/> " & _ "</Item>" & _ "</Checkin>" & _ "" _XML_LoadXml($oXMLDoc, $sXML_Content) If @error Then MsgBox(0, '_XML_Load @error:', XML_My_ErrorParser(@error)) MsgBox(0, '', _XML_ErrorParser_GetDescription($oXMLDoc)) Else ; simple display $oXmlDoc - for checking only Local $sXmlAfterTidy = _XML_TIDY($oXMLDoc) If @error Then MsgBox(0, '_XML_TIDY @error:', XML_My_ErrorParser(@error)) Else MsgBox($MB_SYSTEMMODAL + $MB_ICONINFORMATION, 'Example_1__XML_SelectNodes', $sXmlAfterTidy) EndIf ; selecting nodes _XML_SelectNodes($oXMLDoc, "//Item") If @error Then MsgBox(0, '_XML_SelectNodes @error:', XML_My_ErrorParser(@error)) MsgBox(0, '', _XML_ErrorParser_GetDescription($oXMLDoc)) Else Local $iNodesCount = @extended MsgBox(0, '$iNodesCount ', $iNodesCount) For $iItem_idx = 1 To $iNodesCount Local $oChilds_Coll = _XML_SelectNodes($oXMLDoc, '//Checkin/Item[' & $iItem_idx & ']/*') Local $aNodesColl = _XML_Array_GetNodesProperties($oChilds_Coll) If @error Then MsgBox(0, '_XML_Array_GetNodesProperties($oNodesColl)', XML_My_ErrorParser(@error)) Else ; display array _ArrayDisplay($aNodesColl, 'Example_1__XML_SelectNodes ' & $iItem_idx) EndIf Next EndIf EndIf EndIf EndFunc ;==>Example_1__XML_SelectNodes #EndRegion XML__Examples.au3 - Function #Region XML__Examples.au3 - XML DOM Error/Event Handling Func ErrFunc_CustomUserHandler_MAIN($oError) ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : MainScript ==> COM Error intercepted !" & @CRLF & _ @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _ @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _ @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _ @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _ @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _ @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _ @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _ @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _ @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF) EndFunc ;==>ErrFunc_CustomUserHandler_MAIN Func ErrFunc_CustomUserHandler_XML($oError) ; here is declared another path to UDF au3 file ; thanks to this with using _XML_ComErrorHandler_UserFunction(ErrFunc_CustomUserHandler_XML) ; you get errors which after pressing F4 in SciTE4AutoIt you goes directly to the specified UDF Error Line ConsoleWrite(@ScriptDir & '\XML.au3' & " (" & $oError.scriptline & ") : UDF ==> COM Error intercepted ! " & @CRLF & _ @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _ @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _ @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _ @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _ @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _ @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _ @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _ @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _ @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF) EndFunc ;==>ErrFunc_CustomUserHandler_XML ; #FUNCTION# ==================================================================================================================== ; Name ..........: XML_My_ErrorParser ; Description ...: Changing $XML_ERR_ ... to human readable description ; Syntax ........: XML_My_ErrorParser($iXMLWrapper_Error, $iXMLWrapper_Extended) ; Parameters ....: $iXMLWrapper_Error - an integer value. ; $iXMLWrapper_Extended - an integer value. ; Return values .: description as string ; Author ........: mLipok ; Modified ......: ; Remarks .......: This function is only example of how user can parse @error and @extended to human readable description ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func XML_My_ErrorParser($iXMLWrapper_Error, $iXMLWrapper_Extended = 0) Local $sErrorInfo = '' Switch $iXMLWrapper_Error Case $XML_ERR_OK $sErrorInfo = '$XML_ERR_OK=' & $XML_ERR_OK & @CRLF & 'All is ok.' Case $XML_ERR_GENERAL $sErrorInfo = '$XML_ERR_GENERAL=' & $XML_ERR_GENERAL & @CRLF & 'The error which is not specifically defined.' Case $XML_ERR_COMERROR $sErrorInfo = '$XML_ERR_COMERROR=' & $XML_ERR_COMERROR & @CRLF & 'COM ERROR OCCURED. Check @extended and your own error handler function for details.' Case $XML_ERR_ISNOTOBJECT $sErrorInfo = '$XML_ERR_ISNOTOBJECT=' & $XML_ERR_ISNOTOBJECT & @CRLF & 'No object passed to function' Case $XML_ERR_INVALIDDOMDOC $sErrorInfo = '$XML_ERR_INVALIDDOMDOC=' & $XML_ERR_INVALIDDOMDOC & @CRLF & 'Invalid object passed to function' Case $XML_ERR_INVALIDATTRIB $sErrorInfo = '$XML_ERR_INVALIDATTRIB=' & $XML_ERR_INVALIDATTRIB & @CRLF & 'Invalid object passed to function.' Case $XML_ERR_INVALIDNODETYPE $sErrorInfo = '$XML_ERR_INVALIDNODETYPE=' & $XML_ERR_INVALIDNODETYPE & @CRLF & 'Invalid object passed to function.' Case $XML_ERR_OBJCREATE $sErrorInfo = '$XML_ERR_OBJCREATE=' & $XML_ERR_OBJCREATE & @CRLF & 'Object can not be created.' Case $XML_ERR_NODECREATE $sErrorInfo = '$XML_ERR_NODECREATE=' & $XML_ERR_NODECREATE & @CRLF & 'Can not create Node - check also COM Error Handler' Case $XML_ERR_NODEAPPEND $sErrorInfo = '$XML_ERR_NODEAPPEND=' & $XML_ERR_NODEAPPEND & @CRLF & 'Can not append Node - check also COM Error Handler' Case $XML_ERR_PARSE $sErrorInfo = '$XML_ERR_PARSE=' & $XML_ERR_PARSE & @CRLF & 'Error: with Parsing objects, .parseError.errorCode=' & $iXMLWrapper_Extended & ' Use _XML_ErrorParser_GetDescription() for get details.' Case $XML_ERR_PARSE_XSL $sErrorInfo = '$XML_ERR_PARSE_XSL=' & $XML_ERR_PARSE_XSL & @CRLF & 'Error with Parsing XSL objects .parseError.errorCode=' & $iXMLWrapper_Extended & ' Use _XML_ErrorParser_GetDescription() for get details.' Case $XML_ERR_LOAD $sErrorInfo = '$XML_ERR_LOAD=' & $XML_ERR_LOAD & @CRLF & 'Error opening specified file.' Case $XML_ERR_SAVE $sErrorInfo = '$XML_ERR_SAVE=' & $XML_ERR_SAVE & @CRLF & 'Error saving file.' Case $XML_ERR_PARAMETER $sErrorInfo = '$XML_ERR_PARAMETER=' & $XML_ERR_PARAMETER & @CRLF & 'Wrong parameter passed to function.' Case $XML_ERR_ARRAY $sErrorInfo = '$XML_ERR_ARRAY=' & $XML_ERR_ARRAY & @CRLF & 'Wrong array parameter passed to function. Check array dimension and conent.' Case $XML_ERR_XPATH $sErrorInfo = '$XML_ERR_XPATH=' & $XML_ERR_XPATH & @CRLF & 'XPath syntax error - check also COM Error Handler.' Case $XML_ERR_NONODESMATCH $sErrorInfo = '$XML_ERR_NONODESMATCH=' & $XML_ERR_NONODESMATCH & @CRLF & 'No nodes match the XPath expression' Case $XML_ERR_NOCHILDMATCH $sErrorInfo = '$XML_ERR_NOCHILDMATCH=' & $XML_ERR_NOCHILDMATCH & @CRLF & 'There is no Child in nodes matched by XPath expression.' Case $XML_ERR_NOATTRMATCH $sErrorInfo = '$XML_ERR_NOATTRMATCH=' & $XML_ERR_NOATTRMATCH & @CRLF & 'There is no such attribute in selected node.' Case $XML_ERR_DOMVERSION $sErrorInfo = '$XML_ERR_DOMVERSION=' & $XML_ERR_DOMVERSION & @CRLF & 'DOM Version: ' & 'MSXML Version ' & $iXMLWrapper_Extended & ' or greater required for this function' Case $XML_ERR_EMPTYCOLLECTION $sErrorInfo = '$XML_ERR_EMPTYCOLLECTION=' & $XML_ERR_EMPTYCOLLECTION & @CRLF & 'Collections of objects was empty' Case $XML_ERR_EMPTYOBJECT $sErrorInfo = '$XML_ERR_EMPTYOBJECT=' & $XML_ERR_EMPTYOBJECT & @CRLF & 'Object is empty' Case Else $sErrorInfo = '=' & $iXMLWrapper_Error & @CRLF & 'NO ERROR DESCRIPTION FOR THIS @error' EndSwitch Local $sExtendedInfo = '' Switch $iXMLWrapper_Error Case $XML_ERR_COMERROR, $XML_ERR_NODEAPPEND, $XML_ERR_NODECREATE $sExtendedInfo = 'COM ERROR NUMBER (@error returned via @extended) =' & $iXMLWrapper_Extended Case $XML_ERR_PARAMETER $sExtendedInfo = 'This @error was fired by parameter: #' & $iXMLWrapper_Extended Case Else Switch $iXMLWrapper_Extended Case $XML_EXT_DEFAULT $sExtendedInfo = '$XML_EXT_DEFAULT=' & $XML_EXT_DEFAULT & @CRLF & 'Default - Do not return any additional information' Case $XML_EXT_XMLDOM $sExtendedInfo = '$XML_EXT_XMLDOM=' & $XML_EXT_XMLDOM & @CRLF & '"Microsoft.XMLDOM" related Error' Case $XML_EXT_DOMDOCUMENT $sExtendedInfo = '$XML_EXT_DOMDOCUMENT=' & $XML_EXT_DOMDOCUMENT & @CRLF & '"Msxml2.DOMDocument" related Error' Case $XML_EXT_XSLTEMPLATE $sExtendedInfo = '$XML_EXT_XSLTEMPLATE=' & $XML_EXT_XSLTEMPLATE & @CRLF & '"Msxml2.XSLTemplate" related Error' Case $XML_EXT_SAXXMLREADER $sExtendedInfo = '$XML_EXT_SAXXMLREADER=' & $XML_EXT_SAXXMLREADER & @CRLF & '"MSXML2.SAXXMLReader" related Error' Case $XML_EXT_MXXMLWRITER $sExtendedInfo = '$XML_EXT_MXXMLWRITER=' & $XML_EXT_MXXMLWRITER & @CRLF & '"MSXML2.MXXMLWriter" related Error' Case $XML_EXT_FREETHREADEDDOMDOCUMENT $sExtendedInfo = '$XML_EXT_FREETHREADEDDOMDOCUMENT=' & $XML_EXT_FREETHREADEDDOMDOCUMENT & @CRLF & '"Msxml2.FreeThreadedDOMDocument" related Error' Case $XML_EXT_XMLSCHEMACACHE $sExtendedInfo = '$XML_EXT_XMLSCHEMACACHE=' & $XML_EXT_XMLSCHEMACACHE & @CRLF & '"Msxml2.XMLSchemaCache." related Error' Case $XML_EXT_STREAM $sExtendedInfo = '$XML_EXT_STREAM=' & $XML_EXT_STREAM & @CRLF & '"ADODB.STREAM" related Error' Case $XML_EXT_ENCODING $sExtendedInfo = '$XML_EXT_ENCODING=' & $XML_EXT_ENCODING & @CRLF & 'Encoding related Error' Case Else $sExtendedInfo = '$iXMLWrapper_Extended=' & $iXMLWrapper_Extended & @CRLF & 'NO ERROR DESCRIPTION FOR THIS @extened' EndSwitch EndSwitch ; return back @error and @extended for further debuging Return SetError($iXMLWrapper_Error, $iXMLWrapper_Extended, _ '@error description:' & @CRLF & _ $sErrorInfo & @CRLF & _ @CRLF & _ '@extended description:' & @CRLF & _ $sExtendedInfo & @CRLF & _ '') EndFunc ;==>XML_My_ErrorParser #EndRegion XML__Examples.au3 - XML DOM Error/Event Handling
-
Realm reacted to DaleHohm in LibrariesIE.au3
File Name: IE.au3
File Submitter: DaleHohm
File Submitted: 27 Mar 2013
File Category: Libraries
Title: Internet Explorer Automation UDF Library for AutoIt3
Filename: IE.au3
Description: A collection of functions for creating, attaching to, reading from and manipulating Internet Explorer
Author: DaleHohm
Version: T3.0-0
Last Update: 9/3/12
Requirements: AutoIt3 3.3.9 or higher
This version is checked into the development stream for the next AutoIt beta release, but will work with the most recently released V3.3.9.x beta.
I am releasing it here so that it can get some testing now and help some people with some of the issues it fixes in the realm of COM error handling (and "the WEND error").
This file will be removed when it is included in a public beta release.
Dale
-
Realm reacted to JohnQSmith in super easy noob question *pls* help
Whenever someone says "pls" because it's shorter than "please", I say "no" because it's shorter than "yes".
-
Realm got a reaction from Irrelixier in Coverting MouseClick to MouseClickDrag
Hello Irrelixier,
Doesn't MouseDown(), MouseMove(), and MouseUp() work?
MouseDown( 'left' ) Do $x1 = $x1 + Random(0, Random(0, 5), 1) MouseMove( $x1, $y1 ) Until $x1 >= Random(450, 550, 1) MouseUp( 'left' )
Happy Coding!
Realm
-
Realm got a reaction from Crazyace in [Solved] Converting from AHK to AU3 - Gui Checkbox
Crazyace,
When you see brackets, '[' ']', in the parameter explanations within the helpfile, these are not meant to be used inside the actual code, they are merely symbolic for the parameter is optional.
$input is the variable pointer to your GUICtrlCreateInput() control.
When 'Submit' is pressed, it will read the user input from that control into the variable $serv_tag. Afterwhich it will pass $serv_tag to the function _Fire(). If you look at function _Fire(), you will see that it accepts 1 parameter that will be assigned to variable $sServiceTag. This is the variable that now holds the user's input to which can be used within function _Fire().
I highly recommend reading The first section of the Help file, to get a better understanding of how AutoIt works, especially with Functions.
I am not sure why you have the url pasted twice in your post. You don't need tags either. _IECreate() will also return an object variable that points to InternetExplorer.Applicaton (the controls behind the browswer your attempting to open). So give it a variable to return to, so you have a way to manipulate the window further.
$oIE = _IECreate("http://support.dell.com/support/topics/global.aspx/support/my_systems_info/manuals?c=us&l=en&s=biz&~ck=ln&lnki=0&ServiceTag=" & $sServiceTag) _IENavigate($oIE, $another_url) I did not test this example, however and in theory providing the url is correct as you have posted, this should work for you. Remove the _IENavigate(), I added that so you could visualize how the object handling will be performed.
Realm
-
Realm got a reaction from Crazyace in [Solved] Converting from AHK to AU3 - Gui Checkbox
Crazyace,
I am sorry I didn't fully explore your code last time, and just went directly to answering your questions. I have modified your code a bit so that it will perform more to your needs. I noticed from your original post you had a large sleep function at the bottom to keep your GUI open. When a button is pressed during sleep mode, it will not perform your needs. You need to create a loop after your gui creation to watch for user input and activity. Hope this helps a bit.
#include <GUIConstants.au3> GUICreate("Drivers/Manuals/Warranty", 280, 110) $Driver = GUICtrlCreateCheckbox("Drivers", 10, 10) GUICtrlSetState(-1, $GUI_CHECKED) $Manual = GUICtrlCreateCheckbox("Manual", 80, 10) $Warranty = GUICtrlCreateCheckbox("Warranty", 150, 10) GUICtrlCreateLabel("Service Tag #:", 10, 45) $Input = GUICtrlCreateInput("", 90, 40) $Submit = GUICtrlCreateButton("Submit", 40, 70, 50) $Exit = GUICtrlCreateButton("Cancel", 150, 70, 50) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Submit $serv_tag = GUICtrlRead($Input) If GUICtrlGetState($Driver) = $GUI_CHECKED Then _Fire($serv_tag) Case $msg = $Exit ExitLoop EndSelect WEnd Exit 0 Func _Fire($sServiceTag) ;IE functin that will handle $sServiceTag that is the passed input read from control $Input EndFunc
Realm
Edit: If you are using Scite, this only works for the AutoIt version that was included with the standard Install, to create your scripts, you may also type 'setupgui' then press space and it will create a basic template shell of a gui window code for you, including the while loop.
-
Realm got a reaction from Crazyace in [Solved] Converting from AHK to AU3 - Gui Checkbox
Hello Crazyace,
#1) Use GUICtrlSetState() to set the state of controls.
;This will set the checkbox control to checked GUICtrlSetState( $Driver, $GUI_CHECKED ) ;just as this example will set it's state as unchecked. GUICtrlSetState( $Driver, $GUI_UNCHECKED ) Embedded with your code, you will get this:
$Driver = GUICtrlCreateCheckbox("Drivers", 10, 10) GUICtrlSetState( -1, $GUI_CHECKED ) $Manual = GUICtrlCreateCheckbox("Manual", 80, 10) $Warranty = GUICtrlCreateCheckbox("Warranty", 150, 10) GUICtrlCreateLabel("Service Tag #:", 10, 45) $Input = GUICtrlCreateInput("", 90, 40) GUICtrlCreateButton("Submit", 40, 70, 50) GUICtrlCreateButton("Cancel", 150, 70, 50)
#2) You will want to use GUICtrlGetState() to retrieve the state of a control
GUICtrlGetState($Driver) to perform a _Function() when this is checked you would:
If GUICtrlGetState($Driver) = $GUI_CHECKED Then _Function()
Sorry to verify, but you are right that your AHK com code will not work properly with AutoIt. However, and on a brighter side, if you read up on IE.au3 UDF in your help file, I am certain you will find it moderately easy to convert your AHK code to better interact with AutoIt.
Some functions that may help are:
_IECreate() ;To create com object with Internet Explorer _IENavigate() ;Navigates _IELoadWait() ;Sleep function while the page loads
Good Luck & Happy Coding!
Realm
-
Realm reacted to Valik in 12:00PM April 18 2012
You're kind of a boring troll. You're not funny enough to be entertaining; you're not smart enough to be clever; you're not insane enough to be interesting. All in all I've had better trolls
-
Realm reacted to BrewManNH in 12:00PM April 18 2012
Central Standard time or Central Daylight Savings time? Because most of the USA is currently operating under DST and not STD time. Could we get this in UTC for consistency so we all can cower together at the correct time? Thanks -
Realm reacted to Blue_Drache in 12:00PM April 18 2012
I got tired of trying, so I wrote a script that would click a region shaped like the (SHOW) button.
Of course, it took me way longer to write the script than it otherwise would have to just click all the spoiler buttons by hand, and I deleted it after I was done, but *shrug*
Programmers have always expended more energy to get out of doing something they could otherwise do with less. Especially if it's something mind-numbingly boring and repetitive.
-
-
Realm got a reaction from maniootek in How to easy "transfer" integer or string to program?
Hello maniootek,
Yes, most simple solution would be InputBox()
Realm
-
Realm got a reaction from nusaki in How to do pixelsearch with restrictions?
nusaki,
The speed might be a little slower, however it should not be enough to show a noticeable difference. My example works fine on my end. If it's not working on your end, then it's more than likely to do with the rest of the code in your script. I can't tell you whats wrong without seeing your code. It would be much easier to help you solve your problem if you would show your script. Don't forget to put your script in code tags [ autoit][ /autoi] (just delelte the spaces)
Realm
-
Realm got a reaction from nusaki in How to do pixelsearch with restrictions?
Hello nusaki,
There is simple step around using PixelGetColor(). However, it will lose the ability to use shade-variations for searching. If you need the shade-varietions. then try defining 4 seperate PixelSearch() controls searching 0,0,100,9 and 0,10,9,20 and 21,10,100,20 and 0,21,100,100.
However there is another more simple way if you need to find a specific pixel color using loops:
For $row = 0 To 100 For $col = 0 To 100 If $row >= 10 And $row <= 20 And $col >= 10 And $col <= 20 Then ContinueLoop $search = PixelGetColor( $row, $col ) If $search = $color_to_find Then ;do something here EndIf Next Next -
Realm reacted to Valik in [HELP] Triggerbot / Shotbot
Tempted to leave your email address so spam harvesters can get it. Also highly tempted to stick it into a bunch of porn sites and other spam factories. Instead I'll remove your email address and permanently block you. Since our rules mean nothing to you I'll just make you go away.
-
Realm reacted to water in Script line generator for Internet Explorer
Could you please put AutoIt code tags around your code? So it gets nicely formated and is much much more readable.
-
Realm reacted to seangriffin in Tesseract (Screen OCR) UDF
This UDF provides text capturing support for applications and controls using Tesseract - an OCR engine currently developed by Google.
Tesseract was originally developed as proprietary software at Hewlett-Packard between 1985 until 1995. After ten years without any development taking place, Hewlett Packard and UNLV released it as open source in 2005. Tesseract is currently developed by Google and released under the Apache License, Version 2.0.
Tesseract is considered one of the most accurate free software OCR engines currently available. It was one of the top 3 engines in the 1995 UNLV Accuracy test.
My main goal in developing this UDF is to provide AutoIT users with a free Screen OCR solution that competes with other commercial (payed) technologies like Microsoft Office Document Imaging (MODI) and Textract.
REQUIREMENTS:
AutoIt3 3.2 or higher Tesseract 2.01 or above INSTALLATION: To install Tesseract:
Run the file http://web.aanet.com.au/seangriffin/Tesseract201.exe. Follow the installation instructions. LIST OF FUNCTIONS:
DEMONSTRATION: <Under Construction>
EXAMPLES:
_TesseractControlCapture.au3_TesseractControlFind.au3
DOWNLOAD:
Latest Version - v0.6 (17/03/09)
Tesseract.au3