argumentum Posted March 16, 2021 Share Posted March 16, 2021 https://www.autoitscript.com/forum/topic/153782-help-filedocumentation-issues-discussion-only/?do=findComment&comment=1477633 I shouldn't but I do. I find more attitude than humble appreciation. Even more attitude than common sense. It's discouraging. I've seen good coders quite posting and I'd bet is due to this overdemanding attitude. Give me, give me, give me. This is a technical thread, we should put our code where our mouth is, and let the code speak. In any case using _WinAPI_GetParentProcess() you can find what ran what in a loop. Once you're satisfied with an answer, post your solution for the next guy and change the title adding "[solved]" cheeers 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...
Subz Posted March 16, 2021 Share Posted March 16, 2021 The thing is, Scite is never running the script, just starting the script using the command below: <path to script.au3> /ErrorStdOut "<path to script.au3>" Using @ScriptFullDir and $CmdLineRaw you could check to see if it's using that command to help determine if it's being run in Scite. Global $g_bIsConsole = (StringStripWS($CmdLineRaw, 3) = '/ErrorStdOut "' & @ScriptFullPath & '"') And (@Compiled = 0) ? True : False I've always used the code I posted above in my first post especially when using #RequireAdmin, although rather than using a MsgBox I would normally log the information using FileWrite. Just my 2 cents. Link to comment Share on other sites More sharing options...
bs27975 Posted March 16, 2021 Author Share Posted March 16, 2021 6 minutes ago, argumentum said: I shouldn't but I do. I find more attitude than humble appreciation. Even more attitude than common sense. It's discouraging. I've seen good coders quite posting and I'd bet is due to this overdemanding attitude. Give me, give me, give me. This is a technical thread, we should put our code where our mouth is, and let the code speak. Yes, you shouldn't. Not attitude, but exasperation with TL;NR answers that go far above and beyond the simple question. The simple answer of which should have been "No.", and left at that. At which point a suggestion type entry could be made, and we all move on. Then I am beaten up for having such a quite reasonable opinion. It's not overdemanding - it's underdemanding. And given the simplicity of the initial question, looking for an 'underresponse' as it were. It may be a 'technical thread', but the lack of the simple no, then the deep technical dive on what one would have thought simply a missed help entry - and quite overwhelming, - especially when a merely simple answer was expected and looked for. - which was clearly inappropriate as, it turns out, there isn't one. (But there was no way to know that before posing the question.) I am a technical guy, and I too have inadvertently done a technical deep dive at times. Don't beat me up for looking for K.I.S.S. - and having it pointed out there isn't such on this. The follow on posts have been quite informative, and triggered quite a bit of googling / reading / studying - for which I thank all of you. [Sight can easily be lost that all of this is drinking from a fire hose, and one can only swallow and consume so much in one go. I have had many gulps over the years, and no doubt face many more.] Link to comment Share on other sites More sharing options...
argumentum Posted March 16, 2021 Share Posted March 16, 2021 did the code I showed you served your need ? 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...
bs27975 Posted March 16, 2021 Author Share Posted March 16, 2021 12 minutes ago, Subz said: The thing is, Scite is never running the script, just starting the script using the command below: <path to script.au3> /ErrorStdOut "<path to script.au3>" Using @ScriptFullDir and $CmdLineRaw you could check to see if it's using that command to help determine if it's being run in Scite. Global $g_bIsConsole = (StringStripWS($CmdLineRaw, 3) = '/ErrorStdOut "' & @ScriptFullPath & '"') And (@Compiled = 0) ? True : False I've always used the code I posted above in my first post especially when using #RequireAdmin, although rather than using a MsgBox I would normally log the information using FileWrite. Just my 2 cents. Thanks for that. With the responses here, I had discovered such macros and planned to delve into such further. Thanks for the leg up. Link to comment Share on other sites More sharing options...
bs27975 Posted March 16, 2021 Author Share Posted March 16, 2021 Just now, argumentum said: did the code I showed you served your need ? Don't know yet, haven't had a chance to beat on it. But I looked at the reference / link and had a sense of ... nice, that could be what I need. So cut and pasted it into the top of a script to dig into further when I get a chance. Won't be minutes, probably hours, but not days. As you noted, I expect to: > Once you're satisfied with an answer, post your solution for the next guy and change the title adding "[solved]" Link to comment Share on other sites More sharing options...
Nine Posted March 16, 2021 Share Posted March 16, 2021 12 hours ago, bs27975 said: How to tell when being run from SciTE? #include <WinAPIProc.au3> ConsoleWrite (_WinAPI_GetParentProcess(_WinAPI_GetParentProcess()) & @CRLF) ConsoleWrite (ProcessExists("Scite.exe") & @CRLF) If both result are the same, the the script is being run from Scite... “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...
JockoDundee Posted March 16, 2021 Share Posted March 16, 2021 So Nine + Mine = #include <WinAPIProc.au3> Func IsConsoleWriteVisible() ConsoleRead(True) If Not @Error Then Return True If _WinAPI_GetParentProcess(_WinAPI_GetParentProcess())=ProcessExists("Scite.exe") Then Return True Return False EndFunc Good? Code hard, but don’t hard code... Link to comment Share on other sites More sharing options...
bs27975 Posted March 16, 2021 Author Share Posted March 16, 2021 (edited) Haven't dug into this yet, but I've no doubt > _WinAPI_GetParentProcess(_WinAPI_GetParentProcess())=ProcessExists("Scite.exe") is part of a solution. However, ConsoleRead() also returns an error at EOF, so is not definitive. I'm thinking more: $bIsConsoleWriteVisible = ( @compiled or _WinAPI_GetParentProcess(_WinAPI_GetParentProcess())=ProcessExists("Scite.exe" ) Inherently: - you've compiled to console, or you don't care about ConsoleWrite() visibility. = but you may still be in SciTE / development mode. - if you haven't so compiled, or did to GUI, or aren't so running, again, you don't care about ConsoleWrite() visibility. Edited March 16, 2021 by bs27975 Link to comment Share on other sites More sharing options...
JockoDundee Posted March 16, 2021 Share Posted March 16, 2021 26 minutes ago, bs27975 said: However, ConsoleRead() also returns an error at EOF, so is not definitive.So Check at the startup of the program, keep the value in a global variable. Done. Code hard, but don’t hard code... Link to comment Share on other sites More sharing options...
bs27975 Posted March 16, 2021 Author Share Posted March 16, 2021 (edited) Exactly. Moreover, in one's own personal global / generic #include file. Permitting: If $bIsConsoleWriteVisible Then ConsoleWrite( "Some text." & @CRLF ) Edited March 16, 2021 by bs27975 Link to comment Share on other sites More sharing options...
JockoDundee Posted March 16, 2021 Share Posted March 16, 2021 2 hours ago, bs27975 said: Exactly. 13 hours ago, argumentum said: Once you're satisfied with an answer, post your solution for the next guy and change the title adding "[solved]" Code hard, but don’t hard code... 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