Share this post

Link to post

Share on other sites

Bert 1,223

Bert 1,223

On the unsaved file, SciTE doesn't know what file type it is, thus the reason it won't run. I do believe Jos has addressed this in the past with having a default file type when creating a new file. You may need to research SciTE to see how to make a default file type. Personally, I would not recommend changing the way SciTE is setup. It may cause issues later if you update your AutoIt version. If you insist on going down this road, here are some threads that will give you some direction:

Share this post

Link to post

Share on other sites

Bert 1,223

Bert 1,223

Another route you may want to add is simply use my SciTE toolbar as a base, and have a button that makes a new file and makes it as a .au3 file. Be a good project for someone to update it. Currently I do not have the time, but the sourcecode is out there.

Share this post

Link to post

Share on other sites

Jos 1,272

Jos 1,272

I like that idea, but I was wondering something - when you click on file save, the default types are missing. How does one add them so you have a choice in the save as type dropdown?

99.9% sure that SciTE doesn't support that currently. Think I looked at the source a while ago to see if it could default to *.au3 for the Lite version of SciTE (Scite4AutoIt3) we compile and destribute with the AutoIt3 installer.

Share this post

Link to post

Share on other sites

Xenobiologist 35

Xenobiologist 35

okay doesn't work. My idea was the following: Adding a command to Scite with a shortcut which works even if the file currently editing hasn't been saved. The command starts an au3 Script like (just a beginning)

Share this post

Link to post

Share on other sites

Jos 1,272

Jos 1,272

I don't understand the process you are trying to implement here. How can you have a command executed with as parameter "$(FilePath)" on an unsaved file and then run the script to prompt for the filename and save it ?

Maybe you need to explain the whole process you are thinking of in simple steps for me.

Share this post

Link to post

Share on other sites

Xenobiologist 35

Xenobiologist 35

I don't understand the process you are trying to implement here. How can you have a command executed with as parameter "$(FilePath)" on an unsaved file and then run the script to prompt for the filename and save it ?

Maybe you need to explain the whole process you are thinking of in simple steps for me.

Ok, no problem on that. The goal is avoiding to type .au3 when creating a (au3)file in Scite.

What I got till now is:

I've written a script called AU3save.au3. I want to start this script via shortcut or scitemenucommand within SciTE. The script copies the source code from the edit pane in Scite, opens a FileSaveDialog where the extension .au3 will be automatically added when save button is clicked and then it saves the file with .au3. This way there will be no need anymore to always add .au3 to files created via Scite.

I think I can get it working, but there is still one thing left. Starting my AU3Save.au3 through SciTE command Tools --> AU3Save, Scite first asks, whether I want to save the file. If I click no then my script is started and everything can go on as desinged.

Any better now?

Currently I'm looking through the Globalproperties whether I can avoid that "Save changes to (Untitles)?" dialog.

Share this post

Link to post

Share on other sites

Bert 1,223

Bert 1,223

I've been doing lots of research on this. I'm thinking until Neil makes a change or tells me a solution to the problem, the best method is to simply make a menu item that runs a script. This script would opens a file dialog window that has the au3 as default. Once you name the file, the file is open in the SciTE Editor. The toolbar I have for SciTe would be a good way to go on this.

Share this post

Link to post

Share on other sites

Valik 471

Valik 471

I don't see why Neil wouldn't accept a well-written patch that adds a property that SciTE can use to populate the SaveAs dialog. Automatically appending a file extension is a bit tricky - at first glance the lpstrDefExt of OPENFILENAME looks useful until you realize you can't save files without an extension; you can only save files with a custom extension or the default. You could perhaps do something clever like extract the first extension in the filter and append it to the end of the file name if a filter is selected and nFileExtension (of OPENFILENAME) points to the NULL terminator.

For what it's worth, Visual Studio 2008 (and probably all versions) automatically appends the first file extension in the filter when no extension is typed. For example, this is the C++ filter: (*.cc;*.cpp;*.cxx;*.tlh;*.tli). When you try to save a file without an extension, it automatically appends .cc to the file (even though .cpp is more widely used for C++ files on Windows).

So, I think that Neil would accept a well-written patch which adds a save.filter property and also automatically deduces the file extension from the first extension in the selected filter when no extension is manually typed. Jos, you could probably knock this out in less than an hour.

Share this post

Link to post

Share on other sites

MHz 72

MHz 72

One of the reasons I'm wary of Scite (I use UltraEdit) is that it's unclear which menu functions work within the editor, and which act on the disk file itself.

The difference between the 2 editors cannot be different because running the same tools from UltraEdit need to be saved before processing just like they need to within Scite as they process the file on disk. The inbuilt commands within both editors AFAIK work within the buffers in memory like so many other editors available for use. So the difference you mention seems odd to comprehend as being a valid reason to argue against Scites' behaviour.

Share this post

Link to post

Share on other sites

Valik 471

Valik 471

I admit it is terribly tempting to do this as I don't think it would take too long, but, if I'm going to put that kind of time into something, I should really work on one of the many out-standing AutoIt bugs or some of the other behind-the-scenes projects I am in the middle of.