Oferv
14 years agoSuper Contributor
Why the value of the first variable is undefined???
Hi,
That's a real riddle for me. i have this function:
//USEUNIT Math
//USEUNIT OpenDocument
//Change document size(scrolling)
function OBSAUTO_10()
{
Log["AppendFolder"]("Jira bug OBSAUTO_10")
if(Aliases["FusionDesktop"]["HwndSource_MainWindow"]["MainWindow"]["Grid"]["TabControl"]["Grid"]["ContentPanel"]["PART_SelectedContentHost"]["AssemblyViewTabControl"]["Exists"])
{
Log["Message"]("Assembly view is on,view will be change to Document")
//Click the Document view button
Aliases["FusionDesktop"]["HwndSource_MainWindow"]["MainWindow"]["Grid"]["TabControl"]["Grid"]["DockPanel"]["WPFObject"]("HeaderPanel")["WPFObject"]("TabItem", "", 2)["WPFObject"]("PathButton")["WPFObject"]("Grid", "", 1)["WPFObject"]("MyIcon")["Click"]()
if(Aliases["FusionDesktop"]["HwndSource_MainWindow"]["MainWindow"]["Grid"]["TabControl"]["Grid"]["ContentPanel"]["PART_SelectedContentHost"]["WaitWPFObject"]("Grid", "", 1)["Exists"])
Log["Message"]("Document view display properly")
else
Log["Message"]("Document view wasn't display properly")
}
//for(i=0;i<10;i++)
// Initialize the iterator
ProjectSuite["Variables"]["SupportedFileTypes"]["Reset"]()
// Iterate through rows
while(! ProjectSuite["Variables"]["SupportedFileTypes"]["IsEOF"]())
{
// Retrieve a value
FileType = ProjectSuite["Variables"]["SupportedFileTypes"]["Value"]("FileType")
OpenDocument["OpenDocumentFromLocalFileSystem"](FileType)
//Setting up document size to Actual Size
Log["Message"]("Set up document size to Actual Size")
//Clicking the Actual Size button
Aliases["FusionDesktop"]["HwndSource_MainWindow"]["MainWindow"]["Grid"]["TabControl"]["Grid"]["ContentPanel"]["PART_SelectedContentHost"]["WPFObject"]("Grid", "", 1)["WPFObject"]("DocumentViewTabControl")["WPFObject"]("ScrollableTabControlScreen")["WPFObject"]("DockPanel", "", 1)["WPFObject"]("ContentControl", "", 1)["WPFObject"]("DocumentDialog", "", 1)["WPFObject"]("Grid", "", 1)["WPFObject"]("docViewer")["WPFObject"]("Button", "", 2)["Click"]()
//check if document was set to actual size
if(Aliases["FusionDesktop"]["HwndSource_MainWindow"]["MainWindow"]["Grid"]["TabControl"]["Grid"]["ContentPanel"]["PART_SelectedContentHost"]["WPFObject"]("Grid", "", 1)["WPFObject"]("DocumentViewTabControl")["WPFObject"]("ScrollableTabControlScreen")["WPFObject"]("DockPanel", "", 1)["WPFObject"]("ContentControl", "", 1)["WPFObject"]("DocumentDialog", "", 1)["WPFObject"]("Grid", "", 1)["WPFObject"]("docViewer")["WPFObject"]("DocumentGrid")["WPFObject"]("DocumentGridPage", "", 1)["WPFObject"]("Border", "", 1)["WPFObject"]("DocumentPageView", "", 1)["WPFObject"]("DocumentPageHost", "", 1)["WPFObject"]("FixedPage", "", 1)["Height"] == 1121)
// Log["Message"]("Document was set to actual size")
// else
// Log["Error"]("Document wasn't set to actual size")
ZoomOut = 0
ZoomIn = 1
InOrOut = Math["RandomInt"](ZoomOut,ZoomIn)
if(InOrOut == 1)
{
//Changing Documents Size by clicking the +/- buttons
Log["AppendFolder"]("Zooming in started")
while(Aliases["FusionDesktop"]["HwndSource_MainWindow"]["MainWindow"]["Grid"]["TabControl"]["Grid"]["ContentPanel"]["PART_SelectedContentHost"]["WPFObject"]("Grid", "", 1)["WPFObject"]("DocumentViewTabControl")["WPFObject"]("ScrollableTabControlScreen")["WPFObject"]("DockPanel", "", 1)["WPFObject"]("ContentControl", "", 1)["WPFObject"]("DocumentDialog", "", 1)["WPFObject"]("Grid", "", 1)["WPFObject"]("docViewer")["WPFObject"]("Button", "", 5)["Enabled"])
{
DocumentHeightBeforeZoomIn = Aliases["FusionDesktop"]["HwndSource_MainWindow"]["MainWindow"]["Grid"]["TabControl"]["Grid"]["ContentPanel"]["PART_SelectedContentHost"]["WPFObject"]("Grid", "", 1)["WPFObject"]("DocumentViewTabControl")["WPFObject"]("ScrollableTabControlScreen")["WPFObject"]("DockPanel", "", 1)["WPFObject"]("ContentControl", "", 1)["WPFObject"]("DocumentDialog", "", 1)["WPFObject"]("Grid", "", 1)["WPFObject"]("docViewer")["WPFObject"]("DocumentGrid")["WPFObject"]("DocumentGridPage", "", 1)["WPFObject"]("Border", "", 1)["WPFObject"]("DocumentPageView", "", 1)["WPFObject"]("DocumentPageHost", "", 1)["WPFObject"]("FixedPage", "", 1)["Height"]
Log["Message"]("Document Height Before Zoom In " + DocumentHeightBeforeZoomIn)
Log["Message"]("Zooming in...")
//Click the zoom in button
Aliases["FusionDesktop"]["HwndSource_MainWindow"]["MainWindow"]["Grid"]["TabControl"]["Grid"]["ContentPanel"]["PART_SelectedContentHost"]["WPFObject"]("Grid", "", 1)["WPFObject"]("DocumentViewTabControl")["WPFObject"]("ScrollableTabControlScreen")["WPFObject"]("DockPanel", "", 1)["WPFObject"]("ContentControl", "", 1)["WPFObject"]("DocumentDialog", "", 1)["WPFObject"]("Grid", "", 1)["WPFObject"]("docViewer")["WPFObject"]("Button", "", 5)["Click"]()
DocumentHeightAfterZoomIn = Aliases["FusionDesktop"]["HwndSource_MainWindow"]["MainWindow"]["Grid"]["TabControl"]["Grid"]["ContentPanel"]["PART_SelectedContentHost"]["WPFObject"]("Grid", "", 1)["WPFObject"]("DocumentViewTabControl")["WPFObject"]("ScrollableTabControlScreen")["WPFObject"]("DockPanel", "", 1)["WPFObject"]("ContentControl", "", 1)["WPFObject"]("DocumentDialog", "", 1)["WPFObject"]("Grid", "", 1)["WPFObject"]("docViewer")["WPFObject"]("DocumentGrid")["WPFObject"]("DocumentGridPage", "", 1)["WPFObject"]("Border", "", 1)["WPFObject"]("DocumentPageView", "", 1)["WPFObject"]("DocumentPageHost", "", 1)["WPFObject"]("FixedPage", "", 1)["Height"]
Log["Message"]("Document Height After Zoom In " + DocumentHeightAfterZoomIn)
if(DocumentHeightBeforeZoomIn < DocumentHeightAfterZoomIn)
Log["Message"]("Document's zooming in worked properly")
else
Log["Error"]("Document's zooming in didn't work properly")
}
Log["PopLogFolder"]()
}
if(InOrOut == 0)
{
//Changing Documents Size by clicking the +/- buttons
Log["AppendFolder"]("Zooming out started")
while(Aliases["FusionDesktop"]["HwndSource_MainWindow"]["MainWindow"]["Grid"]["TabControl"]["Grid"]["ContentPanel"]["PART_SelectedContentHost"]["WPFObject"]("Grid", "", 1)["WPFObject"]("DocumentViewTabControl")["WPFObject"]("ScrollableTabControlScreen")["WPFObject"]("DockPanel", "", 1)["WPFObject"]("ContentControl", "", 1)["WPFObject"]("DocumentDialog", "", 1)["WPFObject"]("Grid", "", 1)["WPFObject"]("docViewer")["WPFObject"]("Button", "", 6)["Enabled"])
{
DocumentHeightBeforeZoomOut = Aliases["FusionDesktop"]["HwndSource_MainWindow"]["MainWindow"]["Grid"]["TabControl"]["Grid"]["ContentPanel"]["PART_SelectedContentHost"]["WPFObject"]("Grid", "", 1)["WPFObject"]("DocumentViewTabControl")["WPFObject"]("ScrollableTabControlScreen")["WPFObject"]("DockPanel", "", 1)["WPFObject"]("ContentControl", "", 1)["WPFObject"]("DocumentDialog", "", 1)["WPFObject"]("Grid", "", 1)["WPFObject"]("docViewer")["WPFObject"]("DocumentGrid")["WPFObject"]("DocumentGridPage", "", 1)["WPFObject"]("Border", "", 1)["WPFObject"]("DocumentPageView", "", 1)["WPFObject"]("DocumentPageHost", "", 1)["WPFObject"]("FixedPage", "", 1)["Height"]
Log["Message"]("Document Height Before Zoom out " + DocumentHeightBeforeZoomOut)
Log["Message"]("Zooming out...")
//Click the zoom out button
Aliases["FusionDesktop"]["HwndSource_MainWindow"]["MainWindow"]["Grid"]["TabControl"]["Grid"]["ContentPanel"]["PART_SelectedContentHost"]["WPFObject"]("Grid", "", 1)["WPFObject"]("DocumentViewTabControl")["WPFObject"]("ScrollableTabControlScreen")["WPFObject"]("DockPanel", "", 1)["WPFObject"]("ContentControl", "", 1)["WPFObject"]("DocumentDialog", "", 1)["WPFObject"]("Grid", "", 1)["WPFObject"]("docViewer")["WPFObject"]("Button", "", 6)["Click"]()
DocumentHeightAfterZoomOut = Aliases["FusionDesktop"]["HwndSource_MainWindow"]["MainWindow"]["Grid"]["TabControl"]["Grid"]["ContentPanel"]["PART_SelectedContentHost"]["WPFObject"]("Grid", "", 1)["WPFObject"]("DocumentViewTabControl")["WPFObject"]("ScrollableTabControlScreen")["WPFObject"]("DockPanel", "", 1)["WPFObject"]("ContentControl", "", 1)["WPFObject"]("DocumentDialog", "", 1)["WPFObject"]("Grid", "", 1)["WPFObject"]("docViewer")["WPFObject"]("DocumentGrid")["WPFObject"]("DocumentGridPage", "", 1)["WPFObject"]("Border", "", 1)["WPFObject"]("DocumentPageView", "", 1)["WPFObject"]("DocumentPageHost", "", 1)["WPFObject"]("FixedPage", "", 1)["Height"]
Log["Message"]("Document Height After Zoom In " + DocumentHeightAfterZoomOut)
if(DocumentHeightBeforeZoomOut > DocumentHeightAfterZoomOut)
Log["Message"]("Document's zooming in worked properly")
else
Log["Error"]("Document's zooming in didn't work properly")
}
Log["PopLogFolder"]()
}
}
Log["PopLogFolder"]()
}
Now,take a look at both BOLD variables, ZoomOut and ZoomIn .
when debugging the script by breaking at line InOrOut = Math["RandomInt"](ZoomOut,ZoomIn) the value of ZoomOut is undefiend.
any suggestions?why it's not 0?
thanks
That's a real riddle for me. i have this function:
//USEUNIT Math
//USEUNIT OpenDocument
//Change document size(scrolling)
function OBSAUTO_10()
{
Log["AppendFolder"]("Jira bug OBSAUTO_10")
if(Aliases["FusionDesktop"]["HwndSource_MainWindow"]["MainWindow"]["Grid"]["TabControl"]["Grid"]["ContentPanel"]["PART_SelectedContentHost"]["AssemblyViewTabControl"]["Exists"])
{
Log["Message"]("Assembly view is on,view will be change to Document")
//Click the Document view button
Aliases["FusionDesktop"]["HwndSource_MainWindow"]["MainWindow"]["Grid"]["TabControl"]["Grid"]["DockPanel"]["WPFObject"]("HeaderPanel")["WPFObject"]("TabItem", "", 2)["WPFObject"]("PathButton")["WPFObject"]("Grid", "", 1)["WPFObject"]("MyIcon")["Click"]()
if(Aliases["FusionDesktop"]["HwndSource_MainWindow"]["MainWindow"]["Grid"]["TabControl"]["Grid"]["ContentPanel"]["PART_SelectedContentHost"]["WaitWPFObject"]("Grid", "", 1)["Exists"])
Log["Message"]("Document view display properly")
else
Log["Message"]("Document view wasn't display properly")
}
//for(i=0;i<10;i++)
// Initialize the iterator
ProjectSuite["Variables"]["SupportedFileTypes"]["Reset"]()
// Iterate through rows
while(! ProjectSuite["Variables"]["SupportedFileTypes"]["IsEOF"]())
{
// Retrieve a value
FileType = ProjectSuite["Variables"]["SupportedFileTypes"]["Value"]("FileType")
OpenDocument["OpenDocumentFromLocalFileSystem"](FileType)
//Setting up document size to Actual Size
Log["Message"]("Set up document size to Actual Size")
//Clicking the Actual Size button
Aliases["FusionDesktop"]["HwndSource_MainWindow"]["MainWindow"]["Grid"]["TabControl"]["Grid"]["ContentPanel"]["PART_SelectedContentHost"]["WPFObject"]("Grid", "", 1)["WPFObject"]("DocumentViewTabControl")["WPFObject"]("ScrollableTabControlScreen")["WPFObject"]("DockPanel", "", 1)["WPFObject"]("ContentControl", "", 1)["WPFObject"]("DocumentDialog", "", 1)["WPFObject"]("Grid", "", 1)["WPFObject"]("docViewer")["WPFObject"]("Button", "", 2)["Click"]()
//check if document was set to actual size
if(Aliases["FusionDesktop"]["HwndSource_MainWindow"]["MainWindow"]["Grid"]["TabControl"]["Grid"]["ContentPanel"]["PART_SelectedContentHost"]["WPFObject"]("Grid", "", 1)["WPFObject"]("DocumentViewTabControl")["WPFObject"]("ScrollableTabControlScreen")["WPFObject"]("DockPanel", "", 1)["WPFObject"]("ContentControl", "", 1)["WPFObject"]("DocumentDialog", "", 1)["WPFObject"]("Grid", "", 1)["WPFObject"]("docViewer")["WPFObject"]("DocumentGrid")["WPFObject"]("DocumentGridPage", "", 1)["WPFObject"]("Border", "", 1)["WPFObject"]("DocumentPageView", "", 1)["WPFObject"]("DocumentPageHost", "", 1)["WPFObject"]("FixedPage", "", 1)["Height"] == 1121)
// Log["Message"]("Document was set to actual size")
// else
// Log["Error"]("Document wasn't set to actual size")
ZoomOut = 0
ZoomIn = 1
InOrOut = Math["RandomInt"](ZoomOut,ZoomIn)
if(InOrOut == 1)
{
//Changing Documents Size by clicking the +/- buttons
Log["AppendFolder"]("Zooming in started")
while(Aliases["FusionDesktop"]["HwndSource_MainWindow"]["MainWindow"]["Grid"]["TabControl"]["Grid"]["ContentPanel"]["PART_SelectedContentHost"]["WPFObject"]("Grid", "", 1)["WPFObject"]("DocumentViewTabControl")["WPFObject"]("ScrollableTabControlScreen")["WPFObject"]("DockPanel", "", 1)["WPFObject"]("ContentControl", "", 1)["WPFObject"]("DocumentDialog", "", 1)["WPFObject"]("Grid", "", 1)["WPFObject"]("docViewer")["WPFObject"]("Button", "", 5)["Enabled"])
{
DocumentHeightBeforeZoomIn = Aliases["FusionDesktop"]["HwndSource_MainWindow"]["MainWindow"]["Grid"]["TabControl"]["Grid"]["ContentPanel"]["PART_SelectedContentHost"]["WPFObject"]("Grid", "", 1)["WPFObject"]("DocumentViewTabControl")["WPFObject"]("ScrollableTabControlScreen")["WPFObject"]("DockPanel", "", 1)["WPFObject"]("ContentControl", "", 1)["WPFObject"]("DocumentDialog", "", 1)["WPFObject"]("Grid", "", 1)["WPFObject"]("docViewer")["WPFObject"]("DocumentGrid")["WPFObject"]("DocumentGridPage", "", 1)["WPFObject"]("Border", "", 1)["WPFObject"]("DocumentPageView", "", 1)["WPFObject"]("DocumentPageHost", "", 1)["WPFObject"]("FixedPage", "", 1)["Height"]
Log["Message"]("Document Height Before Zoom In " + DocumentHeightBeforeZoomIn)
Log["Message"]("Zooming in...")
//Click the zoom in button
Aliases["FusionDesktop"]["HwndSource_MainWindow"]["MainWindow"]["Grid"]["TabControl"]["Grid"]["ContentPanel"]["PART_SelectedContentHost"]["WPFObject"]("Grid", "", 1)["WPFObject"]("DocumentViewTabControl")["WPFObject"]("ScrollableTabControlScreen")["WPFObject"]("DockPanel", "", 1)["WPFObject"]("ContentControl", "", 1)["WPFObject"]("DocumentDialog", "", 1)["WPFObject"]("Grid", "", 1)["WPFObject"]("docViewer")["WPFObject"]("Button", "", 5)["Click"]()
DocumentHeightAfterZoomIn = Aliases["FusionDesktop"]["HwndSource_MainWindow"]["MainWindow"]["Grid"]["TabControl"]["Grid"]["ContentPanel"]["PART_SelectedContentHost"]["WPFObject"]("Grid", "", 1)["WPFObject"]("DocumentViewTabControl")["WPFObject"]("ScrollableTabControlScreen")["WPFObject"]("DockPanel", "", 1)["WPFObject"]("ContentControl", "", 1)["WPFObject"]("DocumentDialog", "", 1)["WPFObject"]("Grid", "", 1)["WPFObject"]("docViewer")["WPFObject"]("DocumentGrid")["WPFObject"]("DocumentGridPage", "", 1)["WPFObject"]("Border", "", 1)["WPFObject"]("DocumentPageView", "", 1)["WPFObject"]("DocumentPageHost", "", 1)["WPFObject"]("FixedPage", "", 1)["Height"]
Log["Message"]("Document Height After Zoom In " + DocumentHeightAfterZoomIn)
if(DocumentHeightBeforeZoomIn < DocumentHeightAfterZoomIn)
Log["Message"]("Document's zooming in worked properly")
else
Log["Error"]("Document's zooming in didn't work properly")
}
Log["PopLogFolder"]()
}
if(InOrOut == 0)
{
//Changing Documents Size by clicking the +/- buttons
Log["AppendFolder"]("Zooming out started")
while(Aliases["FusionDesktop"]["HwndSource_MainWindow"]["MainWindow"]["Grid"]["TabControl"]["Grid"]["ContentPanel"]["PART_SelectedContentHost"]["WPFObject"]("Grid", "", 1)["WPFObject"]("DocumentViewTabControl")["WPFObject"]("ScrollableTabControlScreen")["WPFObject"]("DockPanel", "", 1)["WPFObject"]("ContentControl", "", 1)["WPFObject"]("DocumentDialog", "", 1)["WPFObject"]("Grid", "", 1)["WPFObject"]("docViewer")["WPFObject"]("Button", "", 6)["Enabled"])
{
DocumentHeightBeforeZoomOut = Aliases["FusionDesktop"]["HwndSource_MainWindow"]["MainWindow"]["Grid"]["TabControl"]["Grid"]["ContentPanel"]["PART_SelectedContentHost"]["WPFObject"]("Grid", "", 1)["WPFObject"]("DocumentViewTabControl")["WPFObject"]("ScrollableTabControlScreen")["WPFObject"]("DockPanel", "", 1)["WPFObject"]("ContentControl", "", 1)["WPFObject"]("DocumentDialog", "", 1)["WPFObject"]("Grid", "", 1)["WPFObject"]("docViewer")["WPFObject"]("DocumentGrid")["WPFObject"]("DocumentGridPage", "", 1)["WPFObject"]("Border", "", 1)["WPFObject"]("DocumentPageView", "", 1)["WPFObject"]("DocumentPageHost", "", 1)["WPFObject"]("FixedPage", "", 1)["Height"]
Log["Message"]("Document Height Before Zoom out " + DocumentHeightBeforeZoomOut)
Log["Message"]("Zooming out...")
//Click the zoom out button
Aliases["FusionDesktop"]["HwndSource_MainWindow"]["MainWindow"]["Grid"]["TabControl"]["Grid"]["ContentPanel"]["PART_SelectedContentHost"]["WPFObject"]("Grid", "", 1)["WPFObject"]("DocumentViewTabControl")["WPFObject"]("ScrollableTabControlScreen")["WPFObject"]("DockPanel", "", 1)["WPFObject"]("ContentControl", "", 1)["WPFObject"]("DocumentDialog", "", 1)["WPFObject"]("Grid", "", 1)["WPFObject"]("docViewer")["WPFObject"]("Button", "", 6)["Click"]()
DocumentHeightAfterZoomOut = Aliases["FusionDesktop"]["HwndSource_MainWindow"]["MainWindow"]["Grid"]["TabControl"]["Grid"]["ContentPanel"]["PART_SelectedContentHost"]["WPFObject"]("Grid", "", 1)["WPFObject"]("DocumentViewTabControl")["WPFObject"]("ScrollableTabControlScreen")["WPFObject"]("DockPanel", "", 1)["WPFObject"]("ContentControl", "", 1)["WPFObject"]("DocumentDialog", "", 1)["WPFObject"]("Grid", "", 1)["WPFObject"]("docViewer")["WPFObject"]("DocumentGrid")["WPFObject"]("DocumentGridPage", "", 1)["WPFObject"]("Border", "", 1)["WPFObject"]("DocumentPageView", "", 1)["WPFObject"]("DocumentPageHost", "", 1)["WPFObject"]("FixedPage", "", 1)["Height"]
Log["Message"]("Document Height After Zoom In " + DocumentHeightAfterZoomOut)
if(DocumentHeightBeforeZoomOut > DocumentHeightAfterZoomOut)
Log["Message"]("Document's zooming in worked properly")
else
Log["Error"]("Document's zooming in didn't work properly")
}
Log["PopLogFolder"]()
}
}
Log["PopLogFolder"]()
}
Now,take a look at both BOLD variables, ZoomOut and ZoomIn .
when debugging the script by breaking at line InOrOut = Math["RandomInt"](ZoomOut,ZoomIn) the value of ZoomOut is undefiend.
any suggestions?why it's not 0?
thanks