Author Topic: Temp store new Untitled.doc with original extension  (Read 821 times)

Offline Stefan

  • Administrator
  • Hero Member
  • *****
  • Posts: 774
  • Karma: +6/-0
    • View Profile
Temp store new Untitled.doc with original extension
« on: October 01, 2009, 02:01:26 pm »
Temp store new Untitled.doc with original extension please

If i create an new, f.ex. HTML file
i get an new tab named 'Untitled1.html'
but i can't preview this in external browser
because it is stored temporarily as *.tmp file.

Question:
would you like to change it
that you store new opened Untitled1.* files with suitable extension, here .html ?
Like %Temp%\Unt1E1F.tmp.ext

Then i didn't have the need to first store new, even test files only,
files in temp folder first... and leave them there for ever.
Stefan, HippoEDIT beta tester  (HippoEDIT News On Twitter: http://twitter.com/hippoedit/)

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1712
  • Karma: +29/-2
    • View Profile
    • HippoEDIT
Re: Temp store new Untitled.doc with original extension
« Reply #1 on: October 01, 2009, 04:07:47 pm »
Hi Stefan,

somehow not clear for me...

When it is stored as *.tmp file?

There is functionality that if you use F12 for Preview in Web Browser (and this is always done in internal browser) HE stores unsaved file as temporary and then pass this temporary name to internal browser... Yes, extension is tmp. But in my case even with tmp this is works. Maybe I can save it with original extension, but I need to see why ;)

Best regards,
Alex.

Offline Stefan

  • Administrator
  • Hero Member
  • *****
  • Posts: 774
  • Karma: +6/-0
    • View Profile
Re: Temp store new Untitled.doc with original extension
« Reply #2 on: October 01, 2009, 04:25:51 pm »
Ah, i did an F12-preview first, that's why i see the %tmp%\*.tmp file.
So the truth is new untitled files are in memory only?


I explain it once more what i did:

- If i create an new HTML file
- i get an new tab named 'Untitled1.html'
- i execute an tool "Open with associated application" Command: %FileName%,
   which should open the HTML into system default browser,... but nothing happens.

I think it is because Untitled1.html is not saved yet.

From my POV i think all new Untitled file could be saved in %tmp%\HE\..  on creation time (and deleted once the file is saved by user?)
So we can work immediately with fresh files without saving them first.

I don't know, i often create new files, be it *.ahk or *.vbs or *.htm or...
and want to paste or write an code and test it quickly, but i have to decide where
i want to save this test file first...

I think we had this discuss already once? But i didn't find something in the forum.

EDIT:
another example i often do, because other apps didn't provide the possibilities HE does:
- i open an new file in HE
- i past a few lines in
- i execute an external tool like SORT or FILTER
- i copy the modified lines and close the file



« Last Edit: October 22, 2009, 01:58:22 pm by Stefan »

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1712
  • Karma: +29/-2
    • View Profile
    • HippoEDIT
Re: Temp store new Untitled.doc with original extension
« Reply #3 on: October 01, 2009, 05:06:17 pm »
Ok. Now clear :)

Quote
From my POV i think all new Untitled file could be saved in %tmp%\HE\..  on creation time (and deleted once the file is saved by user?)
So we can work immediately with fresh files without saving them first.

Maybe this is a good idea, but I see a lot of problems in implementation:
new Untitled file could be saved in %tmp%\HE\..  on creation time this is wrong. You want to have an actual file content, but not an empty document, which exist after creation
- from previous item comes a question: when to store this temporary "unsaved" document?
- you need not reset modified flag on such temporary saves, to warn user on exist about "unsaved" files
- should HE ask user about save, before execution of some tool. Because such behaviour you request is not always optimal. It can happen, that file has dependency (includes) that should be in same directory. What to do in this case?

I can think about this, but do not see some easy and fast solution...

Quote
I think we had this discuss already once? But i didn't find something in the forum.
Maybe we have not discuss this directly, but I remember my idea about keeping editor state between session without forcing user to save all changed/new items.

Offline Stefan

  • Administrator
  • Hero Member
  • *****
  • Posts: 774
  • Karma: +6/-0
    • View Profile
Re: Temp store new Untitled.doc with original extension
« Reply #4 on: October 01, 2009, 06:18:21 pm »
>but I see a lot of problems in implementation:
I don't.

>-  new Untitled file could be saved in %tmp%\HE\..  on creation time
>this is wrong.
>You want to have an actual file content, but not an empty document, which exist after creation
With creation time i mean that what i see in HE if i open an template file.
I think right now it is in memory only, all i suggest is to save it to disk. (if you want as option)

