Saving to desktop in Pan 6

I am sure this is a simple task, but for some reason I can’t figure out how to save an html file to the desktop using a procedure. I tried doing this, but it just sent me to the last place where I saved a file: filesave Desktop, “2019Milfordworkouts.html”,"".

Any suggestions would be appreciated.

The filesave command in Panorama 6 requires a binary path to the desktop which info(“desktopfolder”) will provide. It also requires 4 parameters and I’m not seeing the final source parameter in your example. If the source data is in a variable called mySource it would look like this:

filesave info("desktopfolder"),“2019Milfordworkouts.html”,"",mySource

In Panorama X the text path is combined with the file name and there is no parameter used for the type/creator. So this same code used in Panorama X would be reduced to 2 parameters:

filesave "~/Desktop/2019Milfordworkouts.html”,mySource

Note that both versions would work fine in Panorama X which will accept either one for compatibility.

First of all, thanks Gary. However, I must still be doing something wrong. I want to save the entire file onto the desktop as an html file. Can I assume the mySource is the name of my Pan file? I tried that, but the command still sent me to the last place I did a save to, not to the desktop.

I assume you mean you want to save the Panorama file’s data as a text .html file to your desktop. If that is the case you would use the export statement something like this:

export folderpath(info("desktopfolder"))+“2019Milfordworkouts.html”,exportline()+¶

This will export each currently selected record to a text file with the .html extension to your desktop. I’m not sure what value that will be as it will not have html code but only simple data saved as text.

Gary:
Don’t mean to take up too much of your time, but I guess this is more complex than I thought. James Cook helped me create an html file from selected records in my database. That file is made up of columns and rows that are generated to be viewed as such on our school webpage for the track and field team. I just was trying to do an automatic save of that .html file onto the desktop, since I then copy that file as a jpg and post it into the webpage. I do lots of updates, sometimes 2-3 a day as the weather in MA changes constantly, so this process was a simple way to stay on top of things.

James had given me this code for saving:

Local lvFolder, lvFile
lvFile = “2019IndoorMilfordWorkouts”
savefiledialog lvFolder, lvFile, “Save as…”

If lvFolder = “” Stop EndIf

filesave lvFolder, lvFile+?(lvFile endswith “.html”,"",".html"), “TEXTttxt”, gvResult

but being a wiseguy, I thought I could figure out a more simple method, since his code also did not send me to the right location…

Unfortunately, my skills for coding html and pan have deteriorated with age, sort of like having rust form on my bike when I am down in Florida…

Prior to this, James would have written some code to put the desired text into a variable named gvResult. It’s the contents of that variable that the filesave is saving. The code most likely contains an arraybuild plus some additional statements to attach a header and trailer.

Yes, you are correct. I could never get my head around that process, as I seem to have a total block when it comes to arrays, etc. So, basically what you are saying there is that the process is sending the collected code in .html and that is what is being saved. I think I can understand that. I was just hoping I could somehow skip the dialog prompt and then go up and select “desktop” for the location for saving that html file. If I did some other things prior and saved them to some other folder, that is the folder that comes up when the prompt dialog window appears.

I hope that makes it a bit clearer. I guess I don’t get how the variable lvFolder works. The lvFile works as desired, but it is the lvFolder that seems to be the issue. Do I hard code the lvFolder to “Desktop” or info(“desktopfolder”)?

Local lvFolder, lvFile
lvFile = “2019IndoorMilfordWorkouts”
lvFolder=???
savefiledialog lvFolder, lvFile, “Save as…”

You would hard code it to info(“desktopfolder”), or you could just use that function directly, instead of the variable.

Dave:
No luck.

Still goes to previous selection, in this case to the OutdoorTrack Folder.

Here is the full code after the array build:

gvResult = lvHeader+lvTable+“</html”

Local lvFolder, lvFile
lvFile = “2019IndoorMilfordWorkouts”
lvFolder=info(“desktopfolder”)
savefiledialog lvFolder, lvFile, “Save as…”

If lvFolder = “” Stop EndIf

filesave lvFolder, lvFile+?(lvFile endswith “.html”,"",".html"), “TEXTttxt”, gvResult

You don’t need both of those statements. The first statement has already set it to the path ID of the Desktop. The second one is if you want the user to choose the folder. There is no way to set a default folder for that dialog. The Pan X version is more versatile in that regard.

Ok, I give up…ha, ha. I took out the what you suggested and nothing changed. Oh, well, so what I thought was simple isn’t and I will just live with it.

I do have Pan X, but I just haven’t had the time to come to grips of unlearning and learning new, as the needs for me have become quite simple as I move further and further into retirement. I just like keeping my hand in some aspects of track and field and doing web pages fits the bill.

In other words: Pete, when you define your target folder, you do not need the savefiledialog statement any more. That dialog is used to set those variables, not to use them. — Use the filesave statement.

Got it. Here is what I came up with thanks to James Cook (original), Dave Thompson and Kurt.

gvResult = lvHeader+lvTable+“</html”
filesave info(“desktopfolder”), “2019Milfordworkouts.html”, “TEXTttxt”, gvResult

This now directly sends the file to the desktop, no matter where I might have saved to some other folder previously.

Thanks to all…couldn’t have done it without you… :slight_smile: