Gianni Posted November 3, 2021 Share Posted November 3, 2021 (edited) ? the file must already exist in order to use _FileWriteToLine here it works if the file.txt file exists on the desktop. p.s. a hypothesis; if you create the file.txt manually using the context menu new -> text file, do not type the extension .txt that even if it is not visible, it is created automatically ... (just a wild guess) Edited November 3, 2021 by Chimp Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
SzymonN Posted November 3, 2021 Share Posted November 3, 2021 OK, I found the @CRLF character was missing on the first line - but why is that important ?, the old script works without it Link to comment Share on other sites More sharing options...
Danp2 Posted November 4, 2021 Share Posted November 4, 2021 20 hours ago, Chimp said: a hypothesis; if you create the file.txt manually using the context menu new -> text file, do not type the extension .txt that even if it is not visible, it is created automatically ... (just a wild guess) In my case, the issue was caused by OneDrive folder redirection. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
ITMan2000 Posted December 27, 2021 Share Posted December 27, 2021 (edited) Using the BETA, I had this error: Variable used without being declared $tagSYSTEMTIME >"C:\Program Files (x86)\AutoIt3\SciTE\..\AutoIt3.exe" "C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /beta /ErrorStdOut /in "D:\DOWNLOADS\CCTVBackup\CCTVBackup.au3" /UserParams +>21:45:28 Starting AutoIt3Wrapper (21.316.1639.1) from:SciTE.exe (4.4.6.0) Keyboard:00000409 OS:WIN_10/2009 CPU:X64 OS:X64 Environment(Language:0409) CodePage:0 utf8.auto.check:4 +> SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE UserDir => C:\Users\johnny\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper SCITE_USERHOME => C:\Users\johnny\AppData\Local\AutoIt v3\SciTE >Running AU3Check (3.3.15.4) from:C:\Program Files (x86)\AutoIt3\Beta input:D:\DOWNLOADS\CCTVBackup\CCTVBackup.au3 +>21:45:29 AU3Check ended.rc:0 >Running:(3.3.15.4):C:\Program Files (x86)\AutoIt3\Beta\autoit3_x64.exe "D:\DOWNLOADS\CCTVBackup\CCTVBackup.au3" +>Setting Hotkeys...--> Press Ctrl+Alt+Break to Restart or Ctrl+BREAK to Stop. "C:\Program Files (x86)\AutoIt3\Beta\Include\Date.au3" (1486) : ==> Variable used without being declared.: Local $tLocalTime = DllStructCreate($tagSYSTEMTIME) Local $tLocalTime = DllStructCreate(^ ERROR ->21:45:29 AutoIt3.exe ended.rc:1 +>21:45:29 AutoIt3Wrapper Finished. >Exit code: 1 Time: 1.217 Using the actual PRODUCTION version also has the same error BUT different variable: >"C:\Program Files (x86)\AutoIt3\SciTE\..\AutoIt3.exe" "C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /test /run /prod /ErrorStdOut /in "D:\DOWNLOADS\CCTVBackup\CCTVBackup.au3" /UserParams +>21:50:36 Starting AutoIt3Wrapper (21.316.1639.1) from:SciTE.exe (4.4.6.0) Keyboard:00000409 OS:WIN_10/2009 CPU:X64 OS:X64 Environment(Language:0409) CodePage:0 utf8.auto.check:4 +> SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE UserDir => C:\Users\johnny\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper SCITE_USERHOME => C:\Users\johnny\AppData\Local\AutoIt v3\SciTE - *** Compile in Test mode skipping Tidy; Au3Stripper; Resource updating and Versioning to speed up the process. *** >Running AU3Check (3.3.14.5) from:C:\Program Files (x86)\AutoIt3 input:D:\DOWNLOADS\CCTVBackup\CCTVBackup.au3 +>21:50:37 AU3Check ended.rc:0 >Running:(3.3.14.5):C:\Program Files (x86)\AutoIt3\autoit3_x64.exe "D:\DOWNLOADS\CCTVBackup\CCTVBackup.au3" +>Setting Hotkeys...--> Press Ctrl+Alt+Break to Restart or Ctrl+BREAK to Stop. "C:\Program Files (x86)\AutoIt3\Include\Date.au3" (625) : ==> Variable used without being declared.: $sTempString = _WinAPI_GetLocaleInfo($LOCALE_USER_DEFAULT, $LOCALE_SSHORTDATE) $sTempString = _WinAPI_GetLocaleInfo(^ ERROR ->21:50:37 AutoIt3.exe ended.rc:1 +>21:50:37 AutoIt3Wrapper Finished. >Exit code: 1 Time: 1.192 Edited December 28, 2021 by Melba23 Added code tags Link to comment Share on other sites More sharing options...
Developers Jos Posted December 27, 2021 Developers Share Posted December 27, 2021 Maybe also post a brief script source that demonstrates this issue? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
mLipok Posted December 27, 2021 Share Posted December 27, 2021 1 hour ago, ITMan2000 said: "C:\Program Files (x86)\AutoIt3\Beta\Include\Date.au3" (1486) : ==> Variable used without being declared.: Local $tLocalTime = DllStructCreate($tagSYSTEMTIME) This file: C:\Program Files (x86)\AutoIt3\Beta\Include\Date.au3 should contain: #include-once #include "DateTimeConstants.au3" #include "Memory.au3" #include "Security.au3" #include "StructureConstants.au3" #include "WinAPIError.au3" #include "WinAPIHObj.au3" #include "WinAPILocale.au3" .... does it contain? Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 Link to comment Share on other sites More sharing options...
ITMan2000 Posted December 28, 2021 Share Posted December 28, 2021 (edited) Here's the brief code below. To answer mLipok question, yes, DATE.AU3 has all the necessary includes in the file. No change at all. expandcollapse popupGlobal $g_hLogFile, $lShowWindow #include <Date.au3> #include <EventLog.au3> #include <GuiConstants.au3> #include <WindowsConstants.au3> #Include <File.au3> #Include <Array.au3> #Include <String.au3> #OnAutoItStartRegister "OnAutoItStart" OnAutoItExitRegister( "OnAutoItExit" ) Opt( "TrayIconHide", 0 ) Opt( "MustDeclareVars", 1 ) ;============================================ ; Is Parameters Been Passed To This EXE? ; 1st Parameter - Show Progress Window? ; Y - To Show. ; N - Do Not Show. Default ;============================================ If $CmdLine[ 0 ] > 0 Then $lShowWindow = StringUpper( $CmdLine[ 1 ] ) Else $lShowWindow = "N" EndIf ;========================== ; Declare Variables To Use ;========================== Local $cWindowTitle = "Backup CCTV Video Files To Alibaba Cloud" Local $nColumn = ( @DesktopWidth - 600 ) / 2 ;======================================== ; Check Multiple Copy Of Program Running ;======================================== If WinExists( $cWindowTitle ) Then udfWriteLog( $g_hLogFile, "Error! Another Copy Of " & @ScriptName & " Is Currently Running!" ) Exit EndIf AutoItWinSetTitle( $cWindowTitle ) Exit ;====================================== ; Whenever The Program Is Executed/Run ; This Function Will Be Run First ;====================================== Func OnAutoItStart() Local $cLogFile Local $cINIFile = @ScriptDir & "\CCTVBackup.INI" Local $cLogDir Local $hEventLog, $aData[4]=[3, 1, 2, 3] ;============================= ; Check If The INI File Exist ;============================= If Not FileExists( $cINIFile ) Then $hEventLog = _EventLog__Open( "", "CCTV File Backup" ) _EventLog__Report( $hEventLog, 1, 999, 999, "", "AutoIt3 - INI File Not Found!", $aData ) _EventLog__Close ( $hEventLog ) Exit Endif $cLogDir = IniRead( $cINIFile, "Directories", "LogDir", "Not Found" ) ;==================== ; Setup The Log File ;==================== $cLogFile = $cLogDir & "\" & @ScriptName & ".LOG" $g_hLogFile = FileOpen( $cLogFile, 9 ) If $g_hLogFile == -1 Then Exit EndIf udfWriteLog( $g_hLogFile, "Starting " & @ScriptName & " Program...." ) udfWriteLog( $g_hLogFile, " AutoIT Version: " & @AutoItVersion ) udfWriteLog( $g_hLogFile, " OS Version: " & @OSVersion ) udfWriteLog( $g_hLogFile, "FixPack Version: " & @OSServicePack ) udfWriteLog( $g_hLogFile, " " ) EndFunc ; ==> OnAutoItStart Func OnAutoItExit() udfWriteLog( $g_hLogFile, " " ) udfWriteLog( $g_hLogFile, "Ending " & @ScriptName & " Program...." ) udfWriteLog( $g_hLogFile, _StringRepeat( "=", 80 ), 2 ) FileClose( $g_hLogFile ) EndFunc ; ==> OnAutoItExit ;*----------------------------------------------------------------* ;* Function Name...: udfWriteLog * ;* Description.....: To Write A Single Line Of Information To * ;* The Log File * ;* Syntax..........: udfWriteLog( $hLogFile, $cText, [ $nTime ] ) * ;* $hLogFile - Log File Handle To Write The Log * ;* $cText - Error Message To Write * ;* $nTime - Default 1, 2 * ;* 1 - To Print With Time * ;* 2 - Do Not Print With Time * ;*----------------------------------------------------------------* Func udfWriteLog( $hLogFile, $cText, $nTime = 1 ) Local $cString If $nTime == 1 Then ;$cString = @HOUR & ":" & @MIN & ":" & @SEC & " - " $cString = _Now() & " - " ElseIf $nTime == 2 Then $cString = "" Else $cString = " " EndIf $cString = $cString & $cText FileWriteLine( $hLogFile, $cString ) EndFunc ; ==> udfWriteLog Edited December 28, 2021 by Melba23 Added code tags Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 28, 2021 Moderators Share Posted December 28, 2021 ITMan2000, The problem arises because you are trying to use those variables in the function run by #OnAutoItStartRegister - and if you read the Help file carefully you will see that: Quote As the function runs before any of the main script code is executed, the function cannot reference any variables defined in an #include nor any variables defined as Global within the script. So as the 2 items which cause the error are both defined within the includes, you cannot reference them within the function registered to run under #OnAutoItStartRegister. If you try to run the example in the Help file for this command, you will see that it has exactly the same problem with $MB_SYSTEMMODAL! So thanks for pointing it out. I would suggest just running the function immediately the script starts rather then registering it as you are currently doing - that way the includes will be made available and the problem will no longer exist. M23 P.S. When you post code in future please use Code tags - see here how to do it. Then you get a scrolling box and syntax colouring as you can see above now I have added the tags. Thanks in advance for your cooperation. Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
ITMan2000 Posted December 28, 2021 Share Posted December 28, 2021 2 minutes ago, Melba23 said: ITMan2000, The problem arises because you are trying to use those variables in the function run by #OnAutoItStartRegister - and if you read the Help file carefully you will see that: So as the 2 items which cause the error are both defined within the includes, you cannot reference them within the function registered to run under #OnAutoItStartRegister. If you try to run the example in the Help file for this command, you will see that it has exactly the same problem with $MB_SYSTEMMODAL! So thanks for pointing it out. I would suggest just running the function immediately the script starts rather then registering it as you are currently doing - that way the includes will be made available and the problem will no longer exist. M23 P.S. When you post code in future please use Code tags - see here how to do it. Then you get a scrolling box and syntax colouring as you can see above now I have added the tags. Thanks in advance for your cooperation. Noted and Noted. Split the codes in #OnAutoItStartRegister. It works fine now. TQ Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 28, 2021 Moderators Share Posted December 28, 2021 ITMan2000, One final point - when you reply in future, please use the "Reply to this topic" button at the top of the thread or the "Reply to this topic" editor at the bottom rather than the "Quote" button - I know what I wrote and it just pads the thread unnecessarily. Thanks in advance for your cooperation. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Shark007 Posted February 5, 2022 Share Posted February 5, 2022 On 6/12/2021 at 11:15 AM, Shark007 said: about - Fixed #3682: GuiCtrlCreatePic() with h=0 and w=0. I use the following with the current release 33.14.5 which produces the right-hand graphic below: #AutoIt3Wrapper_Res_File_Add="icons\shark.png", RT_RCDATA, shark, 0 #include <ResourcesEx.au3> Global $Pic = GUICtrlCreatePic('', -1, -1) ; logo _Resource_SetToCtrlID($Pic, 'shark') GUICtrlSetPos($Pic, 205, 70, 140, 140) One other thing I should point out is that I use, #AutoIt3Wrapper_Res_HiDpi=Y which means my positioning line is actually, GUICtrlSetPos($Pic, 205 * $iScale, 70 * $iScale, 140 * $iScale, 140 * $iScale) where $iScale is relative to the screen scaling. (150% scaling = a 1.5 multiplication factor) Maybe this is where my issue lies. No matter what I change I always get the same size (visible) pic using the beta. (to small). I am able to confirm that 140x140 pixels are allocated to the graphic but for whatever reason, the visible pic does not fill that space. The png is natively 140x140 but I cannot make it display in that size. (screen positioning is no issue) Below, the larger graphic is correct. The smaller graphic is from the Beta which does allocate the 140x140 pixels to the graphic, it just doesn't fill the allocated space. To revisit my statements here, I'd like to add... If I remove the Width/Height as such; GUICtrlSetPos($Pic, 205 , 70) It also results in a small pic in the non beta version. Only wanted to make this statement because I'd have thought it would use the native dimensions of the pic, 140x140 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