locked
Copying local files into VFS on startup (SCRIPTING) RRS feed

  • Question

  • I need to find a way to script on startup of a Sequenced app to check if a file exists on C:\ and if so, copy this file into the VFS (QSmile of the sequenced application. This is used as a method to transfer personal contact data from an existing local installation into the application data of the sequenced app for use.

    Is there a way to do this via OSD Scripting? Here's my first guess.

    @ECHO ON \n

    IF EXIST "%USERPROFILE%\Application Data\NewHeights\YA3.3\ya.mdb" COPY "%USERPROFILE%\Application Data\NewHeights\YA3.3\ya.mdb" "%SFT_MNT%\YA33\VFS\CSIDL_APPDATA\NewHeights\YA3.3\ya.mdb" \n

    I'm not sure what kinds of enviroment variables I can refer to to direct input to the C:\ & %SFT_MNT% directories, any help would be greatly appreciated.


    Thursday, September 18, 2008 4:47 PM

Answers

  • I am asuming you are using SCRIPTBODY for this pre launch script, instead of HREF.  If that is the case, don't forget that SCRIPTBODY requires an escape character "\" to be used, so anywhere you have a single back-slash, you need to replace it with a double back-slash.  So your script should look like this:

    Code Snippet

    <SCRIPT TIMING="PRE" EVENT="LAUNCH" PROTECT="FALSE" WAIT="TRUE" TIMEOUT="0">

    <SCRIPTBODY> @ECHO ON \n

    IF EXIST "%USERPROFILE%\\Application Data\\NewHeights\\YA3.3\\ya.mdb" COPY "%USERPROFILE%\\Application Data\\NewHeights\\YA3.3\\ya.mdb" "%SFT_MNT%\\YA33\\VFS\\CSIDL_APPDATA\\NewHeights\\YA3.3\\ya.mdb" \n

    </SCRIPTBODY>

    </SCRIPT>

     

     

    The reason for PROTECT="FALSE" is because otherwise it will look in the virtual %APPDATA% directory, not the physical %APPDATA%.

     

    Hope this helps....

    Thursday, September 18, 2008 5:35 PM
  • Hi Chris,

     

    Please check your package in the sequencer (open package) if the folder (where you want the db to resides) is marked as virtualized in VFS (virtual file system). If yes, then make it not virtualized or even delete the folder. By doing this the virtual application will not find the folder or even the db (that was installed during sequencing) in the virtual environment and it will check if the db exists on the physical system.

     

    Best regards

    Reto

     

    • Proposed as answer by znack Friday, May 28, 2010 9:55 PM
    • Marked as answer by Aaron.ParkerModerator Thursday, March 1, 2012 9:04 PM
    Tuesday, September 23, 2008 6:45 AM

All replies

  • I am asuming you are using SCRIPTBODY for this pre launch script, instead of HREF.  If that is the case, don't forget that SCRIPTBODY requires an escape character "\" to be used, so anywhere you have a single back-slash, you need to replace it with a double back-slash.  So your script should look like this:

    Code Snippet

    <SCRIPT TIMING="PRE" EVENT="LAUNCH" PROTECT="FALSE" WAIT="TRUE" TIMEOUT="0">

    <SCRIPTBODY> @ECHO ON \n

    IF EXIST "%USERPROFILE%\\Application Data\\NewHeights\\YA3.3\\ya.mdb" COPY "%USERPROFILE%\\Application Data\\NewHeights\\YA3.3\\ya.mdb" "%SFT_MNT%\\YA33\\VFS\\CSIDL_APPDATA\\NewHeights\\YA3.3\\ya.mdb" \n

    </SCRIPTBODY>

    </SCRIPT>

     

     

    The reason for PROTECT="FALSE" is because otherwise it will look in the virtual %APPDATA% directory, not the physical %APPDATA%.

     

    Hope this helps....

    Thursday, September 18, 2008 5:35 PM
  • Ok, well I have inputted the script into the OSD of the package under DEPEDENCY -> SCRIPT -> SCRIPT BODY like so

    <DEPENDENCY>
    <SCRIPT TIMING="PRE" EVENT="LAUNCH" WAIT="TRUE" PROTECT="FALSE">
    <SCRIPTBODY>

    @ECHO ON \n
    IF EXIST "%USERPROFILE%\\Application Data\\NewHeights\\YA3.3\\ya.mdb" COPY "%USERPROFILE%\\Application Data\\NewHeights\\YA3.3\\ya.mdb" "%SFT_MNT%\\YA33\\VFS\\CSIDL_APPDATA\\NewHeights\\YA3.3\\ya.mdb" \n

    IF EXIST "%USERPROFILE%\\Application Data\\NewHeights\\YA3.3\\ya.mdb" RENAME "%USERPROFILE%\\Application Data\\NewHeights\\YA3.3\\ya.mdb" ya.mdb.bak \n

    </SCRIPTBODY>
    </SCRIPT>
    </DEPENDENCY>

    Doesn't seem to do anything when the app is launched. Is the pre/post script execution logged somewhere? I've enabled verbose logging but that never told me anything. What's the easiest way to troubleshoot why the script isn't working?
    Thursday, September 18, 2008 10:32 PM
  • What if I need to penetrate both the Virtual and Local enviroment? How does the PROTECT=TRUE or FALSE function in my case? If Protect is set to FALSE does it not prevent me from access the virtual enviroment?
    Thursday, September 18, 2008 11:09 PM
  • If you need to work with the virtual environment (Q: drive) then you must set the setting to PROTECT=TRUE.

     

    Actually I don't recommend to copy an Access DB from the local system into the virtual application environment (actually the user settings cache). This increases the size of the user cache and also makes your application slower (in most cases). Why not leaving the application where it is?

     

    Monday, September 22, 2008 7:27 PM
  • Most users maintain a contact database for this application under their user directory. I'd like to virtualize the application but in order to do so I have to pull the contact database into the virtual enviroment for use. If I don't, the application will see that a user database does not exists and it will manually create a new one and store it in the virtual enviroment.

    So unless there's some way for the virtual application to simply use the contact database from the C:\, copying it into the virtual enviroment for use would be the only way.

    What's the standard proceduere for virtualizing applications with user specific settings that need to be moved into the virtual app for use?
    Monday, September 22, 2008 10:07 PM
  • Hi Chris,

     

    Please check your package in the sequencer (open package) if the folder (where you want the db to resides) is marked as virtualized in VFS (virtual file system). If yes, then make it not virtualized or even delete the folder. By doing this the virtual application will not find the folder or even the db (that was installed during sequencing) in the virtual environment and it will check if the db exists on the physical system.

     

    Best regards

    Reto

     

    • Proposed as answer by znack Friday, May 28, 2010 9:55 PM
    • Marked as answer by Aaron.ParkerModerator Thursday, March 1, 2012 9:04 PM
    Tuesday, September 23, 2008 6:45 AM