Forum Discussion
- Jackson_LContributorHello Ofer,
Reading from the documentation http://support.smartbear.com/viewarticle/11044/
When Sys.Clipboard holds an image, the property returns a Picture object. You can use the IsObject() function to see if the clipboard returns an object.
eg.
If IsObject(Sys.Clipboard) Then
Log.Message("A picture is held in the clipboard")
Else
Log.Message("A string is held in the clipboard")
End if
Cheers,
Jackson - OfervSuper ContributorHi Jackson,
that doesn't work,it popup an error says 'object expected'
thanks, - Jackson_LContributorHello Ofer,
I'm so use to VBScript/JScript I was coding in that. I see you're probably using C# script or the like. Did some reading and looks like you can use GetVarType() to determine the variant type.
http://support.smartbear.com/viewarticle/12102/
eg.
function Test()
{
// Storing and getting an image
//Sys["Clipboard"] = Sys["Process"]("notepad")["Window"]("Notepad", "Untitled - Notepad", 0)["Picture"]();
// Storing and getting text
Sys["Clipboard"] = Sys["Process"]("notepad")["Window"]("Notepad", "Untitled - Notepad", 0)["WndCaption"];
TypeID = GetVarType(Sys["Clipboard"]);
Log["Message"]("Type: " + TypeID);
if (TypeID == varOleStr)
{
Log.Message("A string is held in the clipboard");
}
else
{
Log.Message("A picture is held in the clipboard");
}
}
Cheers,
Jackson - OfervSuper ContributorHi Jackson,
well, i think that the problem is that the picture i took for the specific example is holding one character in it and this character is 'space' and therefore TC is recognize it as a text.just an assumption.
what do you think?
Thanks - Jackson_LContributorHello,
Yes that's a possibility and if it is, then running that against the code above will give you log message "A string is held in the clipboard".
Cheers,
Jackson - OfervSuper ContributorThx Jackson