All,
I'm attempting to create an applescript that allows me to create a word document (a business proposal). One part is being able to use applescript to select the client from micorsoft outlook.
I know how to do this in VBA but in Applescript I can't seem to figure it out. Basically I need a dialog box that either has a list of all my Outlook contacts from which I can select one.
Much appreciated,
-J
Quick and dirty, but this works (Office 2008)
tell application "Microsoft Entourage"
set contactList to {}
set lastContact to (count contacts)
repeat with thisContact from 1 to lastContact
set theContact to item thisContact of contacts
set end of contactList to (first name of theContact & " " & last name of theContact)
end repeat
set contactSelected to (choose from list contactList with prompt "Please select a contact." without multiple selections allowed) as text
if (contactSelected is not "False") then
display dialog contactSelected
end if
end tell
There are essentially two parts to the script: getting the contact names and presenting the information. Getting the contacts is easy because contacts is a property of the application itself. Running this in 40+ contacts only takes a second.
Presenting the data and getting the selection isn't so obvious. The data to be presented has to be a string. Honestly, I forget why I have as text dangling off the end, but I seem to remember that doing this was easier if everything was handled as a string of some kind. Once the selection has been verified—having "False" returned means the user clicked the cancel button—you are then able to carry on with the string where I placed the display dialog. Unfortunately, you don't get the row number or anything convenient like that. It just doesn't work that way, so you will have to do a bit of fudging to get back to the corresponding contact object itself.
Add salt to taste...
Related
If one of the items in the list view is double-clicked,
I need to open a other form(psa33), looking for the column value of the double-clicked product.
The column value for that double-clicked item must appear entered in the newly opened form.
How can I make it?
help me plz
Private Sub ListView1_DblClick()
PSA33.Show
End Sub
now it works only form change but i need to do more.
i think i need to find listview1' s doubleclicked item's column data
and send it to psa33
but i dont know how to do it
The property ListView1.SelectedItem holds a reference to the selected ListItem.
Be sure to check if the property is pointing to a valid item because the user could also make a double click in the empty space of a ListView.
Example code:
If ListView1.SelectedItem Is Nothing Then
MsgBox "No tem selected", vbOKOnly + vbExclamation, "Can't proceed"
Else
PSA33.<NewPropertyYouHaveToCreate> = ListView2.SelectedItem.Text
PSA33.Show
End If
I have a script which makes users choose from different options in a list. I want there to be three buttons; OK, Cancel and Help (display a dialog with guidance).
However, it seems that I cannot use the "buttons" parameter within a list.
So how do I add additional buttons? (with a custom name, that displays a dialogue)
Current script:
set MyList to {"A", "B", "C"}
set Chosen to
(choose from list MyList with title "Connect to"
with prompt "What do you want to connect to?"
OK button name "Connect" cancel button name "Abort" ---and help
with multiple selections allowed) as text
Unfortunately choose from list supports only two buttons.
Alternatives are a (second) standard dialog which opens the list dialog or an AppleScriptObjC app with a custom dialog window.
While choose from list only supports two buttons, you can use AppleScriptObjC to create very rich alerts/dialogs. I recommend starting with Shane Stanley's free Myriad Tables Lib. Here's an example:
To learn more, read Chapter 26:Richer Interfaces of Shane's excellent $15 book Everyday AppleScriptObjC, available here. You could also look at Dialog Toolkit on the same page. Because Cocoa alerts and dialogs provide an "accessory view", you can put many additional controls in there.
I really need some help..! I have several forms & several reports in a windows (.aspx) app that I created. The forms have an option to pull data from an outside db, once done, they can edit the form & then click the submit button to save to 1 of the 5 tables I created in SQL. My problem is, we are getting a bunch of duplicate records. There should be 1 row of data (record) per call #.
I have searched & searched & what I found to be the best (with consideration of the user's needs) is if I could have the 'edit' button in the report gridview to redirect to the form page (already created as an input form), only have a couple items changed (such as instead of the submit, to hid that button & enable a 'update' button, IN ADDITION to the form prepopulating with the data (IF any) that's in the table corresponding with that form & report. Although I have created several applications, I am new to hard coding & so 'detailed' guidance is requested. I will GREATLY appreciate any help! This application needs deployed asap so I am really stressing on this one..
Needing Help Desperately..
Kathy
It's actually better to use select and here's why:
Protected Sub MyGridView_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles MyGridView.SelectedIndexChanged
Dim formid As String = gvRequisitonLines.DataKeys(gvRequisitonLines.SelectedRow).Value.ToString()
Reponse.Redirect("~/FormPage.aspx?formid=" & formid)
End Sub
This allows you to get the selected index extremely easily and use it to get the DataKey which you can send as a QueryString parameter to your form page.
Of course this requires that you have your form identifier set as a datakey on the GridView.
So for clarity, your button would have the text "Edit" but the command "Select".
So, I have an ActiveX ListBox control named ListBox1 on Sheet1 of my Excel Workbook. I enabled multiple selections on it.
I also put some code in the Sheet1 Object:
Private Sub ListBox1_Change()
Debug.Print "hello world"
End Sub
Now, if I select three values in my listbox, I see "Hello world" three times in my immediate window. So I guess the Change event triggers correctly.
When I select any cell on the same sheet where my listbox is, and I do something with it (e.g. I type "ABCDE" in it, or I press Delete) the selection I made in the listbox goes blank.
So if I had the first value in the list selected, and then I click cell "A1", type "Hello" in it and press Enter, the very moment I hit the key the first value is unselected from the listbox.
Why the hell is this? This is driving me crazy. Is the Listbox1_Change event not working properly?
It's funny though, because I don't see an extra "Hello world" in the immediate window, so I guess the event didn't actually trigger...
Any thought?
Bruder
As I mentioned earlier this is because the .Listfillrange for both the ListBox is resetting automatically.
You have specified a named range for your .Listfillrange and the formula for the named range is
For FiltroCliente
=IF(CollClientePicker<>1,OFFSET(DatiMaschera!$D$2,0,0,COUNTA(DatiMaschera!$D:$D)-1,1),"")
Now when you are making any change, Excel is re-calculating the named range because of which the .Listfillrange gets automatically updated.
Here is another way to check it.
Scroll your Listbox1 and select an item and then select an item in Listbox2. You will notice that the Listbox1 automatically scrolls to the top because it's .Listfillrange gets automatically updated.
SOLUTION
Instead of a Named Range in .Listfillrange, automatically fill the listbox using .Additem
SAMPLE CODE
'~~> Example : Add values from Cell A1:A10
For i = 1 To 10
ListBox1.AddItem Sheets("Sheet1").Range("A" & i).Value
Next i
HTH
Sid
In Outlook 2007 When a user has two calendars say Test and actual calendar and he goes to View All appointment in test calendar, copy say around 20 to 30 appointments and paste them in actual calendar's "All Appointment items view, how to get a message box saying so many items copied.
And to add further to my comment above if the copy/paste is again repeated for another 50 appointment items then message box should show 50 (this count should come correctly without the need to close outlook or terminate the session
If I understand you correctly, you want to track the number of items that have been copied from one calendar to another and display the count of items copied in a dialog box.
I think the way to do this would be to write a wrapper class around the explorer object that wires up the Explorer.BeforeItemCopy and Move etc if you want that as well.
When that event fires you will have to look up the current items selection to get your count.
There may be a better way .. ?
76mel
This is how you do it.
Outlook.Application olApp = new Outlook.Application();
Outlook.Folder cal = olApp.Session.GetDefaultFolder(Outlook.oldefaultfolders.olCalender)();
System.Windows.Forms.MessageBox.Show("Number of items in calendar : {0}", cal.Items.Count.ToString());