Adding X-WR-CALNAME to DDay.iCal.iCalendar.Calendar - icalendar

I'm using the excellent DDay.iCal to read iCal files from Google Calendar.
Each iCal file has a non-standard property of X-WR-CALNAME.
How do I add this to the DDay.iCal.iCalendar.Calendar object?

This is how I do it... don't know if it's the right way, but it works for me.
var iCal = new iCalendar();
iCal.Method = CalendarMethods.Publish;
iCal.AddLocalTimeZone();
iCal.AddProperty("X-WR-CALNAME", "Calendar Name");

Related

Use Google Scripts to Attach PDF to email

I am trying to have google Scripts send a PDF as an attachment to an email. I have a doc template that uses form data that is copied and then filled out. The code works, but the program keeps sending the template as a pdf and not the filled out copy. Can anyone help me with this?
Here is some of my code:
newDoc = autoWriteNewIEPForm(templateDocId, newDocName, fieldArray, NewEntryArray, submitTeacherName);
newDocId = newDoc.getId();
newDocURL = newDoc.getUrl();
var sender = newEntryArray[0][3];
var subSubject = newDocName;
var subEmailBody = "Thank you for submitting this information. This receipt confirms that we have received your information." + "<br><br>";
var file = DriveApp.getFileById(newDocId).getAs(MimeType.PDF);
MailApp.sendEmail(sender, subSubject, "", {cc:emailCC, htmlBody:subEmailBody, attachments:[file], name: newDocName});
Well the last line of your code is correctly attaching the newDoc as an attachment. The first line confuses me a bit; autoWriteNewIEPForm is not a Google scripts function, and I don't know where you're getting it from or if you're using it correctly. My guess is that you're using it incorrectly, or that for some reason it's not editing any of the text in the newDoc, so you have a document that is technically a copy of the template but looks exactly the same.
In the Body class of the Google Scripts DocumentApp you can find a number of methods for editing text in a document's body. I suggest you use one of those instead.

How to change a file name of a google form bu Apps script

For a google spreadsheet it is easy to change the filename by using this script:
var file = SpreadsheetApp.openById(Idfile);
file.rename("new name");
Logical to me for change file name of a form:
var form = FormApp.openById(Idform);
form.rename("new name");
However this does not work!
Who knows the solution to change a filename of a google form by using apps script?
How about this method?
DriveApp.getFileById(id).setName("new name");
This method can also rename Spreadsheet.
Reference :
setName(name)

Add layout empty presentation

I do not get the "addnewpart" methods. Should it be used just for the first document creation or just when I try to add a slide or slide layout?
Anyone knows how to add a new slidelayout? I could not findout on google, and I get the error :cannot add a new part to the parent...
I made a full presentation in Matlab using just XML, and I find openxml very, very frustrating :(
OK I found where to put it!
SlidelayoutPart is accepted in slidemasterpart.
`Pa.PresentationPart PresPart = this.PresentationDoc.AddPresentationPart();
PresPart.Presentation =new P.Presentation();
//add minimal info
this.AddBasic(PresPart);
//Generate Master
Pa.SlideMasterPart slideMasterPart = PresPart.AddNewPart<Pa.SlideMasterPart>("rId1");
GenerateMaster(slideMasterPart);
//Add slideLayout
Pa.SlideLayoutPart SlideLayoutTemp=slideMasterPart.AddNewPart<Pa.SlideLayoutPart>("rId1");
Pa.SlideLayoutPart SP=GenerateSlideLayout(SlideLayoutTemp, "Blank");
SP.AddPart(slideMasterPart); // don't forget to link the layout to the master!
//Add Theme
Pa.ThemePart themePart1 = slideMasterPart.AddNewPart<Pa.ThemePart>("rId5");
GenerateTheme(themePart1);
//Presentation
AddSlidePart(PresPart, "Blank")`

trying to access Thunderbird-tabmail does not work

I want to open a new tab with a gloda conversation from inside calendar code.
I receive an error from error console:
window not defined (or document not defined), depending on which of the two I use to Access tabmail:
let tabmail = window.document.getElementById("tabmail");
let tabmail = document.getElementById("tabmail");
The code works fine if the js file is included in an overlay xul-file.
But I want to use it outside of xul in my code.
Somewhere in my calendar code (in my 'addevent'), the same code throws the error.
This code is originally called from a rightclick on an email, but several layers deep into calendar code.
In MDN, I read that window is global? So what do I Need to do to add an tab?
This part works if tabmail is properly referenced:
tabmail.openTab("glodaList", {
collection: queryCollection,
message: aCollection.items[0],
title: tabTitle,
background: false
});
So how do I get a reference for tabmail?
Any help is appreciated.
after trying and looking through code for really some time before posting, it took only ca. 20 minutes to accidentally find the solution after submitting the question..
While browsing mailutils on mxr for something else, I found the solution in some function:
mail3PaneWindow = Services.wm.getMostRecentWindow("mail:3pane");
if (mail3PaneWindow) var tabmail = mail3PaneWindow.document.getElementById("tabmail");

How to access hyperlinks in PDF documents (iPhone)?

Is it possible to get access to "internal" links in PDF documents using CGPDFDocument, or other means? I'm building a simple reader app and would like to deliver my content in PDF form, but if I can't support links between pages in the doc this probably isn't going to work.
This question is similar, but does not address the issue of how to support hyperlinks.
See my answer here. Basically, you'll need to get familiar with PDF link annotations.
see this sample code...pdf hyperlinks works in this
https://github.com/vfr/Reader
If you're using Quartz to open and view a PDF, then yes, it looks like you will have access to internal links. Quartz will also let you add new links to PDFs. I don't have any first hand experience with iPhone/Mac development, but it would be quite strange for them to let you add hyperlinks, but not use them.
You need to do in two steps.
First: Parse your pdf to locate marked content operators
That's an exemple of a parsing code :
-(void)parseContent() {
CGPDFOperatorTableRef myTable;
myTable = CGPDFOperatorTableCreate();
CGPDFOperatorTableSetCallback(myTable, "BMC", &myOperator_BMC);
CGPDFContentStreamRef myContentStream = CGPDFContentStreamCreateWithPage(page);
CGPDFScannerRef myScanner = CGPDFScannerCreate(myContentStream, myTable, autoZoomAreas);
CGPDFScannerScan(myScanner);
CGPDFScannerRelease(myScanner);
CGPDFContentStreamRelease(myContentStream);
}
void myOperator_BMC(CGPDFScannerRef s, void *info)
{
const char *name;
CGPDFScannerPopName(s, &name);
}
(You need to complete and adjust this code to match your requirement)
Second: respond to the toucheEnded message to handle tap on those zones and make the UI respond accordingly.