Hi I am very new to Applescript and I am trying to write a script that prompts for a set amount of variables, then outputs them to a txt file and saves the text file. I am having two issues.
1. I dont know how to add a line break in the text file so everything is coming out as one line
2. the file is not saving as the type I want and is asking me what I want to save the file as. is there anyway around this?
attached is my script
tell application "TextEdit"
activate
make new document
display dialog "please enter the instance name:" default answer "XG"
set dialogInfo to result
set selectedButton to button returned of dialogInfo
set INS to text returned of dialogInfo
display dialog "please enter the Server name:" default answer ""
set dialogInfo to result
set selectedButton to button returned of dialogInfo
set SERVER to text returned of dialogInfo
display dialog "please enter Port number:" default answer "1521"
set dialogInfo to result
set selectedButton to button returned of dialogInfo
set PRT to text returned of dialogInfo
display dialog "please enter the SID of your database:" default answer "XG"
set dialogInfo to result
set selectedButton to button returned of dialogInfo
set SID to text returned of dialogInfo
display dialog "please enter you mail server:" default answer ""
set dialogInfo to result
set selectedButton to button returned of dialogInfo
set MAILR to text returned of dialogInfo
set text of document 1 to INS & "_DB=jdbcracle:thin" & SERVER & ":" & PRT & ":" & SID & return & "OS=WIN" & return & "SSCE=SSCE\runtime\" & return & "MAIL_SERVER=" & MAILR & return & "MAIL_PORT=25" & return & "MAIL_USE_AUTH=false" & return & "MAIL_USER_SSL=false"as text
save document 1 in "/Users/Root/Desktop/jfile.txt"
end tell
Thanks!
1. I dont know how to add a line break in the text file so everything is coming out as one line
2. the file is not saving as the type I want and is asking me what I want to save the file as. is there anyway around this?
attached is my script
tell application "TextEdit"
activate
make new document
display dialog "please enter the instance name:" default answer "XG"
set dialogInfo to result
set selectedButton to button returned of dialogInfo
set INS to text returned of dialogInfo
display dialog "please enter the Server name:" default answer ""
set dialogInfo to result
set selectedButton to button returned of dialogInfo
set SERVER to text returned of dialogInfo
display dialog "please enter Port number:" default answer "1521"
set dialogInfo to result
set selectedButton to button returned of dialogInfo
set PRT to text returned of dialogInfo
display dialog "please enter the SID of your database:" default answer "XG"
set dialogInfo to result
set selectedButton to button returned of dialogInfo
set SID to text returned of dialogInfo
display dialog "please enter you mail server:" default answer ""
set dialogInfo to result
set selectedButton to button returned of dialogInfo
set MAILR to text returned of dialogInfo
set text of document 1 to INS & "_DB=jdbcracle:thin" & SERVER & ":" & PRT & ":" & SID & return & "OS=WIN" & return & "SSCE=SSCE\runtime\" & return & "MAIL_SERVER=" & MAILR & return & "MAIL_PORT=25" & return & "MAIL_USE_AUTH=false" & return & "MAIL_USER_SSL=false"as text
save document 1 in "/Users/Root/Desktop/jfile.txt"
end tell
Thanks!