greenmachine Posted January 21, 2006 Share Posted January 21, 2006 I don't know if anyone else has this problem, but I discovered it a while back and can't figure out why it's doing it. The problem is this: when I create a new script, and before I save it for the first time, it is called untitled. Good so far. Then, if I press space to accept a built-in function, it creates a new untitled script and switches me to that one. Back in the original untitled script, the function is there as it should be. It's really weird.That's not the best description, so here's an example. I have my blank script. I type "stl" and press space. It should change it to StringTrimLeft() and keep me in the same window. Well the StringTrimLeft() is there, but I'm in another script. Why is that? Could it be one of the properties files that I might have edited? I don't recall ever seeing a lua function (I think it's lua) that would open a new script, but I can't be certain.It happens will all functions, as far as I can tell. So it doesn't have anything to deal with the individual function. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 21, 2006 Moderators Share Posted January 21, 2006 I don't know if anyone else has this problem, but I discovered it a while back and can't figure out why it's doing it. The problem is this: when I create a new script, and before I save it for the first time, it is called untitled. Good so far. Then, if I press space to accept a built-in function, it creates a new untitled script and switches me to that one. Back in the original untitled script, the function is there as it should be. It's really weird.That's not the best description, so here's an example. I have my blank script. I type "stl" and press space. It should change it to StringTrimLeft() and keep me in the same window. Well the StringTrimLeft() is there, but I'm in another script. Why is that? Could it be one of the properties files that I might have edited? I don't recall ever seeing a lua function (I think it's lua) that would open a new script, but I can't be certain.It happens will all functions, as far as I can tell. So it doesn't have anything to deal with the individual function.I'm not able to reproduce even using your exact example , mine just brings up StringTrimLeft(|) the '|' being the cursor location. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
greenmachine Posted January 21, 2006 Author Share Posted January 21, 2006 Even in a new, unsaved script? Because mine works once I save it, it's just stupid until then. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 21, 2006 Moderators Share Posted January 21, 2006 Nope, opened a new one, and just typed stl {space} and gave me the above results. But I've not messed with any of SciTe's original settings either. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Developers Jos Posted January 21, 2006 Developers Share Posted January 21, 2006 Just tested and can confirm this behaviour. I don't have a fix for it yet other then to make sure that you save the script first as *****.au3. It is the scite.open() LUA statement that causes this behaviour which is used to triggers the CallTip to be shown after the function is expanded. -- Show Calltip when inside function if repword ~= "" and braceopenpos then scite.Open(props["FilePath"] .. "\nmenucommand:232") end I had never seen this before because i always copy an existing script or save it first since else all defined tools don't work like F5 ect...... 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...
MHz Posted January 21, 2006 Share Posted January 21, 2006 Yeah, I have not seen this as yet, but am like JdeB, starting a new script is useless until you actually save it first. I use a Temp Script creator tool from Scite Tools which creates the scripts in @TempDir & '\Au3'. Most scripts that I do not want get trashed by CCleaner, which is set to a custom setting to clean this folder. If I do want to keep a script then I would need to copy it to another new script for permanent saving. Most do get trashed as mostly tests or tidyed forum scripts etc. Here is the script I use from a subfolder within the Scite directory, if interested. Rather simple but effective. Saves your system building up with trash scripts. expandcollapse popup; temp script DirCreate(@TempDir & '\Au3') $tempfile = _TempFile(@TempDir & '\Au3', 'TEMP_', '.au3', 3) $scite = @ScriptDir & '\..\Scite.exe' FileWrite($tempfile, '; Temporary Script ' & StringReplace($tempfile, @TempDir & '\Au3\', '') & @CRLF & @CRLF) If FileExists($scite) And FileExists($tempfile) Then $tempfile = StringReplace($tempfile, '\', '\\') Run('"' & $scite & '" "-open:' & $tempfile & '" "-goto:3"') EndIf Exit Func OnAutoItStart() Local $title = @ScriptName & ' Interpreter' If WinExists($title) Then Exit AutoitWinSetTitle($title) EndFunc Func _TempFile($s_DirectoryName = @TempDir, $s_FilePrefix = "~", $s_FileExtension = ".tmp", $i_RandomLength = 7) Local $s_TempName ; Check parameters If Not FileExists($s_DirectoryName) Then $s_DirectoryName = @TempDir ; First reset to default temp dir If Not FileExists($s_DirectoryName) Then $s_DirectoryName = @ScriptDir; Still wrong then set to Scriptdir ; add trailing \ for directory name If StringRight($s_DirectoryName, 1) <> "\" Then $s_DirectoryName = $s_DirectoryName & "\" Do $s_TempName = "" While StringLen($s_TempName) < $i_RandomLength $s_TempName = $s_TempName & Chr(Random(97, 122, 1)) WEnd $s_TempName = $s_DirectoryName & $s_FilePrefix & $s_TempName & $s_FileExtension Until Not FileExists($s_TempName) Return ($s_TempName) EndFunc Link to comment Share on other sites More sharing options...
Valik Posted January 21, 2006 Share Posted January 21, 2006 Just tested and can confirm this behaviour. I don't have a fix for it yet other then to make sure that you save the script first as *****.au3. It is the scite.open() LUA statement that causes this behaviour which is used to triggers the CallTip to be shown after the function is expanded. -- Show Calltip when inside function if repword ~= "" and braceopenpos then scite.Open(props["FilePath"] .. "\nmenucommand:232") end I had never seen this before because i always copy an existing script or save it first since else all defined tools don't work like F5 ect...... You may not have seen the bug manifest itself but you've certainly seen Lua code that avoids problems like this: function SciteMenuCommand(n) -- If the file hasn't been saved to disk, FilePath isn't set so check for this if (props["FilePath"] ~= "") then scite.Open(props["FilePath"] .. "\nmenucommand:" .. n) end return false end -- SciteMenuCommand() I typically received an error in the console, however, not a new file. Anyway, the above code is how I avoid the problem. Link to comment Share on other sites More sharing options...
greenmachine Posted January 21, 2006 Author Share Posted January 21, 2006 (edited) Excellent, I fixed it. I combined the ideas/code from JdeB and Valik and changed this in the AutoIt3.LUA file in my Scite folder. Orginal: -- Show Calltip when inside function if repword ~= "" and braceopenpos then scite.Open(props["FilePath"] .. "\nmenucommand:232") end function SciteMenuCommand(n) -- If the file hasn't been saved to disk, FilePath isn't set so check for this if (props["FilePath"] ~= "") then scite.Open(props["FilePath"] .. "\nmenucommand:" .. n) end return false end -- SciteMenuCommand() My changed line: -- Show Calltip when inside function if repword ~= "" and braceopenpos then if (props["FilePath"] ~= "") then scite.Open(props["FilePath"] .. "\nmenucommand:232") end end Thanks guys. Edited January 21, 2006 by greenmachine Link to comment Share on other sites More sharing options...
Developers Jos Posted January 21, 2006 Developers Share Posted January 21, 2006 (edited) You may not have seen the bug manifest itself but you've certainly seen Lua code that avoids problems like this: function SciteMenuCommand(n) -- If the file hasn't been saved to disk, FilePath isn't set so check for this if (props["FilePath"] ~= "") then scite.Open(props["FilePath"] .. "\nmenucommand:" .. n) end return false end -- SciteMenuCommand() I typically received an error in the console, however, not a new file. Anyway, the above code is how I avoid the problem. Already put this exact code in my copy of AUtoIt3.lua but it ofcourse won't show the tooltip anymore for none saved buffers. ... Looked if there is a lua command to make the Calltip popup without having to fill it myself... (Remember I had it coded like that in the beginning ?) Edited January 21, 2006 by JdeB 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...
Developers Jos Posted January 22, 2006 Developers Share Posted January 22, 2006 (edited) Already put this exact code in my copy of AUtoIt3.lua but it ofcourse won't show the tooltip anymore for none saved buffers. ... Looked if there is a lua command to make the Calltip popup without having to fill it myself... (Remember I had it coded like that in the beginning ?) Went back through the CVS updates and found the code I had in there to create the CallTip with LUA code before it was replaced with the scite.open statement: if repword ~= "" and braceopenpos then if props["FilePath"] ~= "" then scite.Open(props["FilePath"] .. "\nmenucommand:232") end end This code works also on None saved buffers............ if repword ~= "" and braceopenpos then f = io.open(props['SciteDefaultHome'].."\\api\\au3.api") if f ~= nil then local apitxt = f:read('*a') if apitxt then f:close() local rep_start = string.find(string.lower(apitxt),"\n" .. string.lower(repword).."[\n ]") if rep_start ~= nil then rep_end = string.find(apitxt,"\n",rep_start+2)-1 repword = string.sub(apitxt,rep_start+1,rep_end) -- put the description on the next line.. repword = string.gsub(repword, "%)", "%)\n",1) editor:CallTipShow(from, repword) end end end end Edited January 22, 2006 by JdeB 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...
Valik Posted January 22, 2006 Share Posted January 22, 2006 (edited) JdeB, does that code correctly highlight the current function parameter in bold like SciTE's default handling does?Edit: My guess is no since it doesn't use editor:CallTipSetHlt(). I think keeping the current parameter highlighted would also require a lot more processing than just reading the line from the API file. It gets really complicated when nested function calls are involved. Edited January 22, 2006 by Valik Link to comment Share on other sites More sharing options...
Developers Jos Posted January 22, 2006 Developers Share Posted January 22, 2006 (edited) JdeB, does that code correctly highlight the current function parameter in bold like SciTE's default handling does?No, but you knew that already ofcourse.... This can be fixed by adding SciteMenuCommand(IDM_SHOWCALLTIP) Edited January 22, 2006 by JdeB 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...
Valik Posted January 22, 2006 Share Posted January 22, 2006 So essentially you'll get at minimum a call-tip with the file either saved or unsaved but if you are saved, you'll also get correct parameter highlighting. Correct? Link to comment Share on other sites More sharing options...
Developers Jos Posted January 22, 2006 Developers Share Posted January 22, 2006 (edited) So essentially you'll get at minimum a call-tip with the file either saved or unsaved but if you are saved, you'll also get correct parameter highlighting. Correct?With the last version it will correctly show the CallTip with the proper info and the last addition ensures the proper highlighting in both saved and New buffers.... Edited January 22, 2006 by JdeB 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...
Developers Jos Posted January 22, 2006 Developers Share Posted January 22, 2006 Doesn't work as i described... Did some more testing and the highlighting of the parameter is using the same syntax so will never work properly unless saved first..... I am not going to worry about this too much, since the file should first be saved anyway for all other functions to work. Will just put in the If to avoid opening a new buffer and put a warning in the Output pane.... 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...
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