SImple Applescript Question For Newbie!

Hello,

I created the below applescript (from other examples on the internet :P) and basically have it doing what I want it to do, but the only problem I am now trying to solve is to have the text be displayed like this:

Date: 16 December 2012
Change: Blah Blah Blah Blah
Source: Jack Jones
Report by: Henry Faber

Instead what I am getting is this:

Date: 16 December 2012Change: Blah Blah Blah BlahSource: Jack JonesReport by:Henry Faber

Can you help me?

Here is the applescript:



set dialog1 to (display dialog "Welcome to the Change Log Input Form" & return & "Date of change?" default answer "Date: ")
set dialog2 to (display dialog "What is the change?" default answer "Change: ")
set dialog3 to (display dialog "Who created the change?" default answer "Source: ")
set dialog4 to (display dialog "Change report by?" default answer "Report by: ")

set button1_clicked to button returned of dialog1
set button2_clicked to button returned of dialog2
set button3_clicked to button returned of dialog3
set button4_clicked to button returned of dialog4

set note_date to text returned of dialog1
set note_change to text returned of dialog2
set note_created to text returned of dialog3
set note_by to text returned of dialog4

set dlg to {note_date, note_change, note_created, note_by} as string

tell application "Evernote"
	tell notebook "Default Notebook"
		set new_note to create note with text dlg as string
		set title of new_note to note_change
	end tell
end tell



Hi,

Just add some returns:

set dlg to {note_date & return, note_change & return, note_created & return, note_by} as string

Also I noticed that the headings are in the default answer. Which means they can be deleted by mistake.

I also cheekily added a date default answer

IMHO. it would be best to place them in the final line where you do the formatting.

set theDate to do shell script "date +%d/%m/%y"
set dialog1 to (display dialog "Welcome to the Change Log Input Form" & return & "Date of change?" default answer theDate)
set dialog2 to (display dialog "What is the change?" default answer "")
set dialog3 to (display dialog "Who created the change?" default answer "")
set dialog4 to (display dialog "Change report by?" default answer "")

set button1_clicked to button returned of dialog1
set button2_clicked to button returned of dialog2
set button3_clicked to button returned of dialog3
set button4_clicked to button returned of dialog4

set note_date to text returned of dialog1
set note_change to text returned of dialog2
set note_created to text returned of dialog3
set note_by to text returned of dialog4

set dlg to {"Date: " & note_date & return, "Change: " & note_change & return, "Source: " & note_created & return, "Report by: " & note_by} as string
 
tell application "Evernote"
	tell notebook "Default Notebook"
		set new_note to create note with text dlg as string
		set title of new_note to note_change
	end tell
end tell

Mark,

Wow! So simple! Thanks man, this worked.

Phil

Check the update
:slight_smile:

Hey Mark, that smokes man! I have added your variations, and it is so much easier to use now.

I have a separate question. I have evernote and I was wondering if it was possible to change the creation date in evernote with applescript. I tried but it seems that it won’t allow it or that evernote does not allow this to be scripted.

Please advise if you know how to do that. The reason I am asking is that there are changes that take place before the date of now and I would like to modify the creation date. This is why I have to put as text in the note the date as it won’t always be “now”.

Thanks man.

Regards,

Phil