Borje Posted April 21, 2021 Share Posted April 21, 2021 Hi everybody I have a problem with this script when I press wait for file then I get error can not lock port does anyone know what is causing this? I hope someone has a solution because it is not possible to lock the gate. Same thing when I try to send a file I do not know what it may be but hope for a response from someone here as I know that there are many knowledgeable freinds here. Filetransfer.au3 Link to comment Share on other sites More sharing options...
JockoDundee Posted April 21, 2021 Share Posted April 21, 2021 Did you create this yourself, or? Did it ever work? Code hard, but don’t hard code... Link to comment Share on other sites More sharing options...
Borje Posted April 21, 2021 Author Share Posted April 21, 2021 (edited) Why this script not works is that anybody that have some solution what the problem is with this script? Edited April 21, 2021 by Borje Link to comment Share on other sites More sharing options...
Developers Jos Posted April 22, 2021 Developers Share Posted April 22, 2021 What have you done to debug this script to see and isolate the part that doesn't work? 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...
Borje Posted April 22, 2021 Author Share Posted April 22, 2021 I am not sure how to debug this. Link to comment Share on other sites More sharing options...
Developers Jos Posted April 22, 2021 Developers Share Posted April 22, 2021 12 minutes ago, Borje said: I am not sure how to debug this. What is the question exactly? You don't know how to add ConsoleWrites to the code to see what is happening? 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...
Borje Posted April 22, 2021 Author Share Posted April 22, 2021 Yes I dont know how to add consolwrite i have never doing that before. Link to comment Share on other sites More sharing options...
Developers Jos Posted April 22, 2021 Developers Share Posted April 22, 2021 Sounds like an opportunity to learn something. seadoggie01 1 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...
seadoggie01 Posted April 23, 2021 Share Posted April 23, 2021 I'd guess right now your main problem is that you never call TCPStartup... it's wrapped in a function named OnAutoItStart. That function doesn't get called automagically though. You either need to use #OnAutoItStartRegister OnAutoItStart or call OnAutoItStart() at the top of your script. Also, remove all of the Global Const lines and add #include <GUIConstants.au3> at the top of your script. No need to reinvent the wheel or worry about adding more constants later as you need them. If you wrote this script yourself, I'll offer more suggestions, but I get the feeling you didn't, so I won't overload you Musashi 1 All my code provided is Public Domain... but it may not work. Use it, change it, break it, whatever you want. Spoiler My Humble Contributions:Personal Function Documentation - A personal HelpFile for your functionsAcro.au3 UDF - Automating Acrobat ProToDo Finder - Find #ToDo: lines in your scriptsUI-SimpleWrappers UDF - Use UI Automation more Simply-erKeePass UDF - Automate KeePass, a password managerInputBoxes - Simple Input boxes for various variable types Link to comment Share on other sites More sharing options...
Musashi Posted April 23, 2021 Share Posted April 23, 2021 (edited) 3 hours ago, seadoggie01 said: I'd guess right now your main problem is that you never call TCPStartup... This is most likely to be one/the main? problem. 23 hours ago, Borje said: I dont know how to add consolwrite i have never doing that before. Besides ConsoleWrite you can also use _FileWriteLog for debugging (the principle is similar). As I do not want to fiddle around in your original script, I created an example for you on the fly : expandcollapse popup#include <File.au3> ; for the LOGFile OnAutoItExitRegister("_MyExitFunc") Global $hLOGFile = FileOpen(@ScriptDir & "\Example.log", 2) ; 2=Write mode (erase previous contents) OnAutoItStart() _FileWriteLog($hLOGFile, "==> START PROGRAM") _FileWriteLog($hLOGFile, "Before _MAIN") _Main() _FileWriteLog($hLOGFile, "After _MAIN") Func _Main() Local $iGuiMsg, $btnExit, $btnInfo, $sIPInfo, $sDomain GUICreate("Just a Dummy :) ", 500, 120, -1, -1) $btnExit = GUICtrlCreateButton("Exit", 20, 20, 200, 40) $btnInfo = GUICtrlCreateButton("Info", 260, 20, 200, 40) GUISetState() While 1 $iGuiMsg = GUIGetMsg() Select Case $iGuiMsg = -3 ; = $GUI_EVENT_CLOSE _FileWriteLog($hLOGFile, "$GUI_EVENT_CLOSE") ExitLoop Case $iGuiMsg = $btnExit _FileWriteLog($hLOGFile, "Exit-Button pressed") ExitLoop Case $iGuiMsg = $btnInfo _FileWriteLog($hLOGFile, "Info-Button pressed") ; just to check TCP : $sDomain = "www.autoitscript.com" $sIPInfo = TCPNameToIP($sDomain) If @error Then $sIPInfo = "TCPNameToIP failed" MsgBox(BitOR(4096, 16), $sDomain, "IP= " & $sIPInfo) _FileWriteLog($hLOGFile, $sDomain & " -> TCPNameToIP failed") Else MsgBox(BitOR(4096, 64), $sDomain, "IP= " & $sIPInfo) _FileWriteLog($hLOGFile, $sDomain & " -> TCPNameToIP success") EndIf EndSelect WEnd GUIDelete() EndFunc ;==>_Main ; -------------------------------------------------------------------- Func OnAutoItStart() _FileWriteLog($hLOGFile, "==> Func : OnAutoItStart") TCPStartup() EndFunc Func OnAutoItExit() _FileWriteLog($hLOGFile, "==> Func : OnAutoItExit") TCPShutdown() EndFunc ; -------------------------------------------------------------------- ; -------------------------------------------------------------------- ; Your Exit Function ; -------------------------------------------------------------------- Func _MyExitFunc() OnAutoItExit() ; Close Logfile _FileWriteLog($hLOGFile, "==> EXIT PROGRAM") If $hLOGFile Then FileClose($hLOGFile) EndFunc ;==>_MyExitFunc You can set a remark via _FileWriteLog($hLOGFile, "...") at any point of the script, which will then be written to the Logfile (for further analysis). Note : You have to be a bit careful with the macros @error and @extended. _FileWriteLog ( similar to ConsoleWrite) changes/resets these macros. It is therefore advisable to save them in variables (e.g. $iError=@error and $iExtended=@extended) for further processing. Edited April 23, 2021 by Musashi Response expanded "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." Link to comment Share on other sites More sharing options...
Borje Posted April 23, 2021 Author Share Posted April 23, 2021 Hi seadoggie01 and thanks you very much yes I have never call the TCPStartup now it is working I have used this script long time before and it working good with 3.3.0.0, after I change autoit version to 3.3.14.5 i have this problems, But now all works perfect and I have learn little more. Thanks to Musasci for debugging script. Link to comment Share on other sites More sharing options...
argumentum Posted April 23, 2021 Share Posted April 23, 2021 v3.3.4.0 Some of the following features are deprecated. .... OnAutoItStart() has been removed. See the new pre-processor statement #OnAutoItStartRegister. OnAutoItExit() has been removed. See the new functions OnAutoItExitRegister() and OnAutoItExitUnRegister(). If you don't code often, these are hard to catch. JockoDundee 1 Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. 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