-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAutoDetectResolution.py
More file actions
38 lines (33 loc) · 1.06 KB
/
AutoDetectResolution.py
File metadata and controls
38 lines (33 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# Neil Kanungo
# TIBCO Software
# January 2023
# Auto Detect Screen Resolution and switch/hide pages
# Get Screen Resolution
pageSize = Document.ActivePageReference.GetVisualizationAreaSize()
# Set Limits and Identifiers
mobileWidth = 600
tabletWidth = 1280
mobileID = '[M]'
tabletID = '[T]'
# Hide/Switch pages depending on Screen Resolution Width
if (pageSize.Width > tabletWidth): # Full Size Condition
Document.ActivePageReference = Document.Pages[0]
for p in Document.Pages:
if ((p.Title.find(mobileID)>0) or (p.Title.find(tabletID)>0)):
p.Visible = False
else:
p.Visible = True
elif (pageSize.Width <= tabletWidth and pageSize.Width > mobileWidth): # Tablet Size Condition
Document.ActivePageReference = Document.Pages[1]
for p in Document.Pages:
if (p.Title.find(tabletID)>0):
p.Visible = True
else:
p.Visible = False
else: # Mobile Size Condition
Document.ActivePageReference = Document.Pages[2]
for p in Document.Pages:
if (p.Title.find(mobileID)>0):
p.Visible = True
else:
p.Visible = False