PDA

View Full Version : Applescript:Create text file on remote location/ Login Log




h1068
Jun 13, 2012, 11:37 PM
I'm looking for a way to update a .txt file on my server. I am not sure if I am going to be on a windows/mac/linux server so im looking for a universal way to log completed mounts to a server.

Client: OSX 10.6.8

After afp connection is complete on my applescript that mounts afp share with username and password input I would like to do this...

edit file located here (the user will have access to this folder with read write)
server/shared/Building1_Loginlog.txt

locate local computer name / username that logged in. with my script the variable is $user_name

log time, computer, user logged in

the plan is to more efficiently assist clients who actually use the computers vs the ones that just let them charge in the carts.

Ex.

building1_loginlog.txt
#import this line to the document

time : computername : user
time : computername : user
time : computername : user


Im not sure if I will run into any problems with access to that file also....could there be an issue with 30 clients trying to update a line in the same txt file?

if so my alternative to this would to just make a .txt file on the server named $time$computername$user.txt


Thanks for checking this out.


---
Looking through the forum I'm starting to get somewhere...



tell application "TextEdit"
activate
make new document
set theDate to current date
set computername to #### ?
set text of document 1 to theDate & "_" & user_name of resultList & "_" & computername as text
save document 1 in "/server/shared/LastUpdate.txt"

#dont know how to change the file name yet

end tell