Jump to content

kevev

Active Members
  • Posts

    22
  • Joined

  • Last visited

Profile Information

  • WWW
    http://kevev.net

kevev's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Hello. I am attempting to select an item in a ComboBox that matches a substring. I am only able to match from the beginning of the ComboBox item string, but I would like to match my search substring to any part of the item string. _GUICtrlComboBox_SelectString will not work as it can only match from the beginning of an item string. Thank You in advance!
  2. ; Watch for bitrate change and kill FFMPEG if changed. If $FFMPEGIO_ffmpeg_SHOULD_BE_RUNNING = 1 Then $sSelected_DESTINATION_COMBO_READ_ID = _GUICtrlComboBox_GetCurSel($iVIDEO_BITRATE_COMBO) If $Running_sDESTINATION_COMBO_READ_ID <> $sSelected_DESTINATION_COMBO_READ_ID Then $Running_sDESTINATION_COMBO_READ_ID = _GUICtrlComboBox_GetCurSel($iVIDEO_BITRATE_COMBO) ConsoleWrite('Bitrate changed!' & @CRLF) Call( "KILL_FFMPEG" ) EndIf EndIf sleep(100)
  3. Also I would like to disable mouse wheel scrolling when pointer is over a specific ComboBox.
  4. I have a ComboBox that I am watching for change of selection with: _GUICtrlComboBox_GetCurSel($MyCOMBO) The issue is that when I click on the pulldown and any time the mouse pointer hovers over a selection the app thinks I have selected. Is there any way to only detect the value when it has been clicked and is actually selected? Thank You in advance! :)
  5. Thank You both. Musashi's code is exactly what I needed.
  6. Thank You. I will not always get the same PC name. I really need the 2nd column text.
  7. Howdy! I am attempting to parse the stderr output of ffmpeg and store it into an array that will be pushed to a combobox. I have the full output example below. Original input: [libndi_newtek @ 000001f53af6af40] Found 3 NDI sources: [libndi_newtek @ 000001f53af6af40] 'PC-NAME (Remote Connection 1)' 'ndi-app:PC-NAME%20(Remote%20Connection%201)' [libndi_newtek @ 000001f53af6af40] 'PC-NAME (NDI - Output 1)' '192.168.1.201:5961' [libndi_newtek @ 000001f53af6af40] 'ANOTHER-PC (NDI - Output 3)' '192.168.1.201:5962' dummy: Immediate exit requested Needed output: PC-NAME (Remote Connection 1) PC-NAME (NDI - Output 1) ANOTHER-PC (NDI - Output 3) My current code is here: $iPID = Run(@ComSpec & ' /C "ffmpeg.exe -hide_banner -f libndi_newtek -find_sources 1 -i dummy"', @ScriptDir, @SW_HIDE, $STDERR_CHILD) ProcessWaitClose($iPID) $sDirtyOutput = StderrRead($iPID) ;This one gives me the columns I want, but the strings are still surrounded by single quotes " ' ". ;$sOutput = StringRegExpReplace(StringRegExpReplace(StringRegExpReplace($sDirtyOutput, ".*Found\ \d\ NDI\ sources:", ""), "dummy:\ Immediate\ exit\ requested", ""), "\[.*\]", "") ; This one gives no output. $sOutput = StringRegExpReplace(StringRegExpReplace(StringRegExpReplace(StringRegExpReplace($sDirtyOutput, ".*Found\ \d\ NDI\ sources:", ""), "dummy:\ Immediate\ exit\ requested", ""), "\[.*\]", ""), "(?<=\047).*?(?=\047)", "") $aOutputArray = StringSplit($sOutput, @CRLF) GUICtrlSetData($aOutputArray, $sOutput & @CRLF) ;Remove blank lines from the Array. For $i = UBound($aOutputArray) - 1 To 0 Step -1 If $aOutputArray[$i] = "" Then _ArrayDelete($aOutputArray, $i) EndIf Next _ArrayDisplay($aOutputArray) The output I get is: '''' '''' ''''
  8. I decided to just read the output of adb.exe . It was not that difficult. My app is complete. The code is GPL2 if anyone wants to use it. I will be posting it to a few Android sites. #NoTrayIcon #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=icon.ico #AutoIt3Wrapper_Compression=4 #AutoIt3Wrapper_Res_Comment=No Warranties or Guarantees are implied or offered by the Author or Distributor. All code covered by "GNU GENERAL PUBLIC LICENSE V2, June 1991". #AutoIt3Wrapper_Res_Description=A frontend for the "Great" Android usb tethering package by aziwoqpd(jperry) "azilink". #AutoIt3Wrapper_Res_Fileversion=1.0.2.16 #AutoIt3Wrapper_Res_FileVersion_AutoIncrement=y #AutoIt3Wrapper_Res_LegalCopyright=http://kevev.net/ #AutoIt3Wrapper_Res_SaveSource=y #AutoIt3Wrapper_Res_Language=1033 #AutoIt3Wrapper_Au3Check_Stop_OnWarning=y #AutoIt3Wrapper_Run_Tidy=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** ; This script controlls connect/disconnect of AziLink in Windows; #include <Array.au3> #include <Constants.au3> #include <GuiConstantsEx.au3> #include <Misc.au3> #include <Process.au3> Opt("GUIOnEventMode", 1) ; Only run one instance If _Singleton("azilink-gui", 1) = 0 Then Exit EndIf ; VARIABLES $mainwindows = GUICreate("azilink-gui", 180, 90) GUISetOnEvent($GUI_EVENT_CLOSE, "exititem") $Filemenu = GUICtrlCreateMenu("File") $installitem = GUICtrlCreateMenuItem("Install apk...", $Filemenu) GUICtrlSetOnEvent($installitem, "Installitem") $separator1 = GUICtrlCreateMenuItem("", $Filemenu) $exititem = GUICtrlCreateMenuItem("Exit", $Filemenu) GUICtrlSetOnEvent($exititem, "exititem") $helpmenu = GUICtrlCreateMenu("Help") $readmeitem = GUICtrlCreateMenuItem("Readme", $helpmenu) GUICtrlSetOnEvent($readmeitem, "readmeitem") $aboutitem = GUICtrlCreateMenuItem("About", $helpmenu) GUICtrlSetOnEvent($aboutitem, "aboutitem") $connectbutton = GUICtrlCreateButton("Connect", 10, 40, 70, 20) GUICtrlSetOnEvent($connectbutton, "connectbutton") $disconnectbutton = GUICtrlCreateButton("Disconnect", 100, 40, 70, 20) GUICtrlSetOnEvent($disconnectbutton, "disconnectbutton") $LinkStatusLast = "" $LinkLabel = "1" $DeviceStatusLast = "" $DeviceLabel = "1" $adb = "adb\adb.exe" & " forward" & " tcp:41927" & " tcp:41927" $openvpn = "openvpn --config azilink.ovpn" $adbinstall = "adb\adb.exe" & " install" & " azilink-2.0.2.apk" & " &" & " pause" $DeviceDetect = "adb\adb.exe" & " get-state" $DetectOut = _RunWait($DeviceDetect, "", @SW_HIDE, 2) GUISetState(@SW_SHOW) ; FUNCTIONS Func _RunWait($sFilename, $sWorkingdir = "", $sFlag = "", $iIOFlag = "", $iTimeOut = 0) Local $pid = Run($sFilename, $sWorkingdir, $sFlag, $iIOFlag) If $iTimeOut Then $timer = TimerInit() While ProcessExists($pid) Sleep(50) If $iTimeOut Then If TimerDiff($timer) >= $iTimeOut Then ExitLoop EndIf WEnd If ProcessExists($pid) Then ProcessClose($pid) If StderrRead($pid) <> "" Then Return SetError(2, 0, StderrRead($pid)) Return SetError(3, 0, StdoutRead($pid)) EndIf If StderrRead($pid) <> "" Then Return SetError(1, 0, StderrRead($pid)) Return StdoutRead($pid) EndFunc ;==>_RunWait Func installitem() $pid = ProcessExists("adb.exe") While $pid ProcessClose($pid) $pid = ProcessExists("adb.exe") WEnd $file = RunWait(@ComSpec & " /c " & $adbinstall) EndFunc ;==>installitem Func readmeitem() $Readme = FileOpen("azilink-gui_howto.txt", 0) If $Readme = -1 Then MsgBox(0, "Error", "Unable to open azilink-gui_howto.txt") Exit EndIf While 1 $chars = FileRead($Readme) If @error = -1 Then ExitLoop MsgBox(0, "Char read:", $chars) WEnd FileClose($Readme) EndFunc ;==>readmeitem Func aboutitem() MsgBox(0, "About", "Created by kevin evans (http://kevev.net) for AziLink (Jim Perry http://code.google.com/p/azilink/) GPL v2") EndFunc ;==>aboutitem Func connectbutton() _RunWait($adb, "", @SW_HIDE, 2) Run($openvpn, "", @SW_HIDE) EndFunc ;==>connectbutton Func disconnectbutton() $oPID = ProcessExists("openvpn.exe") If $oPID Then While $oPID ProcessClose($oPID) $oPID = ProcessExists("openvpn.exe") WEnd EndIf $aPID = ProcessExists("adb.exe") If $aPID Then While $aPID ProcessClose($aPID) $aPID = ProcessExists("adb.exe") WEnd EndIf EndFunc ;==>disconnectbutton Func exititem() disconnectbutton() Exit EndFunc ;==>exititem While 1 $oPID = ProcessExists("openvpn.exe") $aPID = ProcessExists("adb.exe") $DetectOut = _RunWait($DeviceDetect, "", @SW_HIDE, 2) If Not $oPID Then Run($adb, "", @SW_HIDE, 2) EndIf If $oPID Then $LinkStatus = "(Link Enabled)" Else $LinkStatus = "(Link Disabled)" EndIf If $LinkStatusLast <> $LinkStatus Then $LinkLabel = GUICtrlCreateLabel($LinkStatus, 30, 15, 110, 15) $LinkStatusLast = $LinkStatus EndIf If $DetectOut = "device" & @CRLF Then $DeviceStatus = "(Device Detected)" Else $DeviceStatus = "(Device Not Detected!)" EndIf If $DeviceStatusLast <> $DeviceStatus Then $DeviceLabel = GUICtrlCreateLabel($DeviceStatus, 30, 1, 110, 15) $DeviceStatusLast = $DeviceStatus EndIf Sleep(1500) ; Idle around WEnd
  9. Thank You PsaltyDS. I don't think that I explained my self very well. Your tip did lead me in the correct direction. I am now able to monitor the adb.exe & openvpn.exe processes. While 1 $oPID = ProcessExists("openvpn.exe") $aPID = ProcessExists("adb.exe") If Not $oPID Then Run($adb, "", @SW_HIDE, 2) EndIf If $oPID Then GUICtrlCreateLabel("(Link Enabled)", 30, 15, 110, 15) Else GUICtrlCreateLabel("(Link Disabled)", 30, 15, 110, 15) EndIf If $DetectOut <> 0 Then ;If $DetectOut Then GUICtrlCreateLabel("(Device Detected)", 30, 1, 110, 15) Else GUICtrlCreateLabel("(Device Not Detected!)", 30, 1, 110, 15) EndIf Sleep(1000) ; Idle around WEnd Now I need to figure out how to detect the device an easy way. I tried reading the output from the 'adb.exe get-state' command. But the output is different depending on whether adb.exe was already running, the port forwarding is already enabled, the divice is properly connected. So, I am looking into detecting the device in the "Device Manager" or the registry or another way. Does anyone have a good way to detect a device driver being used even if it is by different devices?
  10. Hello Everyone. It has been a long time since I touched any of my AutoIt code. I am having trouble checking to see if 2 processes are running. $oPID needs to be checked to see if a PID is returned. If I start openvpn.exe manually then start the gui I will see it is running. Then select stop and the status will show stopped. But If I start the GUI with the service stopped and click start the status does not show the service is running. $aPID output is checked for the string "unknown" somewhere is all the output of the adb.exe command. This is having the same issue as $oPID except it is worse. I cant get anychange in the status in the GUI even if the service is started first. I am not seeing the status in my gui change when I kill the processes and start them with the buttons I programmed. The code is an OpenSource Christmas gift for the android users @ the xda-developers.com community. So I would like to get it completed as soon as possible. Thank You in advance. #NoTrayIcon #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=icon.ico #AutoIt3Wrapper_Compression=4 #AutoIt3Wrapper_Res_Comment=No Warranties or Guarantees are implied or offered by the Author or Distributor. All code covered by "GNU GENERAL PUBLIC LICENSE V2, June 1991". #AutoIt3Wrapper_Res_Description=A frontend for the "Great" Android usb tethering package by aziwoqpd(jperry) "azilink". #AutoIt3Wrapper_Res_Fileversion=1.0.2.15 #AutoIt3Wrapper_Res_FileVersion_AutoIncrement=y #AutoIt3Wrapper_Res_LegalCopyright=http://kevev.net/ #AutoIt3Wrapper_Res_SaveSource=y #AutoIt3Wrapper_Res_Language=1033 #AutoIt3Wrapper_Au3Check_Stop_OnWarning=y #AutoIt3Wrapper_Run_Tidy=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** ; This script controlls connect/disconnect of AziLink in Windows; #include <Array.au3> #include <Constants.au3> #include <GuiConstantsEx.au3> #include <Misc.au3> #include <Process.au3> Opt("GUIOnEventMode", 1) ; Only run one instance If _Singleton("azilink-gui", 1) = 0 Then Exit EndIf ; VARIABLES $mainwindows = GUICreate("azilink-gui", 180, 90) GUISetOnEvent($GUI_EVENT_CLOSE, "exititem") $Filemenu = GUICtrlCreateMenu("File") $installitem = GUICtrlCreateMenuItem("Install apk...", $Filemenu) GUICtrlSetOnEvent($installitem, "Installitem") $separator1 = GUICtrlCreateMenuItem("", $Filemenu) $exititem = GUICtrlCreateMenuItem("Exit", $Filemenu) GUICtrlSetOnEvent($exititem, "exititem") $helpmenu = GUICtrlCreateMenu("Help") $readmeitem = GUICtrlCreateMenuItem("Readme", $helpmenu) GUICtrlSetOnEvent($readmeitem, "readmeitem") $aboutitem = GUICtrlCreateMenuItem("About", $helpmenu) GUICtrlSetOnEvent($aboutitem, "aboutitem") $connectbutton = GUICtrlCreateButton("Connect", 10, 40, 70, 20) GUICtrlSetOnEvent($connectbutton, "connectbutton") $disconnectbutton = GUICtrlCreateButton("Disconnect", 100, 40, 70, 20) GUICtrlSetOnEvent($disconnectbutton, "disconnectbutton") $adb = "adb\adb.exe" & " forward" & " tcp:41927" & " tcp:41927" $openvpn = "openvpn --config azilink.ovpn" $oPID = ProcessExists("openvpn.exe") $aPID = ProcessExists("adb.exe") $adbinstall = "adb\adb.exe" & " install" & " azilink-2.0.2.apk" & " &" & " pause" $DeviceDetect = "adb\adb.exe" & " get-state" $Readme = "notepad.exe azilink-gui_howto.txt" ;$DetectOut = _RunWait($DeviceDetect, "", @SW_HIDE, 2) ;$DetectOut = StringInStr($DeviceDetect, "tcp:4192") $DetectOut = StringInStr($DeviceDetect, "unknown") GUISetState(@SW_SHOW) ; FUNCTIONS Func _RunWait($sFilename, $sWorkingdir = "", $sFlag = "", $iIOFlag = "", $iTimeOut = 0) Local $pid = Run($sFilename, $sWorkingdir, $sFlag, $iIOFlag) If $iTimeOut Then $timer = TimerInit() While ProcessExists($pid) Sleep(50) If $iTimeOut Then If TimerDiff($timer) >= $iTimeOut Then ExitLoop EndIf WEnd If ProcessExists($pid) Then ProcessClose($pid) If StderrRead($pid) <> "" Then Return SetError(2, 0, StderrRead($pid)) Return SetError(3, 0, StdoutRead($pid)) EndIf If StderrRead($pid) <> "" Then Return SetError(1, 0, StderrRead($pid)) Return StdoutRead($pid) EndFunc ;==>_RunWait Func installitem() $pid = ProcessExists("adb.exe") While $pid ProcessClose($pid) $pid = ProcessExists("adb.exe") WEnd $file = RunWait(@ComSpec & " /c " & $adbinstall) EndFunc ;==>installitem Func readmeitem() Run($Readme, "", @SW_SHOWDEFAULT) EndFunc ;==>readmeitem Func aboutitem() MsgBox(0, "About", "Created by kevin evans (http://kevev.net) for AziLink (Jim Perry http://code.google.com/p/azilink/) GPL v2") EndFunc ;==>aboutitem Func connectbutton() _RunWait($adb, "", @SW_HIDE, 2) Run($openvpn, "", @SW_HIDE) EndFunc ;==>connectbutton Func disconnectbutton() $oPID = ProcessExists("openvpn.exe") If $oPID Then While $oPID ProcessClose($oPID) $oPID = ProcessExists("openvpn.exe") WEnd EndIf $aPID = ProcessExists("adb.exe") If $aPID Then While $aPID ProcessClose($aPID) $aPID = ProcessExists("adb.exe") WEnd EndIf EndFunc ;==>disconnectbutton Func exititem() disconnectbutton() Exit EndFunc ;==>exititem While 1 If Not $oPID Then Run($adb, "", @SW_HIDE, 2) EndIf If $oPID Then GUICtrlCreateLabel("(Link Enabled)", 30, 15, 110, 15) Else GUICtrlCreateLabel("(Link Disabled)", 30, 15, 110, 15) EndIf If $DetectOut <> 0 Then ;If $DetectOut Then GUICtrlCreateLabel("(Device Detected)", 30, 1, 110, 15) Else GUICtrlCreateLabel("(Device Not Detected!)", 30, 1, 110, 15) EndIf Sleep(1000) ; Idle around WEnd
  11. Nevermind. I got it. Now I need to make sure a command called by a button completes, then show a popup with the status. Anyone know how to do that cleanly?
  12. Yeay! That got it. Took me a while to get the syntax right. Example code below. $openvpn = "openvpn --config " & $ProgramPath & "\settings.ovpn" Run($openvpn, "", @SW_HIDE) One more question. How do I track the openvpn pid and kill it with my disconnect button?
  13. Hello all! Been a while since I used autoit. I am trying to run openvpn when a button is clicked. Openvpn starts, but none of the buttons in my script work until I kill the openvpn service. I would like my stop button and exit button to work. Is there an easy way to do this? I was thinking of creating another autoit script to start openvpn and have my main script just call it. But I am afraid I will have the same issue. Thank You in advance. Here is my loop. While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Or $msg = $cancelbutton ExitLoop Case $msg = $exititem ExitLoop Case $msg = $Connect _RunDOS($openvpn) Case $msg = $aboutitem MsgBox(0, "About", "info") EndSelect WEnd
×
×
  • Create New...