snantel
Enthusiast
Enthusiast

Question VBScript FileCreation Sandbox

Jump to solution

I'm trying to write a vbscript that create a file at first use.

It's working like a charm except that the file is created on the real filesystem and not in the sandbox.

Is it possible to write the file inside the sandbox ?

Here my basic script:

Dim filesys, filetxt

Set filesys = CreateObject("Scripting.FileSystemObject")

Function OnFirstSandboxOwner

FileName = "c:\FirstTimeUse.txt"

if Not filesys.FileExists(FileName) Then

MsgBox "!!! Attention !!!" & vbCrLf & "The first time use may take severals seconds to open databases." & vbCrLf & vbCrLf &"La première utilisation peu prendre plusieurs secondes à ouvrir les bases de données."

End If

Set filetxt = filesys.CreateTextFile(FileName, True)

filetxt.WriteLine("True")

filetxt.Close

Thanks in advance for your help !

0 Kudos
1 Solution

Accepted Solutions
admin
Immortal
Immortal

You should check out SoftwareKey for license tracking.

View solution in original post

0 Kudos
5 Replies
snantel
Enthusiast
Enthusiast

I mean, I want to create the file in the virtual c: drive and not the real c: drive...

0 Kudos
Cievo
Commander
Commander

IMHO if you want do this, you should change isolation mode for root c:\ disk to "WriteCopy".

Ondrej Zilinec - Cievo

...Good question is half of the answer...

***Good question is half of the answer...***
snantel
Enthusiast
Enthusiast

Hey hey... God damn thanks !

Sometime we lost so much times looking for simple things...

I forget to follow my own rules... Looks for simple solution first !

Thanks a lot to bring me back to the right track !

It's so simple now !

FileName = "c:\ThinLogs\" + SandboxName + ".txt"

if Not filesys.FileExists(FileName) Then

MsgBox "!!! Attention !!!" & vbCrLf & "The first time use may take severals seconds to open databases." & vbCrLf & vbCrLf &"La première utilisation peu prendre plusieurs secondes à ouvrir les bases de données."

End If

'MsgBox FileName

Set filetxt = filesys.CreateTextFile(FileName, True)

filetxt.WriteLine("True")

filetxt.Close

And I create the directory

%drive_C%\ThinLogs

create the files ##Attributes.ini

DirectoryIsolationMode=WriteCopy

Now my Boss want a licence tracking and software usage.

I'm thinking to create an SQL database and insert a vbscript that will insert a line into this SQL database, So after that, he will be able to generate report.

0 Kudos
Cievo
Commander
Commander

I'm glad it helped you.

Yes, it's good to implement SQL software-usage tracking. ThinApp said that new software-usage tracking system will be implemented into new version of ThinApp.

It this things helped you, just mark my answer as Answer, so this thread can be closed and marked as solved.

Ondrej Zilinec - Cievo

...Good question is half of the answer...

***Good question is half of the answer...***
admin
Immortal
Immortal

You should check out SoftwareKey for license tracking.

0 Kudos