Anregung: GUI - SMS Bereich


tbr
Beiträge: 5
Registriert: Mi 17. Feb 2010, 22:40
Wohnort: Neustadt / Nds / Germany

Anregung: GUI - SMS Bereich

Beitrag von tbr »

Nachdem dass das letzte mal so gut geklappt hat, hier eine neue anregung. Bilder sagen meist mehr als worte, also hab ichs versucht zu malen ;)



MfG Peer

Bild
Chaka

Beitrag von Chaka »

fände ich auch eine gute Sache, wenn der SMS zähler den vom Handy auslesen würde bzw. man den 1x einstellt und der über den Sync dann feststellt wie viele SMS versand worden...
FJ
Site Admin
Beiträge: 32106
Registriert: Mi 15. Feb 2006, 01:16
Wohnort: Tirol
Kontaktdaten:

Beitrag von FJ »

Der SMS-Zähler vom handy kann nicht ausgelesen werden. Weils doch oft gewünscht wurde zählt MyPhoneExplorer in der statusleiste intern mit. das sind also die SMS die mit myPhoneExplorer verschickt wurden.
tbr
Beiträge: 5
Registriert: Mi 17. Feb 2010, 22:40
Wohnort: Neustadt / Nds / Germany

Beitrag von tbr »

und was ist ueber den "unschoenen" Weg?

Handy steuern->
Menü->Einstellungen->Wählen->Reiter Anrufe->Zeit und Kosten->Wählen->Nachrichtenzähler->Wählen

Keycodes@Handytastatur:
(R)->(rechts, unten, unten)->(L)->(rechts,rechts,rechts)->(unten,unten,unten)->(L)->(unten,unten)->(L)

Text auslesen, sollte doch via Debug.txt hinhauen, weil wir Plaintext bekommen, oder nicht?

Debug.txt auszug:
14:09:18.32 [RX]: *ZGUI: "ListObject","Zeit und Kosten","Wählen","","Nachrichtenzähler","","65535;65535;65535","3(4)"
14:09:18.32 [RX]: OK
14:09:18.94 [RX]: +CKEV: [,1
14:09:19.11 [RX]: +CKEV: [,0
14:09:19.22 [TX]: AT*ZGUI=0
14:09:19.24 [RX]: AT*ZGUI=0

14:09:19.24 [RX]: *ZGUI: "InformationBrowser","Nachrichtenzähler","OK","Zurücksetzen","Gesendete SMS:\n28\nGesendete MMS:\n0","Gesendete SMS:\n28\nGesendete MMS:\n0\n"
14:09:19.24 [RX]: OK
14:09:19.24 Short Sequence...
14:09:19.75 Was short Sequence
14:09:19.86 [TX]: AT*ZGUI=0
14:09:19.91 [RX]: AT*ZGUI=0

Wo kann ich den Wert (INI) aendern, damit ich diesen von "aussen" korrigieren/steuern kann?
FJ
Site Admin
Beiträge: 32106
Registriert: Mi 15. Feb 2006, 01:16
Wohnort: Tirol
Kontaktdaten:

Beitrag von FJ »

Der Weg ist "zu" unschön.
1. haben die Handymodelle unterschiedliche Menüs und Tasten
2. müsste ich das Ganze auf alle möglichen Sprachen und Variationen erweitern

Alles in allem kommt diese Lösung nicht in Frage
tbr
Beiträge: 5
Registriert: Mi 17. Feb 2010, 22:40
Wohnort: Neustadt / Nds / Germany

Beitrag von tbr »

wo ist denn der wert, der in der statusbar angezeigt wird, hinterlegt? vllt. bekomme ich es ja ueber ein script hin, bzw, kann man das evtl. "scriptbar" machen? falls nicht, koennte ich mir nen vbs oder aehnliches basteln ;)

was ist denn mit einem schalter, der mir in der explorerbar links in den captions die aktuellen elemente auf dem handy, anstelle von neuen, ungelesenen elementen anzeigt? da ich nur 64mb auf meinem handy habe und dieses eigentlich staendig mit meinem laptop verbunden ist, versuche ich abgearbeitete sms zu archivieren. ich klicke jedesmal alle menuepunkte durch und schaue somit, wo was zum archivieren ist. einfacher (ja, die kleinen bequemen details machen gute software aus) ist es gleich im ueberblick zu sehen ;)

