Results 1 to 7 of 7
  1. #1
    Star Lounger
    Join Date
    Jan 2010
    Location
    Oregon
    Posts
    59
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Launch app and make default selection?

    Our church video PC has a small app that facilitates a video feed on another computer. We have it launching on startup, but the "Default Video Capture Source" dropdown box defaults to the wrong selection. I contacted the company and the app doesn't accept any input parameters. Is there a way to change a value in another interface like this? The person running video at any given time often forgets to change the value, causing problems. Any info appreciated.

  2. #2
    Administrator
    Join Date
    Mar 2001
    Location
    St Louis, Missouri, USA
    Posts
    20,543
    Thanks
    1
    Thanked 614 Times in 550 Posts
    You may be able to drag the selection you wish to the top of the list depending on the control being used for the dropdown.

    Joe

  3. #3
    Platinum Lounger
    Join Date
    Dec 2009
    Location
    Earth
    Posts
    3,619
    Thanks
    7
    Thanked 231 Times in 219 Posts
    You could write a script in AutoIt that selects the correct source, then launch this at the same time as the app.
    Something like this should give you a start.
    Code:
    Sleep (30000)
    if WinExists("Video_app") then
    	WinActivate("Video_app")
    	Send("{ENTER}")
    endif
    Exit
    cheers, Paul

  4. The Following User Says Thank You to Paul T For This Useful Post:

    Reid (2014-06-02)

  5. #4
    Star Lounger
    Join Date
    Jan 2010
    Location
    Oregon
    Posts
    59
    Thanks
    8
    Thanked 0 Times in 0 Posts
    Thank you, Paul! This looks like a viable option, and a cool utility, too. I will proceed with your recommendation. Much appreciated.

    Quote Originally Posted by Paul T View Post
    You could write a script in AutoIt that selects the correct source, then launch this at the same time as the app.
    Something like this should give you a start.

    cheers, Paul

  6. #5
    Lounger
    Join Date
    Feb 2012
    Posts
    48
    Thanks
    2
    Thanked 5 Times in 4 Posts
    Paul, I guess you won't mind if I flesh out your idea with a working example.

    Reid, this script sits and waits for the designated program to open, in this case Firefox. Then, by simulating keystrokes, it opens the File Open dialog, Tabs to the file type selector, and chooses the image file type by typing its first few letters, namely, Im. Then it quits.

    The script works works under Windows 7 and probably in desktop mode in Windows 8. Metro is terra incognita.

    INSTRUCTIONS:

    - Save the script with the file name extension vbs. For your purpose, you could save it directly to your Startup folder.

    - Replace "Mozilla Firefox" with the title of your app's window. This is the text in the window's title bar if it has one. Be precise.

    - Roll your own SendKey and Sleep lines.

    Code:
    Option Explicit
    Dim okay
    Dim WshShell
    Set WshShell = WScript.CreateObject("WScript.Shell")
    
    okay = WaitOnWindow("Mozilla Firefox", 120)
    If okay Then
    	WshShell.SendKeys "^o"		' Ctrl+o
    	Wscript.Sleep 1000			' Wait 1000 milliseconds or 1 sec.
    	WshShell.SendKeys "{TAB}Im"
    Else
    	MsgBox "Script error at WaitOnWindow()"
    End If
    
    Function WaitOnWindow(sWinTitle, iTimeout)
    	' Wait until the application has loaded or iTimeout seconds have elapsed.
    	' Check at quarter-second intervals.
    	Dim count
    	iTimeout = iTimeout * 1000
    	count = 0
    	If VarType(sWinTitle) <> vbString Then
    		WaitOnWindow = 0
    	ElseIf sWinTitle = "" Then
    		WaitOnWindow = 0
    	Else
    		While (WshShell.AppActivate(sWinTitle) = FALSE) And (count < iTimeout)
    			WScript.Sleep 250
    			count = count + 250
    		Wend
    		WaitOnWindow = count < iTimeout
    	End If
    End Function
    Edit: Changed WaitOnWindow = 1 to WaitOnWindow = count < iTimeout for a more graceful exit on error.
    Last edited by iTobaman; 2014-06-03 at 11:50.

  7. The Following 2 Users Say Thank You to iTobaman For This Useful Post:

    Paul T (2014-06-03),Reid (2014-06-03)

  8. #6
    Star Lounger
    Join Date
    Jan 2010
    Location
    Oregon
    Posts
    59
    Thanks
    8
    Thanked 0 Times in 0 Posts
    Woohoo! Thank you, iTobaman. You probably saved me some headache, and definitely a learning curve. I love this forum. Much appreciated.

  9. #7
    Lounger
    Join Date
    Feb 2012
    Posts
    48
    Thanks
    2
    Thanked 5 Times in 4 Posts
    Made tiny edit to script.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •