wraithdu Posted December 2, 2011 Posted December 2, 2011 (edited) I just tested your example on a Win7 x64 machine with AutoIt 3.3.7.21, and all 4 functions were successful. Edit: BTW, INVALID_HANDLE_VALUE should be Ptr(-1). Be careful with implied data type conversions. Edited December 2, 2011 by wraithdu KaFu 1
KaFu Posted December 2, 2011 Posted December 2, 2011 (edited) Somehow installing / uninstalling / re-installing Autoit must have messed up my config, the script was always started with prod and not Beta ... now I did a fresh install and everything works fine. Thanks for testing and pointing out the potential issue with INVALID_HANDLE_VALUE ! Edited December 2, 2011 by KaFu OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16)
KaFu Posted December 2, 2011 Posted December 2, 2011 (edited) Just in case anyone else ever searches for a way to read a FILETIME structure, here's a sample:$tUINT64 = DllStructCreate("uint64") $tFILETIME = DllStructCreate("dword;dword", DllStructGetPtr($tUINT64)) $tWIN32_FIND_DATA = DllStructCreate("dword;STRUCT;dword;dword;ENDSTRUCT;STRUCT;dword;dword;ENDSTRUCT;STRUCT;dword;dword;ENDSTRUCT;dword;dword;dword;dword;wchar[260];wchar[14]") ; Call FindFirstFile / FindNextFile to fill structure DllStructSetData($tFILETIME, 1, DllStructGetData($tWIN32_FIND_DATA, 2)) DllStructSetData($tFILETIME, 2, DllStructGetData($tWIN32_FIND_DATA, 3)) $ftCreationTime = DllStructGetData($tUINT64, 1)Realizing that these extra calls are needed I finally saw why Ascend4nt altered the WIN32_FIND_DATA structure in his excellent _FileFindEx UDF (latest version here) the way he did (yeah, took a while ). Adopting his method I've tried this with success :$tWIN32_FIND_DATA = DllStructCreate("dword;STRUCT;align 4;uint64;ENDSTRUCT;STRUCT;align 4;uint64;ENDSTRUCT;STRUCT;align 4;uint64;ENDSTRUCT;dword;dword;dword;dword;wchar[260];wchar[14]")_FileFindEx_2.zip Edited December 2, 2011 by KaFu OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16)
KaFu Posted December 5, 2011 Posted December 5, 2011 Hiho, I've run into a number() problem, and maybe it's just related to underlying variable types (me )... I've read about a fix in the changelog for 3.3.7.20: "- Fixed #1519, #1694: Int() and Number() returning wrong." Here's my test code: $iNum = 3145728000 ConsoleWrite($iNum & @CRLF) ConsoleWrite(Number($iNum) & @CRLF) ConsoleWrite(String($iNum) & @CRLF) ConsoleWrite(Number(String($iNum)) & @CRLF & @CRLF) $iNum = "3145728000" ConsoleWrite($iNum & @CRLF) ConsoleWrite(Number($iNum) & @CRLF) ConsoleWrite(String($iNum) & @CRLF) ConsoleWrite(Number(String($iNum)) & @CRLF& @CRLF) $iNum = -3145728000 ConsoleWrite($iNum & @CRLF) ConsoleWrite(Number($iNum) & @CRLF) ConsoleWrite(String($iNum) & @CRLF) ConsoleWrite(Number(String($iNum)) & @CRLF& @CRLF) $iNum = "-3145728000" ConsoleWrite($iNum & @CRLF) ConsoleWrite(Number($iNum) & @CRLF) ConsoleWrite(String($iNum) & @CRLF) ConsoleWrite(Number(String($iNum)) & @CRLF& @CRLF) And here's the result for 3.3.7.21 compared to 3.3.6.1: The result of 3.3.6.1 looks like what I would expect, but for 3.3.7.21 in some cases (marked green) it looks odd to me, esp. that this only seems to be true for positive values, negative values still look like I would expect them. Best Regards OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16)
trancexx Posted December 5, 2011 Posted December 5, 2011 (edited) Number() returns numeric (being primitive data type) representation of input data. If you pass numeric data then it doesn't do anything and returns what's passed. If you pass string, the function will do conversation for you. That's the difference.What confuses you is that after the conversation it sizes the output depending on the size of the number. If it fits 32 bits then it's returned as 32bit integer, and as 64bit integer otherwise.You will get second parameter for that (and similar) function which you will use to define how to do conversation.Btw, you probably want to use Int() instead of Number(). Edited December 5, 2011 by trancexx ♡♡♡ . eMyvnE
KaFu Posted December 5, 2011 Posted December 5, 2011 Thanks for clarifying , goes into the direction I've assumed.You will get second parameter for that (and similar) function which you will use to define how to do conversation.Which is not yet documented / implemented and will be available with 3.3.8.0? OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16)
jchd Posted December 5, 2011 Posted December 5, 2011 What confuses you is that after the conversation it sizes the output depending on the size of the number. If it fits 32 bits then it's returned as 32bit integer, and as 64bit integer otherwise.In the case exposed it fit only mechanically but not semantically. The sign bit doesn't have the same meaning as the lower order bits. Shouldn't such conversions round trip? This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)
trancexx Posted December 5, 2011 Posted December 5, 2011 (edited) In the case exposed it fit only mechanically but not semantically. The sign bit doesn't have the same meaning as the lower order bits. Shouldn't such conversions round trip?All bits are preserved. Everything else is matter of interpretation/representation, don't you agree?@KaFu, it was implemented many cycles ago. Edited December 5, 2011 by trancexx ♡♡♡ . eMyvnE
jchd Posted December 5, 2011 Posted December 5, 2011 Sorry I don't agree. It's a matter of consistency and legacy. All previous code will need careful review to ensure "interpretation" won't change with the new version and that needs proving invariants that were previously irrelevant. Then it gets worse if I write such a value in a file or a database. I'm not going to retrieve it verbatim and that can be a major issue. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)
trancexx Posted December 5, 2011 Posted December 5, 2011 You don't have to be sorry and you are right about consistency. That's why the code was changed. It was inconsistent mess before. ♡♡♡ . eMyvnE
jchd Posted December 5, 2011 Posted December 5, 2011 I'm well aware of the previous issues (not at the code level of course). Anyway how do you address the new store X -- retrieve Y problem? This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)
Valik Posted December 5, 2011 Posted December 5, 2011 I'm well aware of the previous issues (not at the code level of course). Anyway how do you address the new store X -- retrieve Y problem? From the changelog for 3.3.7.22: - Changed: Dec(), Int(), Number() have second optional parameter defining non-default behavior. KaFu 1
jchd Posted December 5, 2011 Posted December 5, 2011 I knew you always have a secret weapon ready or ready to get ready! Thanks trancexx + Valik (hope you're in better shape!). This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)
Valik Posted December 7, 2011 Posted December 7, 2011 Special Note: This is an official beta release but it is not digitally signed. Only Jon has the certificate used for digital signatures and the last time I checked I was not Jon.3.3.7.22 (7th December, 2011 (Beta)AutoIt:- Added #2042: @OSVersion returns "Win_8" on Windows 8.- Changed: Dec(), Int(), Number() have second optional parameter defining non-default behavior.- Changed: Hex() detects doubles internally and processes them respecting binary format.- Changed: New visual style for the documetnation.UDFs:- Added: _WinAPI_StringLenA() and _WinAPI_StringLenW() functions.- Added: _WinAPI_DuplicateHandle() function.- Added: _Security__CreateProcessWithToken(), _Security__DuplicateTokenEx and _Security__SetTokenInformation functions.- Added #1925: $WS_EX_LAYOUTRTL control style to the documentation.- Added #2049: Missing windows message codes to WindowsConstants.au3.- Fixed #1777: Issues with Security.au3.- Fixed #2055: replaced DllStructGetPtr with "struct*" throughout UDFs.- Fixed #2048: Windows constants $WM_RBUTTONDBLCLK and $WM_MBUTTONDBLCLK were named incorrectly.- Fixed #2034: _GUICtrlMenu_AppendMenu dllcall type set wrong.- Fixed #2060: Various documentation errors.The following changes are script breaking changes:AutoIt:ObjName() has had a number of bug fixes and changes that may affect data returned. Built-in UDFs have been changed to accomodate this but custom scripts may need to be edited.ObjEvent() AutoIt.Error objects no longer have Raise() or Clear() methods and the properties are read-only.Int() and Hex() no longer set @error.COM methods now require parenthesis so the language can internally detect properties versus methods easier.Important Note: This version contains a change to the visual style used in the documentation. We need feedback on this style. Please leave all feedback (both positive and negative) in Note: For all you whiny bitches, COM speed is almost as fast as 3.3.6.1. Thank all of you for the little faith you show in us.Report issues here.Download here.
guinness Posted December 7, 2011 Posted December 7, 2011 (edited) Moved to appropriate thread. Edited December 7, 2011 by guinness UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018
guinness Posted December 7, 2011 Posted December 7, 2011 (edited) Sorry, mistakes rarely happen but when they do I know how to make a fool of myself. Moved to the appropriate thread. Edited December 7, 2011 by guinness UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018
jaberwacky Posted December 8, 2011 Posted December 8, 2011 (edited) I see this error when I run a script that uses the _Singleton function: C:Program Files (x86)AutoIt3BetaIncludeMisc.au3 (491) : ==> Variable used without being declared.: Local $handle = DllCall("kernel32.dll", "handle", "CreateMutexW", "struct*", $tSecurityAttributes, "bool", 1, "wstr", $sOccurenceName) Local $handle = DllCall("kernel32.dll", "handle", "CreateMutexW", "struct*", ^ ERROR Win 7 x64 Latest Beta Edited December 8, 2011 by LaCastiglione Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum?
wraithdu Posted December 8, 2011 Posted December 8, 2011 (edited) That raises an interesting question... is there a way to use struct* and still pass a null pointer? The old version of _Singleton allowed for a null pointer as that parameter. Either way, that function is still broken when not using flag 2. Edited December 8, 2011 by wraithdu
Valik Posted December 8, 2011 Posted December 8, 2011 If I wrote a piece of code and you decide to change it... you need to pay attention. I write code that takes scope into account. This was a case where somebody didn't notice the scope a variable needed to be in. Passing an non-DllStruct variable as a "struct*" should result in it being treated as a NULL pointer. That's my expectation at any rate.
Recommended Posts