; move powerpoint 2010 viewer to an alternate monitor/screen/projector ; written by Leef_me Nov 29, 2012 ; http://www.autohotkey.com/board/topic/86854-move-powerpoint-viewer-fullscreen-to-secondary-monitor/ inifile = ppt_screen.ini ; the name of the file for config info ; the location of the PPT viewer -- with a little work, this could be moved to the config PPTVIEWER_location = "C:\Programme\Microsoft Office\Office14\PPTVIEW.EXE" ; all files without a specified path default to the working directory SetWorkingDir %A_ScriptDir% ; same as where the script is located ; the location of an example file that should be run ; this is for diagnostic purposes only, the script should be better written ; note the last assignment to variable 'ppt_file' is valid pps_file = "C:\Users\Leef_me\Documents\Autohotkey\Announcements.pps" ppsx_file = "C:\Users\Leef_me\Documents\Autohotkey\Announcements.ppsx" ppt_file = "C:\Users\Leef_me\Documents\Autohotkey\Announcements.ppt" pptx_file = "C:\temp\20121202.Ansagen cgush.pptx" ; parameters to be retrieved from the config file param = MonitorCount,selected,left,top,width,height ; a dual check is implemented, if there is no config file, or some parameters are missing ; or if the quantity of monitors has changed, then "Choose which monitor" is shown ; note: not all parameters are checked, this should be improved SysGet, MonitorCnt, MonitorCount ; how many monitors or projectors in system ; a quick way to read all the parameter loop, parse, param, `, IniRead, %A_LoopField% , %inifile%, Configuration, % A_LoopField If (MonitorCount != "ERROR" and MonitorCnt = MonitorCount) { ; msgbox ready to go on %selected%`rPress F7 to run PPTViewer`rPress F4 to move viewer return } else { MonitorCount := MonitorCnt Loop, %MonitorCount% { SysGet, Mon%A_Index%, Monitor, %A_Index% Mon%A_Index%Width := Mon%A_Index%Right - Mon%A_Index%Left Mon%A_Index%Height := Mon%A_Index%Bottom - Mon%A_Index%Top } gui, add, text,, Choose which monitor to show PPT Loop, %MonitorCount% gui, add, button, vMon%a_index% gshowit , screen%a_index% gui, add, button, x50 gaccept , accept ;; gui, show, x1500 y700 ; for Leef_me's system gui, show, ; for other 'generic' system gui, 2:font, s20, gui, 2:add, text,, Show here ? } return ; show a simple gui, just to indicate where the PPT would be moved showit: selected := A_GuiControl tooltip %A_GuiControl% left := % %A_GuiControl%left top := % %A_GuiControl%top width := % %A_GuiControl%width height := % %A_GuiControl%height guileft := left + width/2 -100 guitop := top + height/2 -100 tooltip %A_GuiControl% %left% gui, 2:show, x%guileft% y%guitop% w200 h200 return ; accept the currently selected monitor as where PPT should be moved accept: ; the gui has served its purposes gui, 2:destroy ; a quick way to write all the parameters loop, parse, param, `, IniWrite, % %A_LoopField%, %inifile%, Configuration, % A_LoopField reload return ; combined starting the PPT show -- with moving the show to the target monitor f6:: run %PPTVIEWER_location% %ppt_file% return f7:: run %PPTVIEWER_location% %pptx_file% return f8:: run %PPTVIEWER_location% %pps_file% return f9:: run %PPTVIEWER_location% %ppsx_file% return f3:: WinGet, ID, ID, ahk_class PPTFrameClass Winmove,ahk_id %ID%,, left, top, width , height Winactivate,ahk_id %ID% send {F5} f4:: WinGet, ID, ID, ahk_class screenClass Winmove,ahk_id %ID%,, left, top, width , height ; full size of monitor ; Winmove,ahk_id %ID%,, left, top, 320 , 240 ; a thumbnail size for testing ;listvars ;tooltip moved & done return ; msgbox sleep, 100 ;winminimize, ahk_class PPTFrameClass ;tooltip, done sleep, 1000 ;winclose, ahk_class PPTFrameClass ;listvars ;sleep, 100 ;winmaximize, ahk_id %ID% return ;================================================================== ;================================================================== #singleinstance force ; prevents a message about closing running copy of script ;#singleinstance off ; prevents a message about closing running copy of script #Persistent ; only needed if there are settimer, but no gui or hot000eys ; my debugging tools are below this line +esc:: ; <---- easy way to close the script exitapp f11:: ;tooltip see the variable list listvars return f10::reload