Sub Podizanje()
Dim fso, DatSet
Set fso = CreateObject("Scripting.FileSystemObject")
Set DatSet = fso.OpenTextFile ("D:\Temp\Parking\Postavke\Settings.txt")
If (fso.FileExists("D:\Temp\Parking\Postavke\Settings.txt")) Then
SmartTags("Sys_Parking_Grad")=DatSet.ReadLine
SmartTags("Sys_Parking_Naziv")=DatSet.ReadLine
SmartTags("Sys_Parking_Adresa")=DatSet.ReadLine
DatSet.Close
Else
SmartTags("Sys_Parking_Grad")=""
End If
Set fso = Nothing
End Sub
Debuggers indicate line 2 (Set fso = CreateObject("Scripting.FileSystemObject")) as a problem.
Sorry, sorry...
I just remembered that in fact I never used scripts in Win7. I used it only in XP SP2 and Vista (only for WinCC Flex, since TIA10.5, valid for that OS, does not support scrtipts), and it worked fine there.
I think it is because Microsux tightened the user rights in Windows 7. Maybe the user doesn't have enough rights to create/write a file. (On Win7 is an administrtator is not equal the Administrator.)
I hava a similar problem: I use a script on my PC to change the proxy-settings in the browers and to launch some programs depending on where I am (in the office or at home). The same script worked fine in WinXP and has errrors in Win7.
Lepes9, you were right. Something in Win7 'locks' target file and prevents script to be executed.
Deleting target file and restoring then from Recycle bin, helped and script can be executed.