>- from previous item comes a question: when to store this temporary "unsaved" document?
At the time it appears in HE as document (or shortly before of course).

>- you need not reset modified flag on such temporary saves, to warn user on exist about "unsaved" files
? (you talk to yourself?)

>- should HE ask user about save, before execution of some tool.
>Because such behaviour you request is not always optimal.
? We have an option in the tool-setup dialog to do this already. It's up to the user how he set up his tool as he need it.
And on document close user is anyway prompted to save if the file is modified.

>It can happen, that file has dependency (includes) that should be in same directory.
>What to do in this case?
Then the user has to store it first at the right place, as he has to do it right now too.
My suggestion is only for the quick&easy test issue.
If i had dependency f.ex. for HTML like images they just not displayed, but the rest.
If an C++ coder has pointed relative to includes then he would not profit from this improvement, that's right.
« Last Edit: October 01, 2009, 06:20:42 pm by Stefan »

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1712
  • Karma: +29/-2
    • View Profile
    • HippoEDIT
Re: Temp store new Untitled.doc with original extension
« Reply #5 on: October 03, 2009, 02:01:28 pm »
Hi Stefan,

probably we have here misunderstanding.

When you talk about temporary save, you mean real save of the document (it would not be only in memory) and of course then save called in tools would work, because document already has associated path in official way.

When I think about such temp solution, I mean, that file remain in memory only, and has no associated path. And then I need to care about all problems I get, to determine should I use such temp or should I ask for save as.

And now back to your example with template:
Ok, I save it when it is created. It get an associated path to temp folder.
In this case user would not never get Save As dialog to save file to location he want. Simple Save would store it silently to temp folder. So to save file to location he wants, he need explicitly call Save As dialog. Plus he always should care that he works on temp file, and if he is not asked about path name, he need to do explicit save as. And also with explicit save as he gets to copies of file. One, initial left in temp folder, another created in his location.

Stefan, this is not something about to cancel your suggestion or what ever. I need to clear model all cases, to fit to the rest of application and keeps standards. Otherwise I would create maintenance problems for myself in future and would not have time for some other important things. And as you know,  I do not have so much time.

Best regards,
Alex.

Offline Stefan

  • Administrator
  • Hero Member
  • *****
  • Posts: 774
  • Karma: +6/-0
    • View Profile
Re: Temp store new Untitled.doc with original extension
« Reply #6 on: October 03, 2009, 05:04:08 pm »
Hi Alex,
if this is not your way just drop my suggestion  ;)
If it to much work to implement i can life with saving my test files first !  ;D


When you talk about temporary save, you mean real save of the document (it would not be only in memory)
Yes, i mean real save to disk.

Quote
When I think about such temp solution, I mean, that file remain in memory only, and has no associated path. And then I need to care about all problems I get, to determine should I use such temp or should I ask for save as.

And now back to your example with template:
Ok, I save it when it is created. It get an associated path to temp folder.

Quote
In this case user would not never get Save As dialog to save file to location he want. Simple Save would store it silently to temp folder. So to save file to location he wants, he need explicitly call Save As dialog.
But from my POV it is up to an application to report if an file is saved or not. You can trick us.
So in my simple understanding i would just save the file in tmp with correct ext ...but didn't show it as saved.
Then it is the same as it is now...  the user has to save it if he want...but
we can immediately work with this file without thinking about where to save it first and under which name.
If the file is closed without any modifying - or if modified and the user didn't want to save  - HE will remove it from tmp.

So for me this would be an optional feature like "[ ] Create new files in Temp"
If checked any new Untitled files are created in tmp.
If not,  all new Untitled files are in memory only as it is now (to not mess up the tmp if HE would crash and didn't have time to remove the tmp files again)



Quote
Stefan, this is not something about to cancel your suggestion or what ever. I need to clear model all cases, to fit to the rest of application and keeps standards. Otherwise I would create maintenance problems for myself in future and would not have time for some other important things. And as you know,  I do not have so much time.

Best regards,
Alex.
I know we didn't want to trick or push us,  8)
 we just talking about to improve HE, and  you decide what you wanna implement or not.

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1712
  • Karma: +29/-2
    • View Profile
    • HippoEDIT
Re: Temp store new Untitled.doc with original extension
« Reply #7 on: October 03, 2009, 11:08:11 pm »
Ok.. :)

But then the question: why you need to have an empty file (or with default text) stored somewhere?
What you tool can do with it?

