I've finally lost it.. I just don't understand what I've done wrong, and of course I'm under a time crunch.
Here are the basics of what I'm trying to do...
Because most of the people in this set of labs have personal Macs that don't follow our user naming schemes for AD, I am trying to create a generic mounting script that will (if the file doesn't exist) ask for the user's name and write it to file as text. Then the same script can look at the script for the user's AD username and then mount the drives/shares as appropriate using the correct username, no matter what their current actual user name is..
The issues that I keep encountering are this:
1) When the result is written to a text file, it's not straight text. It's full of control characters. So, "joe" is "^@j^@o^@e". Is there some way that I can simply output it as straight text?
2) I put in safeguards to ask what the script reads from the file always looks right. But in the portion of the script that takes the result from the file and slaps it into a variable that I use as the username in the mount portion of the script
never populates. And when I use the same variable to try and open the user's home folder, it doesn't work (well, it works maybe 1 in 50 times, oddly).
BUT, before each of these actions, I ask for the output of the variable and it always works. And when I look at the event logs in Applescript, it's always right.
Finally.. as a test, I edited the file with a text editor and simply changed it to "joe".. and what do you know, it works. Sort of.. there appears to be some sort of carriage return/newline, invisible to me. Because the event log outputs like this:
Soooo.. Just what am I hoping that you can you, more knowledgeable folks, can help me with?
Can I write straight text to a file from Applescript? No control characters?
Am I supposed to be writing as Unicode?
Do you see a way around my problem here?
Here are the basics of what I'm trying to do...
Because most of the people in this set of labs have personal Macs that don't follow our user naming schemes for AD, I am trying to create a generic mounting script that will (if the file doesn't exist) ask for the user's name and write it to file as text. Then the same script can look at the script for the user's AD username and then mount the drives/shares as appropriate using the correct username, no matter what their current actual user name is..
The issues that I keep encountering are this:
1) When the result is written to a text file, it's not straight text. It's full of control characters. So, "joe" is "^@j^@o^@e". Is there some way that I can simply output it as straight text?
2) I put in safeguards to ask what the script reads from the file always looks right. But in the portion of the script that takes the result from the file and slaps it into a variable that I use as the username in the mount portion of the script
Code:
mount volume "cifs://DOMAIN;"& _placeUsername_ &";share.domain.edu/share$"
never populates. And when I use the same variable to try and open the user's home folder, it doesn't work (well, it works maybe 1 in 50 times, oddly).
Code:
set mountHome to make new Finder window to folder _placeUsername_ of disk "SHARE$"
set current view of mountHome to list view
BUT, before each of these actions, I ask for the output of the variable and it always works. And when I look at the event logs in Applescript, it's always right.
Code:
mount volume "cifs://DOMAIN;joe@share.domain.edu/share$"
make new Finder window to folder "joe" of disk "SHARE$"
Finally.. as a test, I edited the file with a text editor and simply changed it to "joe".. and what do you know, it works. Sort of.. there appears to be some sort of carriage return/newline, invisible to me. Because the event log outputs like this:
Code:
mount volume "cifs://DOMAIN;joe
@share.domain.edu/share$"
file "SHARE$:"
list disks
{"Hanso", "Others", "Losties", "Dharma", "Network", "SHARE$"}
display dialog "(view2) got username from file created: joe
"
{button returned:"OK"}
make new Finder window to folder "joe
" of disk "IMMU_HOME$"
Soooo.. Just what am I hoping that you can you, more knowledgeable folks, can help me with?
Can I write straight text to a file from Applescript? No control characters?
Am I supposed to be writing as Unicode?
Do you see a way around my problem here?