Gruss,
Peer
FJ
Site Admin
Beiträge: 32106
Registriert: Mi 15. Feb 2006, 01:16
Wohnort: Tirol
Kontaktdaten:

Beitrag von FJ »

In der Datei settings.dat ist es die Zeile die mit SMS_Counter= beginnt.

Nun - wenn ich die Anzahl der SMS immer in den Titel des Buttons einbaue dann müsste ich das auch konsequenterweise auch für Telefonbuch, Organizer, Aufgaben und Notizen tun. Gefällt mir nicht. Die ungelesenen SMS sind wichtig und deshalb ists da auch gerechtfertigt.
tbr
Beiträge: 5
Registriert: Mi 17. Feb 2010, 22:40
Wohnort: Neustadt / Nds / Germany

Beitrag von tbr »

hier mein script, falls es jmd gebrauchen kann:

die variablen im file sind auf jeden fall anzupassen!!!

anleitung:
code kopieren, in eine neue (text)Datei und diese als test.vbs abspeichern.

//update 07.03.10 15:24

Code: Alles auswählen

'© Peer L.
'version 0.1: 07.03.2010 - 02:01 - erstellt
'version 0.2: 07.03.2010 - 14:50 - ZGUI doch senden
'version 0.3: 07.03.2010 - 15:24 - n bissel optimiert

'getestet mit K800i


'#####################################Konstanten'#####################################:
'#####################hier anpassen!##########################
'pfad zum debugfile, das muss aktiviert sein: 
'datei -> einstellungen -> Logdatei mitschreiben muss ein haken gesetzt sein!!!
strDebugFile = "C:\Users\The_Rabbit\AppData\Roaming\MyPhoneExplorer\Debug.txt"
'pfad zur mpe config (settings.dat), bei mir:
strMPEConfig = "C:\Users\The_Rabbit\AppData\Roaming\MyPhoneExplorer\Sony Ericsson K800 [0000000000000]\settings.dat"
'pfad zur myphoneexplorer.exe:
strMPEBinary = "C:\Program Files (x86)\MyPhoneExplorer\MyPhoneExplorer.exe"
'suchstrings fuer gesendete sms: 1=Gesendete SMS:\n 2=\n (Wert zwischen den beiden vorkommen wird ausgelesen)
strSearchString1 = "Gesendete SMS:\n"
strSearchString2 = "\n"




'bevor sie das script ausfuehren ueberpruefen sie bitte die kommandos in der sub SendMPEStrings!!!!!!!!!!!!!!!!




'anfuehrungsstriche fuer spaeter.. (einfacher zu lesen)
QUOT = Chr(34)
'#####################################Code##########################
if not CheckFileExists(strDebugFile) then
	strErrMsg = strErrMsg & "###Fehler: strDebugFile konnte nicht gefunden werden, passen Sie die Konstanten im Script an!" & vbcrlf & "aktueller Wert: " & strDebugFile & vbcrlf & vbcrlf
	blnAbbruch = True
end if
if not CheckFileExists(strMPEConfig) then
	strErrMsg = strErrMsg & "###Fehler: strMPEConfig konnte nicht gefunden werden, passen Sie die Konstanten im Script an!" & vbcrlf & "aktueller Wert: " & strMPEConfig & vbcrlf & vbcrlf
	blnAbbruch = True
end if
if not CheckFileExists(strMPEBinary) then
	strErrMsg = strErrMsg & "###Fehler: strMPEBinary konnte nicht gefunden werden, passen Sie die Konstanten im Script an!" & vbcrlf & "aktueller Wert: " & strMPEBinary & vbcrlf & vbcrlf
	blnAbbruch = True
end if

if blnAbbruch then
	msgbox strErrMsg,vbCritical+vbOkOnly,"FEHLER..Abbruch"
