|
|
| Welcome to the Mac Forums forums. Please read the FAQ if you have questions. Register to participate. |
|
|||||||
| TouchArcade.com - iPhone Game Reviews and News |
![]() |
|
|
Thread Tools | Search this Thread | Display Modes |
|
|
#1 |
|
macrumors newbie
Join Date: Nov 2009
Location: Whitewater
|
Issue with Applescript
This is a script I'm writing to be used in a program that auto configures OSX wireless settings. I'm getting a few errors and I'm not sure why I'm getting those errors. The Syntax error is Expected “end” but found “end tell” in the bolded section.
-- Prompt for Network username and password. Write username to a file and return the password to the main script -- This script expects to receive the Mac Admin password, Logs locations and MBAirPresent variable from the parent script as arguments -- Ex. osascript /path/to/this/script $MACPASS $LOG $ERRORLOG $MBAirPresent on run argv set myMacPass to item 1 of argv set LOGS to item 2 of argv set ERRORLOG to item 3 of argv set MBAirPresent to item 4 of argv set theUser to (do shell script "echo $USER") set myPass to "" set counter to 1 tell application "Finder" with timeout of 10000 seconds activate repeat until myPass is not "" if counter &1 > " & ERRORLOG" then do shell script "echo \"exit 99 User cancelled installation.\" 2>&1 >> " & LOGS else tell application "Installer" to activate return end tell end if if button returned of acctBox is "OK" then if myAcct is not "" then -- Remove any trailing @mydomain.com information from network name if myAcct contains "@" then set myAcct to text 1 through ((offset of "@" in myAcct) - 1) of myAcct end if -- Test to see if Network password is correct set myPassBox to display dialog "Please enter your UW-Whitewater password:" & return & return & "Be careful to enter it correctly!" & return & "This password is case-sensitive!" default answer "" buttons {"Quit", "OK"} default button 2 with title "UW-Whitewater Wireless Setup" with hidden answer if button returned of myPassBox is "Quit" then tell me do shell script "echo \"exit 99 User cancelled installation.\" 2>&1 > " & ERRORLOG do shell script "echo \"exit 99 User cancelled installation.\" 2>&1 >> " & LOGS end tell tell application "Installer" to activate return end if set myPass to the text returned of myPassBox -- test to see if network password is blank if myPass is not "" then -- Write username to file for parent script to pickup if myAcct is not "" then tell me do shell script "touch /private/tmp/cu_wireless/WirelessUserNameIs" & myAcct user name theUser password myMacPass with administrator privileges end tell end if if myAcct is "" then tell me do shell script "echo \"exit 21 Wireless username is blank. Unknown error.\" 2>&1 > " & ERRORLOG do shell script "echo \"exit 21 Wireless username is blank. Unknown error.\" 2>&1 >> " & LOGS end tell tell application "Finder" activate display dialog "Wireless username is blank. Unknown error." & return & return & "Please try running the Wireless Installer again." buttons {"OK"} default button 1 with icon caution end tell tell application "Installer" activate end tell return end if tell application "Installer" activate end tell -- Send wireless password to parent script return myPass end run |
|
|
|
| petersondw10 |
| View Public Profile |
| Find More Posts by petersondw10 |
|
|
#2 |
|
macrumors 6502a
Join Date: Aug 2009
|
Code:
else tell application "Installer" to activate return end tell end if |
|
|
|
|
|
#3 |
|
Thread Starter
macrumors newbie
Join Date: Nov 2009
Location: Whitewater
|
End of script error
Thanks, fixed that and realized that I had a few if statements that weren't ended. It compiles but now I cant get it to save in script editor.
Last edited by petersondw10 : Nov 5, 2009 at 11:09 AM. |
|
|
|
| petersondw10 |
| View Public Profile |
| Find More Posts by petersondw10 |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|