SendKeys

SendKeys

Anonymous
Not applicable
960 Views
2 Replies
Message 1 of 3

SendKeys

Anonymous
Not applicable
I have a small bit of code that I have been using to give me quick access to the iProperties.
I have moved to IV 2009 and it still works with my 32 bit machine but will not work with my 64 bit machine.
Has there been some changes in the 64 bit code that cause this not to function.

Public Sub iProperties()

'Check to see if there is a active file open
If ThisApplication.Documents.Count < 1 Then
MsgBox "There must be a active Inventor file open", vbCritical
Exit Sub
End If

'Check to see if in model or presentation mode
If ThisApplication.ActiveDocumentType = kPartDocumentObject Or _
ThisApplication.ActiveDocumentType = kPresentationDocumentObject Then
SendKeys "%f", False
SendKeys "i", True
'Check to see if in drawing, assembly or weldment mode
ElseIf ThisApplication.ActiveDocumentType = kDrawingDocumentObject Or _
ThisApplication.ActiveDocumentType = kAssemblyDocumentObject Then
SendKeys "%f", False
SendKeys "t", True
End If


End Sub

This is the machine specs that it is not working on.
Dell T7400
Intell processor X5482 @ 3.20GHz
8 gig of ram
NVIDIA Quadro FX 4600
Window XP64 Pro SP2

Thanks
Ken
0 Likes
961 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
I have used this program like this for several version and it has worked.
I changed the "true" statement to "false" and it works on both the 32 and 64 bit machines.

Ken Edited by: kdale@kadway.com on Nov 26, 2008 10:07 PM
0 Likes
Message 3 of 3

Anonymous
Not applicable

SendKeys always tend to be fragile because they're
dependent on the state of the system and the UI remaining consistent from
release to release.  It's best to avoid its use if possible.  I
suspect in your case it may be because in 64 bit VBA is running in a seperate
process and the Inventor window may not be active when the SendKeys call is
made.  You can try adding the following just before you call
SendKeys

 

AppActivate ThisApplication.Caption

 

Even better is to not use SendKeys and just start
the command directly through the API, which is what the line below
does.

 


size=2>ThisApplication.CommandManager.ControlDefinitions.Item("AppiPropertiesWrapperCmd").Execute
--

Brian Ekins
Autodesk Inventor API

href="http://blogs.autodesk.com/modthemachine">http://blogs.autodesk.com/modthemachine
0 Likes