Create a calendar event with popup dialogs using applescript - calendar

I need some help since I am new to this, appreciate any inputs. I am trying to setup a script to create a calendar event, asking me date, time and duration of the event, but I am messing up something since it keeps giving me errors such as Can’t make "19.12.1820:06:17" into type number, I guess they are related to formatting or something else?
tell application "Calendar"
activate
tell calendar "Work"
set theCurrentDate to short date string of (current date)
set theCurrentTime to time string of (current date)
--Get event Summary
display dialog "Enter event name:" default answer "Appointment"
set eventName to text returned of the result
--Get date
display dialog "Please enter a date for your event" default answer theCurrentDate
set eventDate to text returned of the result
--Get time
display dialog "Please enter start time" default answer theCurrentTime
set eventTime to text returned of the result
set eventStart to eventDate & eventTime
--Get duration
display dialog "Please enter duration in minutes" default answer "120"
set eventDuration to text returned of the result
set eventEnd to eventStart + (eventDuration * minutes)
make new event at end with properties {summary:eventName, location:"url Intercall: xxx PIN: xxx", start date:eventStart, end date:eventEnd, url:"url"}
end tell
reload calendars
end tell

Related

Unhandled Rejection (TypeError): formProps.date.getTime is not a function

How can I change hour and minute values to an existing Date variable?
formProps.date: existing Date type variable generated from a date picker that I want to use year value only.
formProps.hour: The hour value that user input separately.
formProps.minute: The minute value that user input separately.
Those three values are to be combined into a new Date variable 'dateWithTime', but it throws an error during copying the date values.
It this a wrong way to copy a Date variable? or is there any better way to make it?
const dateWithTime = new Date(formProps.date.getTime());
dateWithTime.setHours(formProps.hour, formProps.minute);
==== edit ====
the log of
console.log(formProps.date.toLocaleString());
console.log(typeof(formProps.date));
I don't know why your code above doesn't work but the below code worked for me. Could u try to use:
const dateWithTime = new Date(formProps.date.toLocaleString());
(I know it is not an comprehensive answer but I couldn't add a comment due to my reputation :/ )

Delphi Dbgrid delete a record

I have a multiple tabsheet. Each tabsheet in my PageControl that contain an Dbgrid with some button to manipulate this dbgrid.
Sometimes, when i click on button remove, my DBGrid not change. After delete, i see my value in my DBgrid.
If MyTable.recordcount > 0 then
begin
str := 'Value of name field/**' + MyTable.FieldByName('Name').AsString+'**/';
If Application.MessageBox(PChar(str), PChar('NAME'), MB_OKCANCEL + MB_ICONQUESTION) = IDOK then
begin
MyTable.Delete;
end;
end;
I try to add
MyTable.Refresh;
after delete but it doesn't work.
The value of myfield in the MessageBox is correct!
This problem appear when i select another Tabsheet in MyDBgrid.
It can be problem of focus in my DBGrid? It can be problem of state of my DBGrid(dsBrowser, dsEdit,...)?
=========================================================
I try to create a log for BeforeDelete event and AfterDelete event :
Log(1,'------------------------------------Before Del');
Log(1,Format('DataSet.IsEmpty:%s',[BoolToStr1(DataSet.IsEmpty)]));
Log(1,Format('DataSet.State:%d',[Ord(DataSet.State)]));
Log(1,'--------');
Log(1,Format('DataSet.RecNo:%d',[DataSet.RecNo]));
Log(1,Format('DataSet.TabSheet:%s',[DataSet.FieldByName('TabSheetName').AsString]));
Log(1,Format('DataSet.FieldName:%s',[DataSet.FieldByName('FieldName').AsString]));
Log(1,Format('DataSet.FieldId:%s',[DataSet.FieldByName('FieldId').AsString]));
on AfterDelete event :
Log(1,'------------------------------------After Del');
Log(1,Format('DataSet.IsEmpty:%s',[BoolToStr1(DataSet.IsEmpty)]));
Log(1,Format('DataSet.State:%d',[Ord(DataSet.State)]));
Log(1,'--------');
Log(1,Format('DataSet.RecNo:%d',[DataSet.RecNo]));
Log(1,Format('DataSet.TabSheet:%s',[DataSet.FieldByName('TabSheetName').AsString]));
Log(1,Format('DataSet.FieldName:%s',[DataSet.FieldByName('FieldName').AsString]));
Log(1,Format('DataSet.FieldId:%s',[DataSet.FieldByName('FieldId').AsString]));
I use the tabsheet as :
enter image description here
I obtain this log
------------------------------------Before Del
DataSet.IsEmpty:False
DataSet.State:1
--------
DataSet.RecNo:7
DataSet.TabSheet:tabsheet_0
DataSet.FieldName:
DataSet.FieldId:03
------------------------------------After Del
DataSet.IsEmpty:False
DataSet.State:1
--------
DataSet.RecNo:6
DataSet.TabSheet:tabsheet_0
DataSet.FieldName:
DataSet.FieldId:03
You can see in my log: the dataset not change (filedname and fieldId not change / the RecNo properties is change ) after delete the row that contain 03.
Since your problem is intermittent, you'll have to debug it yourself, because readers can't do that for you.
The first thing to do is to set up a logging function and call it in the dataset's BeforeDelete and AfterDelete events. You should record in it the identity of the current dataset row, the dataset's state (dsBrowse, dsEdit, etc) and anything other you think might be relevant (e.g. the identity of the active tabsheet) and see if you can spot in what circumstances the Delete fails. You could write the results of your logging calls to a TMemo on your form.
Ime, it's good practice only to allow a Delete if the dataset is in dsBrowse state.
By the way, I assume you are aware that a Delete operation is automatically aborted if the dataset is in dsInsert or dsSetKey state? From what you've described, I'd start debugging by investigating whether it's in dsInsert state when your problem arises. Of course, you can catch when the dataset is being put into dsInsert state by catching its BeforeInsert event and calling your logging function from there.

Access 2010 update date in text box from a combobox

I have a combo box that has a status in it and when it is changed from Open to Closed, transferred or Pending I would like to populate two text boxes with the current date and time. I have an after update module created that looks at the value of the combo box and then updates the text of the text box to the current date and time but it is not working.
It either doesn't do anything or I get an error about setting the focus. I appreciate any help.
If Me.CmbStatus.Value = "Closed" Then
Me.Date_Completed.Text = Date
Me.Time_Completed.Text = Time
ElseIf Me.CmbStatus.Value = "Pending" Then
Me.Date_Completed.Text = Date
Me.Time_Completed.Text = Time
ElseIf Me.CmbStatus.Value = "Transferred" Then
Me.Date_Completed.Text = Date
Me.Time_Completed.Text = Time

Time out issue in classic ASP

I am working on a classic ASP project where I am getting time out issue when populating the data from DB and Bind it in the UI. The following error we got:
Script timeout
The maximum amount of time for a script tp execute was exceeded. You can change this limit by specifying new value for the property Server.Scripttimeout or by changing the value in IIS asministration tools
To resolve the issue we tried to do the pagination but it went unsuccessful.
There are several forms on one page with individual names (i.e. form1, form2) . We have implemented Recordset pagination within one particular form.
Along with the pagination edit and delete options are also available for a particular record in record set. The problem what we are facing is when we try to edit the record the form values are not coming to the posted page.
I have mentioned the code snippet as below:
Function someFunction
data1=""
<form name="Xyz" method="post" action="edit.asp">
s=s&"<script>function relsubmit() {alert(" & data1 &"); rjob.submit(); } </script>"
'Pagination code display only 30 records per page
Do While Not ( rss.Eof Or rss.AbsolutePage <> iPage )
'some code
If (Action="RELEdit") Then
s=s&"" & drsel &""
s=s&"
s=s&"" & clean(rss.Fields(4).value) & ""
Else
End If
datadr1=datadr1& rss.Fields(0).value & ","
rss.MoveNext
loop
If (Action="RELEdit") then
s=s&"<input type=hidden name=data1 value=""" & datadr1 & "">"
s=s&"<input type=hidden name=data2 value=""" &datadr2 & """><</form>"
End If
End Function
We have tried to get the value in edit.asp page using request.form("data1") the values are coming empty also we tried alert in the relsubmit() function it is showing as empty.
Can you please help me why the form values are posted as null or empty.
Also, please advise me if we have any other approaches to track the time out.
Place this code at the top of the ASP page you are running.
The values are in seconds (300 = 60*5 = 5 minutes)
This will extend the script runtime to 5 minutes. You can set any value even hours
<%Server.ScriptTimeout=600%>

Click on month in Silverlight Calendar in year mode, get the selected month and stay in year mode?

I want to provide a user the ability to select a month\year I was going to just use 2 listboxes but I say that the Silverlight calendar had a year mode, which displays the months of a year (not the months with all the days).
But when you click on a month it switches to displaying the days in the month selected (month mode).
I tried switching back to the year mode in the SelectedDatesChanged event. But realized that fires only after I select a specific day in a month (at which point it does switch back the the year mode).
So my questions:
- can I get the calendar to stay in the year mode?
- is there an event for the month selected?
- can I even get the month select?
thanks
There is a DisplayModeChanged event that can be used. I my case I needed the first date and the last date of the selected month ... the code below does what I needed.
private void CalendarDisplayModeChanged(object sender, CalendarModeChangedEventArgs e)
{
//control might be null at start up so check for null
//probably could hook up event in Loaded or constructor instead of xaml to prevent this
if (calendarInYearMode != null) {
//reset back to year mode
calendarInYearMode.DisplayMode = CalendarMode.Year;
if (calendarInYearMode.DisplayDate != DateTime.MinValue) {
var beginningOfMonthDate = calendarInYearMode.DisplayDate;
var endOfMonthDate = calendarInYearMode.DisplayDate.AddMonths(1).AddDays(-1);
}
}
}

Resources