else
	lngRet = MsgBox("Alle angegebenen Pfade sind existent!" & vbcrlf & vbcrlf & "Benutzung auf eigene Gefahr!!!" _
	& vbcrlf & vbcrlf & _
	"MyPhoneExplorer muss gestartet und verbunden sein!!" & vbcrlf & _
	"Anfangen??" _
	,vbYesNo+vbQuestion,"!!ACHTUNG BITTE LESEN!!")
	if lngRet=vbYes then
		wscript.echo "Bitte Warten..."

		Call SendMPEStrings()
		strSentSMS = AnalyseDebugFile()
		if strSentSMS <> -1 or not isnumeric(strSentSMS) then
			Call UpdateSettingsFile(strSentSMS)
			wscript.echo " ;) Alles gut; Wert vom Handy in MPE eingetragen: " & strSentSMS
		else
			wscript.echo " ;( irgendwas is schief gelaufen.."
		end if
	else
		wscript.echo "Abbruch"
	end if
end if

Sub SendMPEStrings()
	'wakeup, mobilephone, you will get some key inputs..
  call MPEWakeUp
	'tastensperre ausmachen.. --> *]
	call MPEUnlock

	'menue button druecken, dann rechts, 2xrunter fuer einstellungsmenue..
	'#menue einstellungen waehlen..
	'menue --> ]
	call MPERightAction
	'2mal runter --> V
	call MPEDown
	call MPEDown
	'einmal rechts --> >
	call MPERight
	'waehlen --> [
	call MPELeftAction
	
	'dreimal nach rechts.. --> >
	'#reiter anrufe
	call MPERight
  call MPERight
  call MPERight

	'dreimal nach unten --> V
	'#zeit und kosten
	call MPEDown
	call MPEDown
	call MPEDown
	
	'waehlen --> [
	call MPELeftAction

	'zweimal nach unten --> V
	'#nachrichtenzaehler
	call MPEDown
	call MPEDown
	
	call MPELeftAction
	'nach string "Gesendete SMS:\n" suchen, bis \n und da haben wir die zahl..

	'brauchen wir hier nicht, da mpe selber nach der ZGUI fragt.. :)
	'v0.2: doch, weil mpe das nur m8, wenn handy steuern einmal aufgerufen wurde..
	call MPEReadGUI

	'viermal back druecken, fuer hauptmenue.. auto tastensperre kann wieder einsetzen..
	call MPEBack
	call MPEBack
	call MPEBack
	call MPEBack
End Sub

'#######################SUBS/FUNKTIONEN#####################
Sub MPEWakeUp()
	'sternchen senden..
	RunMPE "AT+CKPD=" & QUOT & "*" & QUOT & ",3,4"	
End Sub

Sub MPEUnlock()
  RunMPE "AT+CKPD=" & QUOT & "*" & QUOT & ",3,4"
  RunMPE "AT+CKPD=" & QUOT & "]" & QUOT & ",3,4"
End Sub

Sub MPEBack()
	RunMPE "AT*EKEY=1," & QUOT & ":R" & QUOT & ",2"
End Sub

Sub MPEReadGUI()
	RunMPE "AT*ZGUI=0,2"
End Sub

Sub MPELeftAction()
	RunMPE "AT*EKEY=1," & QUOT & "[" & QUOT & ",2"
End Sub

Sub MPERightAction()
	RunMPE "AT*EKEY=1," & QUOT & "]" & QUOT & ",2"
End Sub

Sub MPEDown()
	RunMPE "AT*EKEY=1," & QUOT & "V" & QUOT & ",2"
End Sub

Sub MPERight()
  RunMPE "AT*EKEY=1," & QUOT & ">" & QUOT & ",2"
End Sub

Function AnalyseDebugFile()
	'file auslesen
	strDummy = ReadFile(strDebugFile)
	'gesendete sms string suchen..
	i = instr(strDummy,strSearchString1)
	if i < 1 then
		AnalyseDebugFile=-1
		exit function
	end if
	strDummy = Mid(strDummy, i+Len(strSearchString1))
	j = instr(strDummy,strSearchString2)
	if j < 1 then
		AnalyseDebugFile=-1
		exit function
	end if	'wert zwischen i und j, also left bis j..
	strDummy = Left(strDummy, j-1)
	AnalyseDebugFile = strDummy
End Function

Function UpdateSettingsFile(strRealSentSMS)
	Call WriteIni( strMPEConfig, "Main", "SMS_Counter", strRealSentSMS )
End Function

