Skip to content

Instantly share code, notes, and snippets.

@seanbamforth
Created August 18, 2014 15:50
Show Gist options
  • Save seanbamforth/5f7c8827d53fee2134ea to your computer and use it in GitHub Desktop.
Save seanbamforth/5f7c8827d53fee2134ea to your computer and use it in GitHub Desktop.
Reopen all files in a new data folder
Use cApplication.pkg
Procedure ReopenAll Integer hWorkspace
//first we need to reset the workspace. this can be different
//for clubwise because we do not use standard workspace objects.
//And we're still on 11. try it though.
Set psDataPath of hWorkspace to "c:\new\data"
Set psFileList of hWorkspace to "c:\new\data\filelist.cfg"
Send DoSetPaths to hWorkspace
//next we need to close all open files - get list with DF_FILE_NEXT_OPENED
Move 0 To hTable
Repeat
Get_Attribute DF_FILE_NEXT_OPENED of hTable to hTable
If (hTable > 0) Begin
Close hTable
Open hTable
End
Until (hTable = 0)
End_Procedure
//Junior - If this does not work, you can try using OPEN AS to open the files
//so...
Procedure ReopenAll
String sFolder
Move "c:\new\" to sFolder
//next we need to close all open files - get list with DF_FILE_NEXT_OPENED
Move 0 to hTable
Repeat
Get_Attribute DF_FILE_NEXT_OPENED of hTable to hTable
If (hTable > 0) Begin
Get_Attribute DF_FILE_ROOT_NAME of hTable to sRoot
Close hTable
Open (sFolder+sRoot+".int") as hTable
End
Until (hTable = 0)
End_Procedure
//I've not tried any of these out - or even compiled, but see if they work for you.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment