Struct sap_scripting::types::GuiApplication
source · pub struct GuiApplication { /* private fields */ }
Expand description
The GuiApplication represents the process in which all SAP GUI activity takes place. If the scripting component is accessed by attaching to an SAP Logon process, then GuiApplication will represent SAP Logon. GuiApplication is a creatable class. However, there must be only one component of this type in any process. GuiApplication extends the GuiContainer Object.
Implementations§
source§impl GuiApplication
impl GuiApplication
sourcepub fn start_connection<S>(&self, connection_string: S) -> Result<GuiConnection>where
S: AsRef<str>,
pub fn start_connection<S>(&self, connection_string: S) -> Result<GuiConnection>where S: AsRef<str>,
Start a new connection with the provided connection string.
sourcepub fn get_connection(&self, n: i32) -> Result<GuiConnection>
pub fn get_connection(&self, n: i32) -> Result<GuiConnection>
Get the nth session from the scripting engine.
Examples found in repository?
examples/simple.rs (line 38)
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
fn main() -> Result<()> {
// Initialise the environment.
let com_instance = SAPComInstance::new()?;
eprintln!("Got COM instance");
let wrapper = com_instance.sap_wrapper()?;
eprintln!("Got wrapper");
let engine = wrapper.scripting_engine()?;
eprintln!("Got scripting engine");
let connection = engine.get_connection(0)?;
eprintln!("Got connection");
let session = connection.children(0)?;
eprintln!("Got session");
if let SAPComponent::GuiMainWindow(wnd) = session.find_by_id("wnd[0]")? {
wnd.maximize().unwrap();
if let SAPComponent::GuiOkCodeField(tbox_comp) =
session.find_by_id("wnd[0]/tbar[0]/okcd")?
{
tbox_comp.set_text("/nfpl9").unwrap();
wnd.send_vkey(0).unwrap();
} else {
panic!("no ok code field!");
}
} else {
panic!("no window!");
}
Ok(())
}
Trait Implementations§
source§impl GuiComponentMethods<GuiApplication> for GuiApplication
impl GuiComponentMethods<GuiApplication> for GuiApplication
source§fn container_type(&self) -> Result<bool>
fn container_type(&self) -> Result<bool>
This property is TRUE, if the object is a container and therefore has the Children property.
source§fn id(&self) -> Result<String>
fn id(&self) -> Result<String>
An object id is a unique textual identifier for the object. It is built in a URLlike formatting,
starting at the GuiApplication object and drilling down to the respective object.
source§fn name(&self) -> Result<String>
fn name(&self) -> Result<String>
The name property is especially useful when working with simple scripts that only access dynpro
fields. In that case a field can be found using its name and type information, which is easier to
read than a possibly very long id. However, there is no guarantee that there are no two objects
with the same name and type in a given dynpro.
source§fn kind(&self) -> Result<String>
fn kind(&self) -> Result<String>
The type information of GuiComponent can be used to determine which properties and methods an object
supports. The value of the type string is the name of the type taken from this documentation.
source§fn kind_as_number(&self) -> Result<i64>
fn kind_as_number(&self) -> Result<i64>
While the Type property is a string value, the TypeAsNumber property is a long value that can
alternatively be used to identify an object’s type . It was added for better performance in methods
such as FindByIdEx. Possible values for this property are taken from the GuiComponentTypeenumeration.
source§impl GuiContainerMethods<GuiApplication> for GuiApplication
impl GuiContainerMethods<GuiApplication> for GuiApplication
source§fn find_by_id<S>(&self, id: S) -> Result<SAPComponent>where
S: AsRef<str>,
fn find_by_id<S>(&self, id: S) -> Result<SAPComponent>where S: AsRef<str>,
Search through the object’s descendants for a given id. If the parameter is a fully qualified id, the
function will first check if the container object’s id is a prefix of the id parameter. If that is the
case, this prefix is truncated. If no descendant with the given id can be found the function raises an
exception.
source§impl HasDispatch<GuiApplication> for GuiApplication
impl HasDispatch<GuiApplication> for GuiApplication
source§fn get_idispatch(&self) -> &IDispatch
fn get_idispatch(&self) -> &IDispatch
Get the IDispatch object for low-level access to this component.
Auto Trait Implementations§
impl RefUnwindSafe for GuiApplication
impl !Send for GuiApplication
impl !Sync for GuiApplication
impl Unpin for GuiApplication
impl UnwindSafe for GuiApplication
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more