Function RunMPE(Arguments)
  set shell = CreateObject("WScript.Shell")
  shell.run QUOT & strMPEBinary & QUOT & " action=directcommand command=" & Arguments ,3
	'1000=1sec, so kommt jeder keypress beim mobilephone an..
	'werte unter 1000 --> commands wurden teilweise von meinem handy verschluckt..
	WScript.Sleep 1000
	set shell = nothing
End Function

'#################################HILFSFUNKTIONEN###########################
Function ReadFile(strFile)
	Const ForReading = 1
	Set objFSO = CreateObject("Scripting.FileSystemObject")
			Set objTest = objFSO.GetFile(strFile)
	If objTest.Size > 0 Then
	Set objFile = objFSO.OpenTextFile(strFile, ForReading)
	strText = objFile.ReadAll
	ReadFile = strText
	objFile.Close
	end if 
	set objFSO = nothing
	set objFile = nothing
End Function

Function CheckFileExists(strFile)
	Set fso = CreateObject("Scripting.FileSystemObject")
	if fso.FileExists(strFile) then
			CheckFileExists = True
	else
			CheckFileExists = False
	end if
	Set fso = nothing
End Function

Function ReadIni( myFilePath, mySection, myKey )
'quelle: http://www.robvanderwoude.com/vbstech_files_ini.php#ReadINI
    ' This function returns a value read from an INI file
    '
    ' Arguments:
    ' myFilePath  [string]  the (path and) file name of the INI file
    ' mySection   [string]  the section in the INI file to be searched
    ' myKey       [string]  the key whose value is to be returned
    '
    ' Returns:
    ' the [string] value for the specified key in the specified section
    '
    ' CAVEAT:     Will return a space if key exists but value is blank
    '
    ' Written by Keith Lacelle
    ' Modified by Denis St-Pierre and Rob van der Woude

    Const ForReading   = 1
    Const ForWriting   = 2
    Const ForAppending = 8

    Dim intEqualPos
    Dim objFSO, objIniFile
    Dim strFilePath, strKey, strLeftString, strLine, strSection

    Set objFSO = CreateObject( "Scripting.FileSystemObject" )

    ReadIni     = ""
    strFilePath = Trim( myFilePath )
    strSection  = Trim( mySection )
    strKey      = Trim( myKey )

    If objFSO.FileExists( strFilePath ) Then
        Set objIniFile = objFSO.OpenTextFile( strFilePath, ForReading, False )
        Do While objIniFile.AtEndOfStream = False
            strLine = Trim( objIniFile.ReadLine )

            ' Check if section is found in the current line
            If LCase( strLine ) = "[" & LCase( strSection ) & "]" Then
                strLine = Trim( objIniFile.ReadLine )

                ' Parse lines until the next section is reached
                Do While Left( strLine, 1 ) <> "["
                    ' Find position of equal sign in the line
                    intEqualPos = InStr( 1, strLine, "=", 1 )
                    If intEqualPos > 0 Then
                        strLeftString = Trim( Left( strLine, intEqualPos - 1 ) )
                        ' Check if item is found in the current line
                        If LCase( strLeftString ) = LCase( strKey ) Then
                            ReadIni = Trim( Mid( strLine, intEqualPos + 1 ) )
                            ' In case the item exists but value is blank
                            If ReadIni = "" Then
                                ReadIni = " "
                            End If
                            ' Abort loop when item is found
                            Exit Do
                        End If
                    End If

                    ' Abort if the end of the INI file is reached
                    If objIniFile.AtEndOfStream Then Exit Do

                    ' Continue with next line
                    strLine = Trim( objIniFile.ReadLine )
                Loop
            Exit Do
            End If
        Loop
        objIniFile.Close
    Else
        WScript.Echo strFilePath & " doesn't exists. Exiting..."
        Wscript.Quit 1
    End If
End Function

