Jump to content

Recommended Posts

Hello all,

I was very happy to found the ppt wrapper:

But unfortunately it is not working for PPT VIEWER 2010 (free from Microsoft)

http://www.microsoft.com/download/en/details.aspx?id=13

So I wrote this script to be able to run the ppt on a second screen automatically

(It works with the normal PPT 2010 as well !):

ENJOY!

I got the _GetMonitors() on this forum as well (not shure where...)

Cramaboule

Global $__MonitorList[1][5], $MonL[5], $MonT[5]

#region Detect Monitor
$Monitor = _GetMonitors()
If $Monitor[0][0] = 2 Then
If ($Monitor[1][1] = 0) And ($Monitor[1][2] = 0) Then; According to Microsoft, the Main Monitor has the coordinates 0,0, ..., ...
  $MonL[2] = $Monitor[2][1] ; Monitor 1 Main - Monitor 2 Display
  $MonT[2] = $Monitor[2][2]
  $MonL[1] = $Monitor[1][1]
  $MonT[1] = $Monitor[1][2]
  $Mon = 1
Else
  $MonL[2] = $Monitor[1][1] ; Monitor 2 Main - Monitor 1 Display
  $MonT[2] = $Monitor[1][2]
  $MonL[1] = $Monitor[2][1]
  $MonT[1] = $Monitor[2][2]
  $Mon = 2
EndIf
Else
$Mon = 1 ; Only 1 Monitor
EndIf
#endregion Detect Monitor

ShellExecute(@WorkingDir&'\sitemp3.ppt',"",Default,Default,  @SW_MINIMIZE )

WinWaitActive("[CLASS:PPTFrameClass]" )
ControlSend("[CLASS:PPTFrameClass]", "", "[CLASSNN:paneClassDC1]", "{F5}")
WinSetTrans ( "[CLASS:screenClass]", "", 0 )
WinWaitActive("[CLASS:screenClass]" ) ;full screen mode
WinSetTrans ( "[CLASS:screenClass]", "", 0 )
WinMove("[CLASS:screenClass]" , "" , $MonL[2] , $MonT[2] , Default, Default, 1)
WinSetTrans ( "[CLASS:screenClass]", "", 255 )
While WinExists ("[CLASS:screenClass]" )
Sleep ("100")
WEnd
WinClose ("[CLASS:PPTFrameClass]" )
;==================================================================================================
; Function Name:   _GetMonitors()
; Description:: Load monitor positions
; Parameter(s): n/a
; Return Value(s): 2D Array of Monitors
;                      [0][0] = Number of Monitors
;                      [i][0] = HMONITOR handle of this monitor.
;                      [i][1] = Left Position of Monitor
;                      [i][2] = Top Position of Monitor
;                      [i][3] = Right Position of Monitor
;                      [i][4] = Bottom Position of Monitor
; Note:         [0][1..4] are set to Left,Top,Right,Bottom of entire screen
;                 hMonitor is returned in [i][0], but no longer used by these routines.
;                 Also sets $__MonitorList global variable (for other subs to use)
; Author(s):       xrxca (autoit@forums.xrx.ca)
;==================================================================================================
Func _GetMonitors()
$__MonitorList[0][0] = 0 ;  Added so that the global array is reset if this is called multiple times
Local $handle = DllCallbackRegister("_MonitorEnumProc", "int", "hwnd;hwnd;ptr;lparam")
DllCall("user32.dll", "int", "EnumDisplayMonitors", "hwnd", 0, "ptr", 0, "ptr", DllCallbackGetPtr($handle), "lparam", 0)
DllCallbackFree($handle)
Local $i = 0
For $i = 1 To $__MonitorList[0][0]
  If $__MonitorList[$i][1] < $__MonitorList[0][1] Then $__MonitorList[0][1] = $__MonitorList[$i][1]
  If $__MonitorList[$i][2] < $__MonitorList[0][2] Then $__MonitorList[0][2] = $__MonitorList[$i][2]
  If $__MonitorList[$i][3] > $__MonitorList[0][3] Then $__MonitorList[0][3] = $__MonitorList[$i][3]
  If $__MonitorList[$i][4] > $__MonitorList[0][4] Then $__MonitorList[0][4] = $__MonitorList[$i][4]
Next
Return $__MonitorList
EndFunc   ;==>_GetMonitors
;==================================================================================================
; Function Name:   _MonitorEnumProc($hMonitor, $hDC, $lRect, $lParam)
; Description:: Enum Callback Function for EnumDisplayMonitors in _GetMonitors
; Author(s):       xrxca (autoit@forums.xrx.ca)
;==================================================================================================
Func _MonitorEnumProc($hMonitor, $hDC, $lRect, $lParam)
Local $Rect = DllStructCreate("int left;int top;int right;int bottom", $lRect)
$__MonitorList[0][0] += 1
ReDim $__MonitorList[$__MonitorList[0][0] + 1][5]
$__MonitorList[$__MonitorList[0][0]][0] = $hMonitor
$__MonitorList[$__MonitorList[0][0]][1] = DllStructGetData($Rect, "left")
$__MonitorList[$__MonitorList[0][0]][2] = DllStructGetData($Rect, "top")
$__MonitorList[$__MonitorList[0][0]][3] = DllStructGetData($Rect, "right")
$__MonitorList[$__MonitorList[0][0]][4] = DllStructGetData($Rect, "bottom")
Return 1 ; Return 1 to continue enumeration
EndFunc   ;==>_MonitorEnumProc
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...