Quote
So in my simple understanding i would just save the file in tmp with correct ext ...but didn't show it as saved.
Or you mean, when this flag set, to always save file to tmp, when requested, and never ask for Save As.
And users need to call Save as explicitly for every new file?
« Last Edit: October 03, 2009, 11:21:46 pm by alex »

Offline Stefan

  • Administrator
  • Hero Member
  • *****
  • Posts: 774
  • Karma: +6/-0
    • View Profile
Re: Temp store new Untitled.doc with original extension
« Reply #8 on: October 03, 2009, 11:30:09 pm »
>What you tool can do with it?

I have an tool "Open with associated application" with  Command: %FileName%, for all syntax types.

I often just create an new file, f.ex. ,html or . vbs, - paste in an code, - and execute my tool.
The file is launched with the associated app ... - and i see what happens. Then i close the file. No longer needed.

For example i open an vbs or ahk file, write a bit of code to do smtg on my machine,
execute it to do the work, close the file.
Nifty too for helping at forum: open new file, test the syntax of MsgBox, close the file.

Other example would be to paste an text into an new file, execute
tool WinDiff with second document, close the file and i am done.

All the same as i can do already by saving the new file on my own,
but without to have the need of this additional step. (browse for tmp,
yes - overwrite last Untitle1.ext, clean up the temp afterwards)

But as i wrote before, i can to this step too (saving first on my own) if this would add bloat to your app   ;D


Offline Stefan

  • Administrator
  • Hero Member
  • *****
  • Posts: 774
  • Karma: +6/-0
    • View Profile
Re: Temp store new Untitled.doc with original extension
« Reply #9 on: October 04, 2009, 04:26:08 pm »

Just found your "Edit"


EDIT:
Stefan>So in my simple understanding i would just save the file in tmp with correct ext ...but didn't show it as saved.
Or you mean, when this flag set, to always save file to tmp, when requested, and never ask for Save As.
And users need to call Save as explicitly for every new file?

I mean my suggestion (auto internal save new opened Untitled files to tmp)
 would do exactly the same as HE act right now,
but save those new Untitled to tmp AND do not show it as saved.

>when this flag set, to always save file to tmp,
Yes, instead holding the new Untitled file in memory, save it as %tmp%\Untitled1.ext

>when requested,
who did this: "when requested, " ?
I don't understand this.
I mean: No one "requested" anything, HE make all this in the background for the user, as it right now.


> and never ask for Save As.
For new created file never ask to save... HE make this for the user.

>And users need to call Save as explicitly for every new file?
"for every new file" <---No, this is not what i mean.

I mean it would be exactly as it is right now:
* If the user close the new document AND if it is dirty (modified) the user is prompted if he wanna save.
*** If the user saved it, the file is moved from temp to new location.
* If not dirty, or the user doesn't want to save it,  then just close and remove it from temp.


If i didn't find the right words we can do an chat tonight or some day in the evening, if you want.



One more try:

ON open an new doc or template
{
IF option "[ ]save to tmp" is set  THEN
       this file is created in tmp as Untitled with real
       extension (user is not prompted to save)
ELSE
       this file is hold in memory only.
END IF
}
On closing the new document
{
IF the file is dirty (modified) THEN
        the user is prompted if he wanna save.
        IF the user save it THEN
            the file is moved from temp to new location.
       ELSE
           //the user doesn't want to save it (cancel)
            just close and remove it from temp.
        END IF
ELSE IF not dirty THEN
       just close and remove it from temp.
END IF
}

I hope i didn't make an mistake in this psuedo code... but i have to go!

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1712
  • Karma: +29/-2
    • View Profile
    • HippoEDIT
Re: Temp store new Untitled.doc with original extension
« Reply #10 on: October 05, 2009, 01:20:05 pm »
Huh.... :)

Ok, my question was (not really, but for simplicity) should HE show Save As dialog when you have set for tool "Save before" and modified document in the pseudo save mode :)

I do not want such "[ ]save to tmp" option :)

But Ok, what it can be:
- have such option for new files always
- in all not explicit request, use tmp file (with same extension) as temporary storage for all actions (like executing of tool, previewing in browser etc)
- On exit or explicit close of modified document with pseudo save, ask user for save as.
- If in tools dialog, Save before execute set, then also ask user for save as. If not set, use pseudo storage.
- As a future extension can be, do not ask for save at all (optional) but store temp copies of file with current state and reopen them on next open.

Added:
- on explicit Save, show Save As dialog
Just here is one problem... you call a tool for new document without save (used temporary location). For example tool was a browser. And how now you can refresh document in browser, if you have done a change in editor? Temporary save was done on tool execution, if you press save in editor, you get a Save as and document name would be changed, so refresh on browser would not work. So only one way exist is to recall the tool. Am I right.


