AutoitMike 3 Posted October 19, 2022 Share Posted October 19, 2022 I found some neat functions and one of them needs "Includes" that I do not have in my "Include" folder. I copied a few from GitHub.com that appear to work, But I get an error when attempting to use WinAPIInternals.au3 The error is on line 629, character 16: 628 Func __Iif($bTest, $vTrue, $vFalse) 629 Return $bTest ? $vTrue : $vFalse 630 EndFunc ;==>__Iif The 16th character is the question mark. I never seen this used, it looks like it needs to be: 628 Func __Iif($bTest, $vTrue, $vFalse) 629 Return $bTest, $vTrue : $vFalse 630 EndFunc ;==>__Iif But that is wrong also. I cant find anywhere else to get WinApIInternals.au3 Thanks for any help Link to post Share on other sites
Danp2 1,382 Posted October 19, 2022 Share Posted October 19, 2022 What version of AutoIt are you using? It sounds like you are using an older version that doesn't support the ternary operator. WebDriver UDF [GH&S] Latest version Wiki FAQs Link to post Share on other sites
AutoitMike 3 Posted October 20, 2022 Author Share Posted October 20, 2022 Im using 3.3.8.1 Link to post Share on other sites
Danp2 1,382 Posted October 20, 2022 Share Posted October 20, 2022 So that would explain why the ternary operator isn't recognized. 🤣 Why such an old version? Are you still on WinXP?! WebDriver UDF [GH&S] Latest version Wiki FAQs Link to post Share on other sites
pixelsearch 519 Posted October 20, 2022 Share Posted October 20, 2022 Please note that even if OP is still on XP, the last release 3.3.16.1 (Sept 2022) is fully compatible with XP Service Pack 3 Link to post Share on other sites
Danp2 1,382 Posted October 20, 2022 Share Posted October 20, 2022 Good to know. I was thinking that support from XP had been previously dropped. WebDriver UDF [GH&S] Latest version Wiki FAQs Link to post Share on other sites
Nine 1,634 Posted October 20, 2022 Share Posted October 20, 2022 Before ternary op was introduced, there was a _Iif function in Misc UDF. (if I remember correctly) “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector GIF Animation (cached) Screen Scraping Link to post Share on other sites
AutoitMike 3 Posted October 22, 2022 Author Share Posted October 22, 2022 Thanks for the info. I thought that there was an error in the code. I got it from github This is a simple code change I can make. Link to post Share on other sites
AutoitMike 3 Posted October 22, 2022 Author Share Posted October 22, 2022 OK, Now I have a different error in WinAPISys.au3: C:\Program Files (x86)\AutoIt3\Include\WinAPISys.au3(1141,48) : WARNING: $STR_STRIPLEADING: possibly used before declaration. Here is the code inside of WinAPISys: 1138 Func _WinAPI_GetModuleHandleEx($sModule, $iFlags = 0) 1139 Local $sTypeOfModule = 'ptr' 1140 If IsString($sModule) Then 1141 If StringStripWS($sModule, $STR_STRIPLEADING + $STR_STRIPTRAILING) Then 1142 $sTypeOfModule = 'wstr' 1143 Else 1144 $sModule = 0 1145 EndIf 1146 EndIf 1148 Local $aRet = DllCall('kernel32.dll', 'bool', 'GetModuleHandleExW', 'dword', $iFlags, $sTypeOfModule, $sModule, 'ptr*', 0) 1149 If @error Or Not $aRet[0] Then Return SetError(@error, @extended, 0) ; If Not $aRet[0] Then Return SetError(1000, 0, 0) 1152 Return $aRet[3] 1153 EndFunc Maybe I just need to declare $STR_STRIPLEADING ? Link to post Share on other sites
OJBakker 23 Posted October 22, 2022 Share Posted October 22, 2022 $STR_STRIPLEADING and $STR_STRIPTRAILING are declared in standard include "StringConstants.au3". The standard include file "WinAPISys.au3" has includes that include the "StringConstants.au3". So if you use the standard includes from the latest autoit version the syntax error you have should not occur. Link to post Share on other sites
pixelsearch 519 Posted October 22, 2022 Share Posted October 22, 2022 Hi AutoitMike Something goes wrong in your AutoIt installation and I'm afraid several AutoIt versions are mixed in the same installation folder. On 10/20/2022 at 6:25 PM, AutoitMike said: Im using 3.3.8.1 3 hours ago, AutoitMike said: OK, Now I have a different error in WinAPISys.au3: C:\Program Files (x86)\AutoIt3\Include\WinAPISys.au3(1141,48) : WARNING: $STR_STRIPLEADING: possibly used before declaration. Here is the code inside of WinAPISys: 1138 Func _WinAPI_GetModuleHandleEx($sModule, $iFlags = 0) 1139 Local $sTypeOfModule = 'ptr' 1140 If IsString($sModule) Then 1141 If StringStripWS($sModule, $STR_STRIPLEADING + $STR_STRIPTRAILING) Then 1) AutoIt 3.3.8.1 was released on January 2012 and there was no WinAPISys.au3 file in it (just re-checked). In this version, there was only a huge file named WinApi.au3 (375Kb) which will be splitted into plenty of files named WinAPIxxxxx.au3 in a future release. 2) WinAPISys.au3 appears later, starting "autoit-v3.3.10.0 (invasion of Yashied WinApiEx func)" released on December 2013, but even there, the lines inside this file don't match yours. Below are lines 1138-1141 from WinAPISys.au3, version 3.3.10.0 : 1138 ; Modified.......: Jpm 1139 ; =============================================================================================================================== 1140 Func _WinAPI_GetModuleHandleEx($sModule, $iFlags = 0) 1141 Local $TypeOfModule = 'ptr' 3) Your lines are found starting "autoit-v3.3.14.0" released on July 2015 : 1138 Func _WinAPI_GetModuleHandleEx($sModule, $iFlags = 0) 1139 Local $sTypeOfModule = 'ptr' 1140 If IsString($sModule) Then 1141 If StringStripWS($sModule, $STR_STRIPLEADING + $STR_STRIPTRAILING) Then I suggest you'd make a clean installation of AutoIt, probably deleting before everything that's found in your installation folder, then installing the lastest official release. After that, if some of your scripts won't work correctly (because include files have changed through the years) then you'll have to adapt your scripts to the last release. Also many AutoIt & UDF bugs have been fixed through the years. If you don't do that, I'm afraid you'll often find the kind of issues you described. If another reader got a different opinion, please share your thoughts here. Good luck Link to post Share on other sites
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now