Mike C Posted September 12, 2012 Share Posted September 12, 2012 I'm trying to pre-select the folder path when a user selects "Save As" from the File menu, based on the template .sta that the user is working from. The .sta is opened from a different custom menu item using the "OpenURL" function, and therefore the folder path does not default to the .sta location as it does from the "Open" menu item. The only place I can see where that information is stored is in the User settings .xml file, but I can not figure out how to use the SetSavedSetting and GetSavedSetting functions. What's the "category"? What's the "setting"? The help page is not very helpful on these topics. Thanks in advance. Quote Link to comment
MullinRJ Posted September 12, 2012 Share Posted September 12, 2012 Mike, ???Have you tried : GetFileInfo()? I'm not sure how it will treat .sta files, though, since they are dissociated from the disk file when they are opened. Raymond Quote Link to comment
maarten. Posted September 12, 2012 Share Posted September 12, 2012 Maybe you can just get that information straight from the .xml preferences file itself? And if i'm not mistaken, this information is also saved in the windows registry (and probable the mac .plist files) but i have to look that up again. Quote Link to comment
Vectorworks, Inc Employee klinzey Posted September 12, 2012 Vectorworks, Inc Employee Share Posted September 12, 2012 I don't know what useful info you would get from GetFileInfo(), if you are opening the .sta file you already know the path to the .sta file. If you try to get any pathing info about an unsaved file all that will be returned is the file name. Get/SetSavedSetting category and setting are the XML tag names. category = Dialog setting = choice value = A A If you need to access values deeper in the tree you can use the setting parameter to traverse deeper. category = Dialog setting = choice/field1 value = A A I can't guarantee changing the setting will work. The XML file is only written and read from disk when VW starts or quits and the functions access the file stored in memory, so don't try to access the settings directly using other XML calls because the information may be incorrect, may be overwritten or not used. Quote Link to comment
Mike C Posted September 12, 2012 Author Share Posted September 12, 2012 Thanks, Kevin. So basically, my idea isn't going to work regardless. However, I still can't get the function to work either. Here's my Vectorscript: PROCEDURE NewFloorPlan; var strFileName : string; dummy : boolean; BEGIN strFileName := GetFName; dummy := GetSavedSetting('','',strFileName); alrtdialog(strFileName); END; RUN(NewFloorPlan); Funny thing is, it doesn't even display the alrtdialog, unless I comment-out the GetSavedSetting function line. Any other ideas you can give me to pre-select the SaveAs folder path, or even to get the GetSavedSetting function to work would be greatly appreciated. Thanks again. Quote Link to comment
Vectorworks, Inc Employee klinzey Posted September 12, 2012 Vectorworks, Inc Employee Share Posted September 12, 2012 Don't pass in the <> use just the string. If the tag exists this is how it should read: (I did not see the tag "DefaultFolderLocation" in my Saved Settings file.) dummy := GetSavedSetting('DefaultFolderLocation','OpenAndSaveAs',strFileName); If you check dummy probably returns false and strFileName is now an empty string. AlrtDialogs don't show if the string is empty. Quote Link to comment
Mike C Posted September 12, 2012 Author Share Posted September 12, 2012 I was looking at the wrong (SavedSettings.xml) file, not the SavedSettingsUser.xml file. Which means I really can't update the setting I need to, even if it would work. . . For anyone else who's curious, here's the syntax: PROCEDURE NewFloorPlan; var strFileName : string; dummy : boolean; BEGIN {NOTE: The "TOpen_Vectorworks_Drawing" setting was nested within the "default_path" setting, hence the "/" between them} dummy := GetSavedSetting('IFileChooserDialog','default_path/TOpen_Vectorworks_Drawing', strFileName); alrtDialog(strFileName); END; RUN(NewFloorPlan); Quote Link to comment
Hippocode Posted July 30, 2013 Share Posted July 30, 2013 I was looking at the wrong (SavedSettings.xml) file, not the SavedSettingsUser.xml file. Which means I really can't update the setting I need to, even if it would work. . . Ran into the same thing and went a bit further. Once I noticed Getsavedsetting/Setsavedsetting only worked on the user file, I tried to rewrite the XML elements of "SavedSettings.xml" instead, hoping this would force the new data into the file. It did work, but it gets reset on closing vectorworks. I assumed this is because vw loads the settings in the memory and saves them on quitting. I noticed there are also XML memory functions and sort of assumed this was the deal.. I managed to read the memory, and when using the right elementnames I found the saved values, so vw loads that whole file in its memory. I rewrote them , checked them again for the new values which worked and closed vectorworks. I was hoping these new values would now get saved in the settingfile, but no they don't. How does vectorworks work ? Quote Link to comment
JBenghiat Posted August 1, 2013 Share Posted August 1, 2013 Saved settings get read from disk on application open and written to disk on application close. Changes you make to the xml in memory should write on exit. What exactly are you trying to change in SavedSettings.xml? Many of the application settings have their own SetPref or SetVariable calls. It's also possible that you are writing to a setting that gets read by the quit process. For example, palette positions are read on quit, so any custom change would get overwritten by the actual GUI. Does that help? -Josh Quote Link to comment
Hippocode Posted August 2, 2013 Share Posted August 2, 2013 (edited) These are the ones I REALLY would like to change.. \\xxxxxx\ C:\Users\xxxx \\LACIExxxxx I couldn't find anything in the setvariable calls, and I did manage to overwrite these in the memory, but they get reset somewhow which is weird, no ? Why would they be read on opening, and overwritten by reading again on quitting ? I'm just not happy with the way that VW saves these paths, its never correct. I have a projectmanagement tool in vectorworks that has the right path for each project we work on, on using it I want it to change all the default paths so it's right when opening/saving/exporting etc in a new drawing.. Edited August 2, 2013 by hippothamus Quote Link to comment
Hippocode Posted August 6, 2013 Share Posted August 6, 2013 After Overwriting the memory, when exporting or saving the path (before quitting vw) isn't changed either, as if it uses another variable or it reloads them before. I guess this won't work out.. Quote Link to comment
maarten. Posted August 6, 2013 Share Posted August 6, 2013 I couldn't find anything in the setvariable calls Did you search in the appendix for it or did you ran trough all variables. I'm asking because some of those are just not documented. I run trough the variables if I can't find it in the appendix. I make a for-loop and write all the values to a text file. Then I search for the specific value and knows what the selector is. Script is something like this: Append(fileName); FOR i:=-3000 TO 3000 DO BEGIN Write(i); Tab(1); Write(GetPref(i)); Tab(1); Write(GetPrefInt(i)); Tab(1); ... Write(GetPrefString(i)); END; Close(fileName); Quote Link to comment
JBenghiat Posted August 6, 2013 Share Posted August 6, 2013 These look like OS level settings. LIkely these values are stored in memory via the OS routines that handle the open / save / export dialogs, and VW reads, then writes these values on quit. Why are you trying to set these particular values via VS? If it is for user interaction in a script, just use GetFileN, which lets you designate a default path. -Josh Quote Link to comment
Hippocode Posted August 6, 2013 Share Posted August 6, 2013 (edited) Because: lets say I work on drawing A. I Export something from drawing A once. When I start Project B, vectorworks still uses the old path. When trying to save B I start at the posision of the previous project. Of course I need to save the new path once, but we use a project manager in vw that has that path allready, it would be nice if it could be used. So ok, I save project B in the correct folder, next time saving will be in the right spot !. Until I try to export something, its still in the position of project A which makes no sense to me. It's a lot of projectsearching while everything could be simplified. And not to mention, that if I now open project A, the stored valus are from value B. I took some time to create a projectmanager, storing all our project data into one shared file, including the path of each project and now find out I can't change it .. We save and export a lot between different projects and I have to spend a lot of time changing directories.. The idea was, when switching a drawing I just had to open my manager, and the default saving paths of that particular project are used. Edited August 6, 2013 by hippothamus Quote Link to comment
Hippocode Posted August 6, 2013 Share Posted August 6, 2013 I couldn't find anything in the setvariable calls Did you search in the appendix for it or did you ran trough all variables. I'm asking because some of those are just not documented. I'll give that a shot. Quote Link to comment
Hippocode Posted August 12, 2013 Share Posted August 12, 2013 I couldn't find anything in the setvariable calls Did you search in the appendix for it or did you ran trough all variables. I'm asking because some of those are just not documented. I'll give that a shot. Went to 20 000, none of them had any path saved. Quote Link to comment
Mike C Posted October 20, 2013 Author Share Posted October 20, 2013 I'm glad someone else sees this as a shortcoming within Vectorscript. As the VW "admin", I need a simple way for my users to open and save drawings in the proper locations without needing to navigate through the file directories themselves. Which is the nice way of saying they're not the sharpest tacks in the drawer. The OpenURL command shared the Open... menu command functionality in VW 12, but lost it somewhere along the way. I don't know about hippothamus, but at least restoring that functionality would solve my problem. But preferably, there should be a command within Vectorscript that allows the Save As... path to be initially set per document. Quote Link to comment
WhoCanDo Posted December 3, 2013 Share Posted December 3, 2013 Tried this myself. Since I new the file path and the new file name I ended up using: Response := StrDialog ('Filename:', FName)); the user copied this highlighted string and then DoMenuTextByName ('Save As...',0); pasting in the copied string (file name and path) I was told the path was an operating system function and not controllable in VW. You will note that if the Save As... is used once then the following Save As's will be to the same location. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.