Stefan can you comment on this what it can be.

Best regards,
Alex.
« Last Edit: October 05, 2009, 02:41:34 pm by alex »

Offline Stefan

  • Administrator
  • Hero Member
  • *****
  • Posts: 774
  • Karma: +6/-0
    • View Profile
Re: Temp store new Untitled.doc with original extension
« Reply #11 on: October 05, 2009, 07:22:35 pm »
> - If in tools dialog, Save before execute set, then also ask user for save as.
>Added:
>Just here is one problem... you call a tool for new document without save (used temporary location).
>For example tool was a browser.
>And how now you can refresh document in browser, if you have done a change in editor?
>Temporary save was done on tool execution, if you press save in editor,
>you get a Save as and document name would be changed, so refresh on browser would not work.

I still think about this...
It's no matter if user do an Save as or if the tools option ask for save as... the user chose where to save.
Then the editor will show - and the tool will use -  the document from the new place. (And HE remove tmp file)

The browser or compiler or what ever will still have the old source from tmp, yes.O.K.
I guess the average user of an programmers editor would be clever enough to know whats happens.

Hmm, just brainstorming...

Maybe you can set an flag on first tool executing?

And on later save as
   you can lookup IF this flag is set AND IF path\filename is changed
   THEN
   set this flag to false
   show an optional hint dialog    "You have done an preview on this file before. Please note that
                                 this last path is not longer valid as you have stored it now under an another path."

 ...just brainstorming...

Anyway user have to close the preview and execute tool an second time.
Hmm, but, maybe, the dialog could also provide an button to execute the tool an second time.
I guess you can remember last used tool ? (would also be nifty for an feature like "Edit > Repeat last command" but "Edit > Repeat last tool". Will good fit in an row with "Repeat last macro/script".. would save hotkeys)

I will think some more and report again ;D
« Last Edit: October 05, 2009, 07:28:36 pm by Stefan »

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1712
  • Karma: +29/-2
    • View Profile
    • HippoEDIT
Re: Temp store new Untitled.doc with original extension
« Reply #12 on: October 06, 2009, 12:16:51 am »
Quote
And on later save as
   you can lookup IF this flag is set AND IF path\filename is changed
   THEN
   set this flag to false
   show an optional hint dialog    "You have done an preview on this file before. Please note that
                                 this last path is not longer valid as you have stored it now under an another path."

This would be rather difficult, because path name is passed as a parameter to a tool, can be constructed dynamically or entered by user in interactive form. And at all from where HE should know context of usage of the file name met in parameters? Maybe this is clipboard content for printing :) So, unclear...

Offline Stefan

  • Administrator
  • Hero Member
  • *****
  • Posts: 774
  • Karma: +6/-0
    • View Profile
Re: Temp store new Untitled.doc with original extension
« Reply #13 on: October 06, 2009, 07:52:00 am »
Not sure if i am clear myself. Maybe i am on the Holzweg.
If i understood your reply correct you mean i talked about path of tools, where i  mean path of file:

1- new file is created in tmp
2- user execute an tool to preview -> HE set an flag 'Preview=True'
3- later, user or tool do an save as -> HE check if flag 'Preview' is true,
  (IF true) AND (if this "save as"-path is different from tmp\Untitled) then
  (prompt user "old preview path invalid") and (set flag 'Preview=False')
4- user has to execute the tool again, or HE provides an button to do this (user has now two previews)

So this has nothing to do with tools or path in tools, i mean?

Alternative:
Maybe, if  to check ("save as"-path is different from tmp\Untitled) is to difficult, use
an message like  "old preview path may be invalid" instead.

If this all is too un-save/un-sure for you you can delay this for after 1.6.
Oh, this brings me another idea:
i could wait till you have implemented event OnInstantiate,
then i could achieve this with an Common_OnInstantiateFiles.hes script :D
« Last Edit: October 06, 2009, 07:54:07 am by Stefan »

 

Related Topics

  Subject / Started by Replies Last post
1 Replies
683 Views
Last post February 27, 2009, 11:24:08 am
by alex
4 Replies
474 Views
Last post October 16, 2009, 10:16:49 pm
by joseluis
0 Replies
455 Views
Last post March 06, 2010, 01:38:46 am
by alex
5 Replies
874 Views
Last post August 24, 2010, 07:33:49 pm
by alex
3 Replies
427 Views
Last post December 07, 2010, 03:31:46 pm
by alex