Sub WriteIni( myFilePath, mySection, myKey, myValue )
'quelle: http://www.robvanderwoude.com/vbstech_files_ini.php#WriteINI
    ' This subroutine writes a value to an INI file
    '
    ' Arguments:
    ' myFilePath  [string]  the (path and) file name of the INI file
    ' mySection   [string]  the section in the INI file to be searched
    ' myKey       [string]  the key whose value is to be written
    ' myValue     [string]  the value to be written (myKey will be
    '                       deleted if myValue is <DELETE_THIS_VALUE>)
    '
    ' Returns:
    ' N/A
    '
    ' CAVEAT:     WriteIni function needs ReadIni function to run
    '
    ' Written by Keith Lacelle
    ' Modified by Denis St-Pierre, Johan Pol and Rob van der Woude

    Const ForReading   = 1
    Const ForWriting   = 2
    Const ForAppending = 8

    Dim blnInSection, blnKeyExists, blnSectionExists, blnWritten
    Dim intEqualPos
    Dim objFSO, objNewIni, objOrgIni, wshShell
    Dim strFilePath, strFolderPath, strKey, strLeftString
    Dim strLine, strSection, strTempDir, strTempFile, strValue

    strFilePath = Trim( myFilePath )
    strSection  = Trim( mySection )
    strKey      = Trim( myKey )
    strValue    = Trim( myValue )

    Set objFSO   = CreateObject( "Scripting.FileSystemObject" )
    Set wshShell = CreateObject( "WScript.Shell" )

    strTempDir  = wshShell.ExpandEnvironmentStrings( "%TEMP%" )
    strTempFile = objFSO.BuildPath( strTempDir, objFSO.GetTempName )

    Set objOrgIni = objFSO.OpenTextFile( strFilePath, ForReading, True )
    Set objNewIni = objFSO.CreateTextFile( strTempFile, False, False )

    blnInSection     = False
    blnSectionExists = False
    ' Check if the specified key already exists
    blnKeyExists     = ( ReadIni( strFilePath, strSection, strKey ) <> "" )
    blnWritten       = False

    ' Check if path to INI file exists, quit if not
    strFolderPath = Mid( strFilePath, 1, InStrRev( strFilePath, "\" ) )
    If Not objFSO.FolderExists ( strFolderPath ) Then
        WScript.Echo "Error: WriteIni failed, folder path (" _
                   & strFolderPath & ") to ini file " _
                   & strFilePath & " not found!"
        Set objOrgIni = Nothing
        Set objNewIni = Nothing
        Set objFSO    = Nothing
        WScript.Quit 1
    End If

    While objOrgIni.AtEndOfStream = False
        strLine = Trim( objOrgIni.ReadLine )
        If blnWritten = False Then
            If LCase( strLine ) = "[" & LCase( strSection ) & "]" Then
                blnSectionExists = True
                blnInSection = True
            ElseIf InStr( strLine, "[" ) = 1 Then
                blnInSection = False
            End If
        End If

        If blnInSection Then
            If blnKeyExists Then
                intEqualPos = InStr( 1, strLine, "=", vbTextCompare )
                If intEqualPos > 0 Then
                    strLeftString = Trim( Left( strLine, intEqualPos - 1 ) )
                    If LCase( strLeftString ) = LCase( strKey ) Then
                        ' Only write the key if the value isn't empty
                        ' Modification by Johan Pol
                        If strValue <> "<DELETE_THIS_VALUE>" Then
                            objNewIni.WriteLine strKey & "=" & strValue
                        End If
                        blnWritten   = True
                        blnInSection = False
                    End If
                End If
                If Not blnWritten Then
                    objNewIni.WriteLine strLine
                End If
            Else
                objNewIni.WriteLine strLine
                    ' Only write the key if the value isn't empty
                    ' Modification by Johan Pol
                    If strValue <> "<DELETE_THIS_VALUE>" Then
                        objNewIni.WriteLine strKey & "=" & strValue
                    End If
                blnWritten   = True
                blnInSection = False
            End If
        Else
            objNewIni.WriteLine strLine
        End If
    Wend

    If blnSectionExists = False Then ' section doesn't exist
        objNewIni.WriteLine
        objNewIni.WriteLine "[" & strSection & "]"
            ' Only write the key if the value isn't empty
            ' Modification by Johan Pol
            If strValue <> "<DELETE_THIS_VALUE>" Then
                objNewIni.WriteLine strKey & "=" & strValue
            End If
    End If

    objOrgIni.Close
    objNewIni.Close

    ' Delete old INI file
    objFSO.DeleteFile strFilePath, True
    ' Rename new INI file
    objFSO.MoveFile strTempFile, strFilePath

    Set objOrgIni = Nothing
    Set objNewIni = Nothing
    Set objFSO    = Nothing
    Set wshShell  = Nothing
End Sub
Antworten