AutoIt opens notepad++ with "Folder as Workspace" open
-
If you closed Notepad++ when Folder as Workspace (which I will call “FaW” from now on) was open, then the next time you run Notepad++, it will still have FaW open – it should remember that setting. I have never seen FaW unexpectedly turn on or turn off.
So when Notepad++ is open, close the FaW panel, then exit Notepad++; this should save the config file with FaW closed. If you then manually run Notepad++ again (not with “auto-it”), FaW should not open. Let us know if it comes back with manual Notepad++ opening.
Your Syntax Attempts
I am not an “auto-it” user, so I don’t know their syntax for sure, but I do have some comments on each of the attempts you showed:
ShellExecute("$txtFile$")
If there are spaces in
$txtFile$
, then the OS might be passing different portions of the filename as multiple arguments to Notepad++, instead of as one argument. There might be some way to split on spaces in which some directory name might be passed to Notepad++.Run('"C:\Program Files\Notepad++\notepad++.exe" "$txtFile$"')
This one properly puts quotes around the
$txtFile$
, so it should be sent to Notepad++ as a single argument. Using a syntax that has individual quotes around should be the right way of doing things. But I cannot know what “auto-it” does in translations behind the scenes.Run('"' & @ComSpec & '" /c "$txtFile$"', '', @SW_HIDE)
Again, since this one has quotes around the filename, it shouldn’t be doing anything weird.
Run("$txtFile$")
This one may or may not have space issues like your first ShellExecute.
Other comments:
Unchecking “Open all files of folder instead of launching FaW on folder dropping”
That’s rather the opposite of what you thought you were doing. With no checkmark on that option, then Notepad++ will try FaW if it’s given a directory name instead of a filename. With the checkmark, Notepad++ will try to open all the files inside a folder instead of using FaW. But you shouldn’t need this option at all, because if auto-it is working properly, it is sending a filename, not a directory name, to Notepad++
Next steps:
After you have verified that you can manually run Notepad++ without FaW opening:
Try running using auto-it using your
Run('"C:\Program Files\Notepad++\notepad++.exe" "$txtFile$"')
syntax.- Does it bring up FaW when it launches?
- If not, great, you have it working now.
- If FaW did launch, then close the FaW panel
- If FaW did launch, go to ?-menu’s Debug Info and copy the first four lines; it should look something like this:
This will show us how Notepad++ interpreted the command line that auto-it sent. So your reply to this post would say something likeNotepad++ v8.7 (64-bit) Build time : Sep 17 2024 - 17:06:31 Path : C:\Program Files\Notepad++\notepad++.exe Command Line : x.c
When I used `Run('"C:\Program Files\Notepad++\notepad++.exe" "$txtFile$"')`, it opened FaW and my Debug Info says, ``` Notepad++ v8.7 (64-bit) Build time : Sep 17 2024 - 17:06:31 Path : C:\Program Files\Notepad++\notepad++.exe Command Line : x.c ```
Try running auto-it with your other three syntax attempts. Each time, check if it launches FaW. If it does, grab those same lines from ? > Debug Info again, and pair them with which auto-it syntax you used that generated that exact result.
If all four still open FaW, you should have four pairs of “When I used” and the Debug Info results for each.
(Remember, if FaW incorrectly opens, you need to close it. Then after you’ve exited Notepad++, you can do a manual Notepad++ launch (not using auto-it) to verify that it stays closed. You can even check the Debug Info again, to make sure that the
Path :
that it’s running for Notepad++ is the same when you run it manually vs when you run it using auto-it) - Does it bring up FaW when it launches?
-
@PeterJones
I appreciate your help, and any help is appreciated
I’ve been using Auto-It for about a decade, so I know the syntax is correctI did some testing, first I installed v8.6.8, and ran the script and it worked as intended without FaW opening up. I then upgraded to v.8.6.9 and FaW opened same with v8.7
I ran the test again closing FaW before running the script again here are the results
I’ve included the actual path used by the script instead of a dummy variableShellExecute("Z:\z-Incoming\2-Finished\Movie\z-Done\z-Done.txt") Notepad++ v8.6.8 (64-bit) Build time : Jun 4 2024 - 00:30:00 Path : C:\Program Files\Notepad++\notepad++.exe Command Line : -notepadStyleCmdline -z "C:\Windows\system32\NOTEPAD.EXE" Z:\z-Incoming\2-Finished\Movie\z-Done\z-Done.txt FaW closed on open ShellExecute("Z:\z-Incoming\2-Finished\Movie\z-Done\z-Done.txt") Notepad++ v8.7 (64-bit) Build time : Sep 17 2024 - 17:06:31 Path : C:\Program Files\Notepad++\notepad++.exe Command Line : -notepadStyleCmdline -z "C:\Windows\system32\NOTEPAD.EXE" Z:\z-Incoming\2-Finished\Movie\z-Done\z-Done.txt FaW opens on open Run('"C:\Program Files\Notepad++\notepad++.exe" "Z:\z-Incoming\2-Finished\Movie\z-Done\z-Done.txt"') Notepad++ v8.7 (64-bit) Build time : Sep 17 2024 - 17:06:31 Path : C:\Program Files\Notepad++\notepad++.exe Command Line : "Z:\z-Incoming\2-Finished\Movie\z-Done\z-Done.txt" FaW opens on open Run('"' & @ComSpec & '" /c "Z:\z-Incoming\2-Finished\Movie\z-Done\z-Done.txt"', '', @SW_HIDE) Notepad++ v8.7 (64-bit) Build time : Sep 17 2024 - 17:06:31 Path : C:\Program Files\Notepad++\notepad++.exe Command Line : -notepadStyleCmdline -z "C:\Windows\system32\NOTEPAD.EXE" Z:\z-Incoming\2-Finished\Movie\z-Done\z-Done.txt FaW opens on open Run("Z:\z-Incoming\2-Finished\Movie\z-Done\z-Done.txt") Program wouldn't launch
I followed the instructions here thinking that it would fix my issue with it didn’t
The only thing that fixed it was going back to v8.6.8 -
I’ve been using Auto-It for about a decade, so I know the syntax is correct
I wasn’t saying you had the syntax wrong. I was saying I don’t know what Auto-It does behind the scenes when you use those various syntax versions, so I couldn’t say for sure what would happen.
Command Line : -notepadStyleCmdline -z "C:\Windows\system32\NOTEPAD.EXE" Z:\z-Incoming\2-Finished\Movie\z-Done\z-Done.txt
Ugh. For it to be getting the
-notepadStyleCmdline -z
argument, you have most likely done one of the following three things:- You have
.txt
files associated with Notepad++, but you manually edited the association to add those extra command-line options - You followed the User Manual > Notepad Replacement instructions
- You installed the “NotepadStarterPlugin”
I don’t think
-notepadStyleCmdline -z
is the culprit, but it might be.I wish I had requested that you share the full Debug Info once, because that would have answered already whether you have the NotepadStarterPlugin – or any other plugins that might be interfering with the experiments.
If you do have “NotepadStarterPlugin” installed, uninstall it (Plugins > Plugins Admin > Installed, then checkmark
NotepadStarterPlugin
and click Remove) and remove thec:\Windows\NotepadStarter.exe
that the plugin installed, and remove the following keys from the registry (using regedit):[HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe] "Debugger"="C:\\Windows\\NotepadStarter.exe" "Notepad++"="C:\\PROGRA~1\\NOTEPA~1\\notepad++.exe" "readme"="call NotepadStarter.exe instead of original notepad.exe! To disable this option just remove notepad.exe entry" [HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe] "Debugger"="C:\\Windows\\NotepadStarter.exe" "Notepad++"="C:\\PROGRA~1\\NOTEPA~1\\notepad++.exe" "readme"="call NotepadStarter.exe instead of original notepad.exe! To disable this option just remove notepad.exe entry"
If you had followed the “Notepad Replacement” instructions, that section of the manual already explains how to undo that as well.
If you manually edited your file association to add in that command-line option, you can manually edit your file association (in regedit) to remove that option. If you don’t remember where, just search your registry for
-notepadStyleCmdline
to find any entries that call that option.That should stop the
Command Line :
entry in Debug Info from showing-notepadStyleCmdline
– but, depending on how other things are behind-the-scenes, that might also stop theShellExecute
commands (or double-clicking on the.txt
file in Windows Explorer) from opening Notepad++, and it might open with Microsoft’snotepad.exe
instead. You can then Right Click on a.txt
file from Windows Explorer, and Open With, and set it to always open text files with Notepad++ instead, which should allow double-click orShellExecute
to launch a.txt
file in Notepad++ instead.Once you’ve gotten it so that it’s not doing
-notepadStyleCmdline
anymore, is it still unexpectedly opening FaW when you open Notepad++?If so, please perform the following steps (with v8.7), showing us all output.
- Close all instances of Notepad++.
Win+R
>cmd.exe
to open a cmd.exe windowdir "%AppData%\Notepad++\"
– note the date listed forconfig.xml
"c:\Program Files\Notepad++\notepad++.exe" "Z:\z-Incoming\2-Finished\Movie\z-Done\z-Done.txt"
- Did FaW open that time?
- If so, close FaW panel (View > Folder as Workspace should hide that panel)
- Exit Notepad++. There should be no copies of Notepad++ running at this point.
dir "%AppData%\Notepad++\"
– note the date listed forconfig.xml
: did it update the timestamp?- If it didn’t, then maybe you don’t have write permission to the
config.xml
, which might explain why Notepad++ isn’t saving the state on the
- If it didn’t, then maybe you don’t have write permission to the
"c:\Program Files\Notepad++\notepad++.exe" "Z:\z-Incoming\2-Finished\Movie\z-Done\z-Done.txt"
- Did FaW open this time?
- If so, open
%AppData%\Notepad++\config.xml
, look for the whole<GUIConfig name="DockingManager" …>…</GUIConfig>
section and copy that; come into your reply here, hit the</>
button, and paste the<GUIConfig name="DockingManager" …>…</GUIConfig>
between the```
lines in your reply.
update: one more question, do you have a zero-byte file called
c:\Program Files\Notepad++\asNotepad.xml
? (I doubt it’s the culprit, but it makes Notepad++ behave as if you had the command-line options-multiInst -nosession -notabbar
, so it will help us help you debug things if we know whether or not you have that file.) - You have
-
@PeterJones
Now I do add the the Image File Execution Options reg key when i do a fresh install on a new computerreg add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe" /v "Debugger" /t REG_SZ /d "\"%ProgramFiles%\Notepad++\notepad++.exe\" -notepadStyleCmdline -z" /f
I DO NOT use the NotepadStarterPlugin, and i haven’t used the Notepad Replacement instructions
I automate a large chuck of fresh installs, and this could have something to do with it. In the past it did break double-click on ‘txt’ files and that was my workaround to automatically have it work with notepad++. Previously I was using a file that REPLACED notepad.exe in system32, but i no longer do that in favor of the Image File Execution regedit
One weird thing to note is that FaW ISNT open on launch, it kinda opens immediately after launch
Meaning I see the window render, and its not there, then FaW opensOnce I get up I will make the changes, and test again
JUST TO BE CLEAR
Remove Image File Execution reg key from registry
Verify c:\Program Files\Notepad++\asNotepad.xml is not present (don’t know how to make the text colored)
Manually set notepad++ as the default application for txt files
Post full debug info -
@Alchemist-Zim said in AutoIt opens notepad++ with "Folder as Workspace" open:
I do add the the Image File Execution Options reg key when i do a fresh install on a new computer
… i haven’t used the Notepad Replacement instructionsWhether you followed those instructions or not, you have effectively used those instructions, because setting the “Image File Execution Options” is what those instructions tell you to do.
The right way to set file associations in windows, so that double-click and
ShellExecute
and equivalents will open a.txt
file in Notepad++ instead of notepad.exe is to use Open With and choose to always use that application. (The only time that “Image File Execution Options” is useful is if you have some other application that always opens text files withnotepad.exe
and it won’t let you customize, and using the registry hack will trick the OS into actually opening Notepad++ instead ofnotepad.exe
– but that situation rarely comes up. For general usage, just use Windows modern “always open with” solution.)it kinda opens immediately after launch
Meaning I see the window render, and its not there, then FaW opensThat’s weird. I’ve never seen FaW being delayed until after launch. I wonder if you have a plugin that does it (or a script for a scripting plugin like notepad++), because when Notepad++ opens when FaW was already enabled, FaW normally starts to render as it is drawing the rest of the GUI, so the panel shows up at the same time as the editor portion, etc. The Debug Info will
JUST TO BE CLEAR
yes, those are what I was hoping you would do when you have a chance.
(don’t know how to make the text colored)
use ` characters around the text, so typing
`this text`
will be rendered asthis text
. This is described in our Formatting Forum Posts FAQ entry. -
@PeterJones
Image File Execution reg key removed from registry
Added ini;log;nfo;txt to registered extensions via notepad++ preferences
Set notepad++ as default via always use that application via windows
config.xml is date modified is updating
no change to FaW opening$WinNote = ShellExecute("Z:\z-Incoming\2-Finished\Movie\z-Done\z-Done.txt") Notepad++ v8.7 (64-bit) Build time : Sep 17 2024 - 17:06:31 Path : C:\Program Files\Notepad++\notepad++.exe Command Line : "Z:\z-Incoming\2-Finished\Movie\z-Done\z-Done.txt" Admin mode : ON Local Conf mode : OFF Cloud Config : OFF Periodic Backup : ON OS Name : Windows 10 Enterprise LTSC 2021 (64-bit) OS Version : 21H2 OS Build : 19044.4894 Current ANSI codepage : 1252 Plugins : ComparePlugin (2.0.2) DSpellCheck (1.5) mimeTools (3.1) NppConverter (4.6) NppExport (0.4) Run('"C:\Program Files\Notepad++\notepad++.exe" "Z:\z-Incoming\2-Finished\Movie\z-Done\z-Done.txt"') Notepad++ v8.7 (64-bit) Build time : Sep 17 2024 - 17:06:31 Path : C:\Program Files\Notepad++\notepad++.exe Command Line : "Z:\z-Incoming\2-Finished\Movie\z-Done\z-Done.txt" Admin mode : ON Local Conf mode : OFF Cloud Config : OFF Periodic Backup : ON OS Name : Windows 10 Enterprise LTSC 2021 (64-bit) OS Version : 21H2 OS Build : 19044.4894 Current ANSI codepage : 1252 Plugins : ComparePlugin (2.0.2) DSpellCheck (1.5) mimeTools (3.1) NppConverter (4.6) NppExport (0.4) Run('"' & @ComSpec & '" /c "Z:\z-Incoming\2-Finished\Movie\z-Done\z-Done.txt"', '', @SW_HIDE) Notepad++ v8.7 (64-bit) Build time : Sep 17 2024 - 17:06:31 Path : C:\Program Files\Notepad++\notepad++.exe Command Line : "Z:\z-Incoming\2-Finished\Movie\z-Done\z-Done.txt" Admin mode : ON Local Conf mode : OFF Cloud Config : OFF Periodic Backup : ON OS Name : Windows 10 Enterprise LTSC 2021 (64-bit) OS Version : 21H2 OS Build : 19044.4894 Current ANSI codepage : 1252 Plugins : ComparePlugin (2.0.2) DSpellCheck (1.5) mimeTools (3.1) NppConverter (4.6) NppExport (0.4)
-
And yet you completely ignored my 10 detailed steps which would have been useful for debugging…update: Oh, I see you responded to my 10-step instructions with an overly-terse “config.xml is date modified is updating”. I didn’t even notice that the first time I read your post; sorry.
----
update:I just notices you said:
Admin mode : ON
Oh, yuck. Though I’ve never personally seen it, many people have found that running in Admin mode doesn’t give Noteapd++ correct access to the normal user’s
%AppData%\Notepad++\
config directory, so settings that are present during a normal run of Notepad++ are not accessible for the Admin. It appears you might be one of those. (To confirm this, you can run my 10 steps a second time, this time through an Admincmd.exe
instead of a normalcmd.exe
. If the normalcmd.exe
works as expected but the Admincmd.exe
launches FaW, then the Admin is your culprit.)Also, often times, running as Admin means you won’t have access to mapped drives (like a
Z:
drive) that were mapped using your normal-user’s credentials.Do you need Admin privileges to access that
Z:
drive file? If not, then I suggest trying to figure out how to make Auto-It not launch the sub-processes in Admin mode. -
@PeterJones
I FIGURED IT OUT THIS MORNING…And I am anID10T
I used a MouseClick command to turn on TAIL via the toolbar
between v8.6.8 and v8.6.9 "The “Show All Characters” button added a dropdown menu, pushing everything to the right…which moved the FaW button to the location of the TAIL button in the toolbarWhich would also explain why FaW appears to render after the window is open. it was clicking the button AFTER the window was opened.
Removed the MouseClick line, and changed it to use View > Monitoring via the menubar
Sorry about this
-
I was running out of ideas, because I wasn’t convinced that any of the things I had suggested could be the culprit for the FaW issue. Glad you figured that out. :-)
(I do still highly recommend not running in Admin mode except when you absolutely have to.)
-
@PeterJones said (I do still highly recommend not running in Admin mode except when you absolutely have to.)
I’m logged in as ADMIN with UAC turned off
I know its not best practices, but it works for meThank You for the help