ScriptUO

Scripting Resources & Utilities => ScriptUO Application => Bug discussion => Topic started by: Nicar on July 07, 2008, 12:35:15 PM

Title: Save file as...
Post by: Nicar on July 07, 2008, 12:35:15 PM
Ok, I went to save what was my UOC's Recall Lumber.... I chose save as, and did Nics Recall Lumberjacking v2.j4.0 .  Then I was trying to upload to WinUO. I noticed searching for it, it didn't keep the txt extension, which I came out to find was true, even though it was selected and all when I did save as. So, well, to get around this, I opened in EUO and saved as and it worked. So, not sure if save as is broken like that.
Title: Re: Save file as...
Post by: TrailMyx on July 07, 2008, 12:41:53 PM
There is an issue with the save as function where you do a save as, but it doesn't sense you've saved, but it has anyhow.  So I'm not sure I understand what you saw.  Did it just not save the file at all, or did it save to the old file name?
Title: Re: Save file as...
Post by: TrailMyx on July 07, 2008, 12:45:19 PM
Oh, perhaps that EUO is an option for the save window.  It's an option for the load file gump, but I guess I missed it with the save.  If that's the problem then that's an uber easy fix and a silly omission on my part.
Title: Re: Save file as...
Post by: Nicar on July 08, 2008, 03:48:19 AM
It saved as... or so it looked like, the file type it gave it was a   "0 file type"   I kept on wondering why when I tried to upload it to WinUO, why it told me invalid file name. So, than, I dumped it into EUO (program) and saved as my txt file. I know you have txt, suo and euo extension, I tried to save as a txt and it gave a 0 file type.
Title: Re: Save file as...
Post by: TrailMyx on July 08, 2008, 06:10:10 AM
Did you start out as a different filetype?  I cannot reproduce this one.

Edit:  never mind, I see what you are talking about.  Hmm, all that is handled with the system dialog so I'm not sure what's up with that.  I'll check, though.
Title: Re: Save file as...
Post by: TrailMyx on July 08, 2008, 06:46:04 AM
Ok, I see what's up.  It's a quick fix on my end, but really the code is doing what it's supposed to.  If you need to change the extension, all you have to do is type it in by hand instead of relying on the dropdown box in the Save As dialog.  That'll let you save it to whatever extension you want.

The only time the dialog adds its own extension is when you don't have a extension in the filename already.  so when you save a "blank" script, the extension is added because you don't currently have one.  You can force it but changing it by hand, though.

For me, I can just strip the extension off, but then that takes away the assumption that the extension you already have is what you will always want.  So I'm almost inclined to leave it as it is...
Title: Re: Save file as...
Post by: Xclio on July 08, 2008, 09:57:04 AM
I ran into this as well and it seems to be with the version that we use.  It was wierd though as I was able to save as version 1.2 but version 1.21 wouldn't save properly.  This is using the save as function and also I was using SUO build 186, I noticed that you have 187 available and I will test it out there to see if I get the same result.
Title: Re: Save file as...
Post by: Xclio on July 08, 2008, 10:08:45 AM
Okay pulled up build 187 and did some testing.  Same result except I found something a bit different but the same.  I will try and explain.

Opened up version 1.2 of my rail tamer and performed a save as.  Renamed it from Xclio's Taming on Rails v1.2 to the new name of Xclio's Taming on Rails v1.22 with the below option for .txt selected.  This saved the file but instead of it being a .txt file it saved it as a .22 file thus taking the .22 of my version number and creating a new file extension.

So in some further testing I did a save as of Xclio's Taming on Rails v1.2 but didn't rename it.  This saved properly as a .txt file extension.

Finally I did a save as of Xclio's Taming on Rails v1.2 and renamed it to test v1.2 and it failed.  This time saving improperly as a .2 file extension instead of a .txt file extension.

Presumeably it saved properly the second time without the rename because it recognized that the file was already there and simply replaced the data within the file thus never changing the file extension.  I did this test again but isntead renamed it to the name of one of myother files and confirmed this result.


TM as you said you believe that the code is working as intended which it probably is but I think if you compare it to the standard operation of a windows based system whatever is "selected" below will override anything that is typed enless a "valid" extension is typed above.  I am not sure how it cross checks to ensure that it is a valid extension (presumeably checking some sort of database).  Hopefully this makes sense to you.  Let me know if you need clarification on anything.
Title: Re: Save file as...
Post by: TrailMyx on July 08, 2008, 11:17:18 AM
Yeh, I was being lazy this morning, sorry. 

I had hopes that the file handling control would do all that for me, but it turns out I have to determine what the extension is by hand and then strip it off so the control will then make the proper changes when you change the extension.  I did that this morning and things look pretty good now.

I'll have to check the instance where you have a "decimal" other than the one in the extension to see if it's handled correctly. I wasn't doing anything with that before, so if there's a bug in the way the control handles it, I'll have to fix the bug by avoiding the control's code which I can't change.
Title: Re: Save file as...
Post by: Xclio on July 10, 2008, 06:29:47 AM
Okay did some brief testing with the save as feature of build 189 and these were my results.

It seems to be defaulting just fine to whatever I have in the drop down box.  However I am experiencing some issues.

I created a new file and did a save as naming the file test and the drop down box selected to .txt, my result was that this worked just as expected.  I then did another save as this time naming it test v1.2 this resulted in another file named test .txt (the space is in the name now but no v1.2).  Again I did a save as this time naming it test v1.22 a file named test v.txt was created.

