Dear,

During the migration of our scripts to Kix2001 beta 1 we
discover a timings problem.
What are we doing:


  • setfileattr(file,128)
  • del file
  • writeprofilestring(file,.....)
  • setfileattr(file,7) which means: file will get ReadOnly, Hidden & System
    attributes.

Result (see line 290): The system cannot find the file specified.

remarks:


  • remove line 268 means the file becomes the RO,H,S attributes
    before the new information of writeprofilestring has put
    to the file.
  • we discover this problem by using our local C-drive as destination
    location. normally we are writting those information to user's
    home directory.

Script code which is a part of our script logon.kix 2.00, which
has been check with kixstrip.exe. We were using the options
/debug /block_check /show_errors:

code:

?"- 248-" ; --------------------------------------------------------------------------
?"- 249-" ; - get last user logon information -
?"- 250-" ; --------------------------------------------------------------------------
?"- 251-"
?"- 252-" $last_logon_message="Last logon by '"+$fullname+"' at "+LCASE(@day)+" "+@mdayno+"-"+LCASE(substr(@month,1,3))+"-"+@year+" "+@time
?"- 253-" $last_workstation= "Location pc '"+UCASE(@wksta)+"' of domain '"+UCASE($domain)+"'"
?"- 254-" $previous_logon_message="<unknown>"
?"- 255-" $previous_workstation="<unknown>"
?"- 256-" ;
?"- 257-" $filename=$user_drive+"\logon.lst"
?"- 258-" $fileattr="<unknown>"
?"- 259-" $filesize="<unknown>"
?"- 260-" IF (exist($filename) = 1)
?"- 261-" $fileattr=GetFileAttr($filename)
?"- 262-" $filesize=GetFileSize($filename)
?"- 263-" IF (setfileattr($filename, 128) <> 0)
?"- 264-" ? @serror
?"- 265-" ENDIF
?"- 266-" $previous_logon_message=readprofilestring($filename, "last logon", "user")
?"- 267-" $previous_workstation=readprofilestring($filename, "last logon", "workstation")
?"- 268-" DEL $filename
?"- 269-" ENDIF
?"- 270-" IF ($debug_mode = "yes")
?"- 271-" ? " KIX-LOGON "+@kix
?"- 272-" ?
?"- 273-" ? " file "+$filename
?"- 274-" ? " file attributes "+$fileattr
?"- 275-" ? " file size "+$filesize
?"- 276-" ?
?"- 277-" ? " previous_logon_message "+$previous_logon_message
?"- 278-" ? " previous_workstation "+$previous_workstation
?"- 279-" ?
?"- 280-" ? " last_logon_message "+$last_logon_message
?"- 281-" ? " last_workstation "+$last_workstation
?"- 282-" ENDIF
?"- 283-" IF (writeprofilestring($filename, "last logon", "user", $last_logon_message) <> 0)
?"- 284-" ? @serror
?"- 285-" ENDIF
?"- 286-" IF (writeprofilestring($filename, "last logon", "workstation", $last_workstation) <> 0)
?"- 287-" ? @serror
?"- 288-" ENDIF
?"- 289-" IF (setfileattr($filename, 7) <> 0) ; -RHS-
?"- 290-" ? @serror
?"- 291-" ENDIF

The output of this script is (you see exactly which line is executed):

code:

- 248-
- 249-
- 250-
- 251-
- 252-
- 253-
- 254-
- 255-
- 256-
- 257-
- 258-
- 259-
- 260-
- 261-
- 262-
- 263-
- 266-
- 267-
- 268-
- 269-
- 270-
- 271-
KIX-LOGON 4.00 BETA 1
- 272-

- 273-
file c:\logon.lst
- 274-
file attributes 32
- 275-
file size 135
- 276-

- 277-
previous_logon_message Last logon by 'MCA' at tuesday 3-apr-2001 00:36:34
- 278-
previous_workstation Location pc 'Windows2000' of domain 'W2K'
- 279-

- 280-
last_logon_message Last logon by 'MCA' at tuesday 3-apr-2001 00:37:10
- 281-
last_workstation Location pc 'Windows2000' of domain 'W2K'
- 282-
- 283-
- 286-
- 289-
- 290-
The system cannot find the file specified.
- 291-
- 292-
- 293-


Has somebody an idea.
Greetings.

_________________________
email scripting@wanadoo.nl homepage scripting@wanadoo.nl | Links | Summary of Site Site KiXforms FAQ kixtart.org library collection mirror MCA | FAQ & UDF help file UDF kixtart.org library collection mirror MCA | mirror USA | mirror europe UDF scriptlogic library collection UDFs | mirror MCA