baconaise Posted February 10, 2019 Share Posted February 10, 2019 Hello! When I went to turn my .au3 into an .exe, I encountered an error that I never had while using F5 in SciTE to run the program. The error seems to be sourced in the included WinAPIInternals.au3 and stemming from the function below. ; #FUNCTION# ==================================================================================================================== ; Author.........: Yashied ; Modified.......: jpm ; =============================================================================================================================== Func _WinAPI_GetString($pString, $bUnicode = True) Local $iLength = _WinAPI_StrLen($pString, $bUnicode) If @error Or Not $iLength Then Return SetError(@error + 10, @extended, '') Local $tString = DllStructCreate(($bUnicode & 'wchar' : 'char') & '[' & ($iLength + 1) & ']', $pString) ;first ampersand was a question mark If @error Then Return SetError(@error, @extended, '') Return SetExtended($iLength, DllStructGetData($tString, 1)) EndFunc ;==>_WinAPI_GetString This is what SciTE tells me about the error: "C:\Users\Baconaise\Desktop\TSS\autoit-v3.3.8.1\install\Include\WinAPIInternals.au3"(208,56) : error: unbalanced paranthesis expression. Local $tString = DllStructCreate(($bUnicode & 'wchar' : ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ "C:\Users\Baconaise\Desktop\TSS\autoit-v3.3.8.1\install\Include\WinAPIInternals.au3"(208,56) : error: syntax error Local $tString = DllStructCreate(($bUnicode & 'wchar' : ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ "C:\Users\Baconaise\Desktop\TSS\autoit-v3.3.8.1\install\Include\WinAPIInternals.au3"(208,104) : error: syntax error Local $tString = DllStructCreate(($bUnicode & 'wchar' : 'char') & '[' & ($iLength + 1) & ']', $pString) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ "C:\Users\Baconaise\Desktop\TSS\autoit-v3.3.8.1\install\Include\WinAPIInternals.au3"(208,142) : error: Statement cannot be just an expression. Local $tString = DllStructCreate(($bUnicode & 'wchar' : 'char') & '[' & ($iLength + 1) & ']', $pString) ;first ampersand was a question mark ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Users\Baconaise\Desktop\TSS\autoit-v3.3.8.1\install\Include\WinAPISysInternals.au3 - 4 error(s), 0 warning(s) Please help me understand what is making it mad and how to fix it. Link to comment Share on other sites More sharing options...
BrewManNH Posted February 10, 2019 Share Posted February 10, 2019 Post your script, so we can see how you're calling the function. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
baconaise Posted February 10, 2019 Author Share Posted February 10, 2019 I'm not sure if the manner in which I call the function is the issue. If I run SciTE's SyntaxCheck Prod on just the WinAPIInternals.au3 by itself without any of my code involved, it gives me the errors I mentioned above. Wouldn't that, to some extent, exonerate my code? That being said, I've been trying to figure that out (Script is over 4000 lines long). My script doesn't ever directly call _WinAPI_GetString or even have an include for WinAPIInternals.au3. I do have a #include <WinAPISysWin.au3>, which does have a #include "WinAPISysInternals.au3", which does have a #include "WinAPIInternals.au3". The _WinAPI_GetString function never appears in the WinAPISysWin.au3 or WinAPISysInternals.au3, and the only time it exists in WinAPIInternals.au3 is as itself. At this point, I don't even remember why, specifically, I have #include <WinAPISysWin.au3> in there, but if I comment it out, it seems to make some radio buttons I have in a child GUI fight with some radio buttons I have in the main GUI. (By fight, I mean that it looks like GUICtrlDelete applies itself to undesired things. I don't know if that's a symptom of GUISwitch() or something else or what.) Link to comment Share on other sites More sharing options...
BrewManNH Posted February 10, 2019 Share Posted February 10, 2019 2 minutes ago, baconaise said: I'm not sure if the manner in which I call the function is the issue. If I run SciTE's SyntaxCheck Prod on just the WinAPIInternals.au3 by itself without any of my code involved, it gives me the errors I mentioned above. It doesn't do that for me, so I'm guessing you have something wrong in your copy or your code. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
baconaise Posted February 10, 2019 Author Share Posted February 10, 2019 Do you think it could have something to do with me trying to do this on Autoit 3.3.8.1 instead of something like 3.3.14.5? I can't use anything newer than 3.3.8 because something about it sets off the Anti-Virus. Link to comment Share on other sites More sharing options...
trancexx Posted February 10, 2019 Share Posted February 10, 2019 Ternary operator wasn't supported on that version of AutoIt. baconaise 1 ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
baconaise Posted February 10, 2019 Author Share Posted February 10, 2019 Excellent observation! Do you think I could un-ternary-ize some of those functions and make it work? Link to comment Share on other sites More sharing options...
Nine Posted February 10, 2019 Share Posted February 10, 2019 there was an _Iif (...) function at that time, take a look in Misc baconaise 1 “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 Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
baconaise Posted February 10, 2019 Author Share Posted February 10, 2019 I will! Link to comment Share on other sites More sharing options...
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