It seems to be lopping off the last 4 characters under any circumstance that it detects a period within the file name that you elect.  Further testing proved this when I named files as test v1.3333 and got test v1..txt (yes two periods as the first one is the name of the file while the second one is for the .txt extension).  Also named a file test v1.12345 and the result was a file saved as test v.1.1.txt

Again hopefully this makes sense to you.  But simply from what I can tell is that whenever a period is detected within the file name it chopps of the last 4 characters of the file name and then appends the file extension.
Title: Re: Save file as...
Post by: TrailMyx on July 10, 2008, 10:02:07 AM
Unfortunately  it does make sense.  ;)

I took the poor-mans approach with the fix to the filename conversions, but it looks like I have to write a bit more code to do it properly.  I was lazy yesterday with that "fix".  It works for some instances, but not universally.  It's a frustrating thing because it's something you hope the file dialog will just DO for you, but unfortunately you still have to do all the legwork so on little function like that can generate a bunch of silly code.

But thank you for your thorough testing; I'll have more time this weekend to generate the needed code to fix it properly.  There just wasn't a fast fix for it, darn it.
Title: Re: Save file as...
Post by: Xclio on July 10, 2008, 10:27:49 AM
Cool, well not really but at least you understood what I was trying to explain.  It can get kinda difficult to explain stuff like that somtimes.
Title: Re: Save file as...
Post by: TrailMyx on July 10, 2008, 10:34:01 AM
Well, because of your testing, it was able to shine the light on exactly what crappy code I kludged in to "fix" that issue.  So your explanations were top-notch!
Title: Re: Save file as...
Post by: Nicar on July 11, 2008, 08:25:29 AM
Well, just went through some the save as testing (SUO build 191) with at end of my file has v2.j4.0 or something.. changed a bit here and there, and each save as, when i checked what got saved, it had the correct file name, and the correct file extension.

I think Xclio for the help of having this make sense to TM and some extra testing and re-testing.
Title: Re: Save file as...
Post by: TrailMyx on July 11, 2008, 08:36:10 AM
Well, just went through some the save as testing (SUO build 191) with at end of my file has v2.j4.0 or something.. changed a bit here and there, and each save as, when i checked what got saved, it had the correct file name, and the correct file extension.

I think Xclio for the help of having this make sense to TM and some extra testing and re-testing.

Good deal.  I'll be doing a bit of scripting this weekend trying to break it.  Oh, I enabled the auto-backup feature (not v191 however) of the text editor control; eventually I'll have that as one of the Config features.  There will be a bunch of those.  Rulers, space markers, tab markers, EOL markers, etc.

And yes, thanks Xclio and Nicar for the testing!
Title: Re: Save file as...
Post by: Nicar on July 11, 2008, 08:40:06 AM
Do you even need to tease a public release if it isn't the full version? Or are you trying to get a range of testers? Just don't let it be too public where Cheffe gets ticked, pulls EUO, and bows at your superior program, even before the run function works.   

I need to get back into script, just a lot to deal with this past 2 weeks and half this week was on a different schedule at work.. and stupid publish... i need armor sets (Well, just scout) 
Title: Re: Save file as...
Post by: TrailMyx on July 11, 2008, 08:48:00 AM
Do you even need to tease a public release if it isn't the full version? Or are you trying to get a range of testers? Just don't let it be too public where Cheffe gets ticked, pulls EUO, and bows at your superior program, even before the run function works.   

I need to get back into script, just a lot to deal with this past 2 weeks and half this week was on a different schedule at work.. and stupid publish... i need armor sets (Well, just scout) 

Well, my original intention was to just have a set of build tools and not really an EasyUO replacement.  However since it took a different turn and started heading toward an EUO-alternative, I kinda figure I'd still release it with my original thoughts.  I'm still a long ways away from having a full replacement, so it's a shame to miss out on all that extra testing anyhow.  I'll bump it to Alpha instead of pre-Alpha and let people play with it.

But at this point, I've nearly achieved my original reason for ScriptUO.  Everything else is gravy.

But my feedback to date has been: "Man, since I used SUO, I can hardly develop in EasyUO anymore."  So that alone is enough to let people play with it.
Title: Re: Save file as...
Post by: Xclio on July 11, 2008, 08:49:57 AM
did some extensive save as testing and it all seems to be working correctly now whoot whoot!!

Why is it when I click on the disk icon it chooses save as?  Usually with most programs that is a save button vise a save as button....just a curiosity more than anything else as I always use that as a "quick save" feature so I don't need to go though the file menu and such to do a quick save.
Title: Re: Save file as...
Post by: TrailMyx on July 11, 2008, 08:53:55 AM
did some extensive save as testing and it all seems to be working correctly now whoot whoot!!

Why is it when I click on the disk icon it chooses save as?  Usually with most programs that is a save button vise a save as button....just a curiosity more than anything else as I always use that as a "quick save" feature so I don't need to go though the file menu and such to do a quick save.

Great!  I'm just glad you couldn't break this one.  heh

Well I made it "Save as" because sometimes I want to save a version of what I'm working on quickly, but I want to have the option of changing the name.  With save as, you get both functions but it's a bit more work (click click instead of click)  I can add a "quick save" icon perhaps.  Mmmm, more features.. ;)

Now to figure out a way to break it....
Title: Re: Save file as...
Post by: Xclio on July 11, 2008, 09:09:38 AM
Yeah a quick save button would be great.  But I definitally see your philosophy there.