Deutsches AutoHotkey Homepage AutoHotkey Community
Wir helfen uns gegenseitig aus der Patsche
 
 FAQFAQ   SuchenSuchen   MitgliederlisteMitgliederliste   RegistrierenRegistrieren 
 ProfilProfil   Einloggen, um private Nachrichten zu lesenEinloggen, um private Nachrichten zu lesen   LoginLogin 

Skripte, die wo von DerRaphael gemacht wurden :)
Gehe zu Seite Zurück  1, 2, 3, 4
 
Neues Thema eröffnen   Neue Antwort erstellen    AutoHotkey Community Foren-Übersicht -> Smalltalk
Vorheriges Thema anzeigen :: Nächstes Thema anzeigen  
Autor Nachricht
derRaphael



Anmeldedatum: 09.01.2008
Beiträge: 1431
Wohnort: % ( RegExMatch( A_AppData, "^(?P<_Home>.*)\\", A ) ? A_Home : "" )

BeitragVerfasst am: Mo Feb 04, 2008 7:05 am    Titel: Antworten mit Zitat

Frage: Wie kann ich auf allen existierenden Laufwerken nach einer Datei suchen?
http://www.autohotkey.com/forum/viewtopic.php?p=176367#176367

Resultat:
To search on all existing drives for a file called License.txt build your Script like this:
Code:
#SingleInstance, Force
Loop, 26
{
  Drive := chr(ASC("A")-1+A_Index) ":\"
  If FileExist(Drive)
  {
    FilePattern := Drive "*.*"
    Recursive = 1
    mySearchedFile := "license.txt"
    Loop, %FilePattern%, 1, %Recursive%
    {
      If (A_LoopFileName=mySearchedFile)
      {
        fileList .= A_LoopFileFullPath "`n"
      }
    }
  }
}
MsgBox,0,File found, %fileList%
return

The only fancy stuff belongs to the Messagebox, and is due to its long content a so called continuation section. (all of them start like this . "some text..). just after that a simple testing checks to continue search and remembers not to show MsgBox anymore, or to break and leave the loop
I Skipped the multi Drive search function here. just make an outer loop like above to build the FilePattern
Code:
#SingleInstance, Force
  FilePattern := "C:\*.*"
  Recursive = 1
  mySearchedFile := "license.txt"
  Loop, %FilePattern%, 1, %Recursive%
  {
    If (A_LoopFileName=mySearchedFile)
    {
      Title := "Found Your File"
      fileList .= A_LoopFileFullPath "`n"
      If !(NoMsgBox)
      {
        Title := "Should I Continue search?"
        MsgBox,1,%Title%, "So far I found:`n" A_LoopFileFullPath "`n`n"
                        . "When you click 'OK' this window wont be shown anymore"
                        . "And all files on your drive will be found.`n`n"
                        . "Not: This may take a while, so be patient"
        IfMsgBox, OK
          NoMsgBox := 1
        else
          break
      }
    }
  }
  MsgBox,0,File found, %fileList%
return

A more or less simple fileSearch with a few options
FYI: if you want to list every file, that starts with a and has ahk as extension you need to make your search like ^a(.+)ahk$ not like the dos way a*.ahk, since RegEx differ completly from MsDos simple RegEx
The multi drive feature is skipped due to the fact, that user can click on folder or drive she want to search in.
Code:
#SingleInstance, Force
InputBox, mySearch, Your Action Required, % "Input "
                    . "the file to search for`n"
                    . "You may use a RegEx for your Search"
  FileSelectFolder, Start
  If !Start
    Start := "C:\"
  FilePattern := Start "\*.*"
  Loop, %FilePattern%, 1, 1
  {
    If (RegExMatch(A_LoopFileName,mySearch))
    {
      if !SkipMsgBox
      {
        Title := "Found Your File"
        SetTimer, ChangeMsgBoxButton, 1
        MsgBox,3,%Title%, % A_LoopFileFullPath
                        . " found.`nContinue Search?"
        IfMsgBox, Yes
          fileFound .= A_LoopFileFullPath "`n"
        else IfMsgBox, No
        {
          fileFound := A_LoopFileFullPath "`n"
          Break
        }
        else IfMsgBox, Cancel ; our renamed 'Yes to All' Button
        {
          fileFound .= A_LoopFileFullPath "`n"
          SkipMsgBox := 1
        }
      }
      else
        fileFound .= A_LoopFileFullPath "`n"
    }
  }
  MsgBox,0,Result of total Files found as list, %fileFound%
return

ChangeMsgBoxButton:
  If (WinActive(Title))
  {
    SetTimer, ChangeMsgBoxButton, OFF
    ControlSetText, Button3, Yes to &All
  }
return


EDIT: Skan hat eine vieeeeeel einfachere Lösung vorgestellt, von der ich ebenfalls noch lernen konnte Smile und so schauts aus:
Code:
DriveGet, List, List, Fixed
Loop Parse, List
   Loop %A_LoopField%:\License.txt,0,1
       files .= A_LoopFileLongPath "`n"

MsgBox, % files

_________________
    Code:
    /* no comment */

    -------------------------
    Moderator
Nach oben
Benutzer-Profile anzeigen Private Nachricht senden E-Mail senden
derRaphael



Anmeldedatum: 09.01.2008
Beiträge: 1431
Wohnort: % ( RegExMatch( A_AppData, "^(?P<_Home>.*)\\", A ) ? A_Home : "" )

BeitragVerfasst am: Di Feb 05, 2008 1:22 pm    Titel: Antworten mit Zitat

Frage: Wie kann ich über ein TrayIcon das Programm öffnen?
http://de.autohotkey.com/forum/viewtopic.php?t=2466

Resultat:
prinzipiell einfach:

die orginal funktion trayIcons(name) gibt dir alle notwendigen infos zu programm name

für einen doppelclick interessiert in erster linie
- MessageID
- uID
- hWnd

in seans script steht irgendwo ein kommentar, dass der wert 0x0203 für doppelklick steht (WM_LBUTTONDBLCLK = 0x0203 hat er es genannt)

die postmessage sieht dann so aus:

postmessage, WertVonMessageID, WertVonuID, 0x0203,, ahk_id WertVonhWnd

hier ist so ein fertig zum benutzen script:
Code:
#NoTrayIcon
DetectHiddenWindows, On ; Diese Zeile ist wichtig, sonst gehts net
Info := TrayIcons("outpost.exe") ; outpost.exe war das programm, mit dem ich das testete
StringSplit, TrayInfo, Info,| ; hier werden die Infos auseinander klabüsert
PostMessage, TrayInfo1, TrayInfo2, 0x0203,, ahk_id %TrayInfo3% ; hier passiert der doppelklick
return

; Found and abused from
; http://www.autohotkey.com/forum/topic17314.html
; thx, Sean ... GREAT WORK!

TrayIcons(sExeName = "")
{
 WinGet, pidTaskbar, PID, ahk_class Shell_TrayWnd
 hProc := DllCall("OpenProcess", "Uint", 0x38, "int", 0, "Uint", pidTaskbar)
 pRB := DllCall("VirtualAllocEx", "Uint", hProc, "Uint", 0
                                , "Uint", 20, "Uint", 0x1000, "Uint", 0x4)
 VarSetCapacity(btn, 20)
 VarSetCapacity(nfo, 24)
 VarSetCapacity(sTooltip, 128)
 VarSetCapacity(wTooltip, 128 * 2)
 SendMessage, 0x418, 0, 0, ToolbarWindow321, ahk_class Shell_TrayWnd
 Loop, %ErrorLevel%
 {
   SendMessage, 0x417, A_Index - 1, pRB, ToolbarWindow321, ahk_class Shell_TrayWnd
   DllCall("ReadProcessMemory", "Uint", hProc, "Uint", pRB, "Uint", &btn, "Uint", 20, "Uint", 0)
   iBitmap := NumGet(btn, 0), idn := NumGet(btn, 4), Statyle := NumGet(btn, 8)
   dwData := NumGet(btn,12), iString := NumGet(btn,16)
   DllCall("ReadProcessMemory", "Uint", hProc, "Uint", dwData, "Uint", &nfo, "Uint", 24, "Uint", 0)
   hWnd  := NumGet(nfo, 0), uID   := NumGet(nfo, 4)
   nMsg  := NumGet(nfo, 8)
   WinGet, pid, PID, ahk_id %hWnd%
   WinGet, sProcess, ProcessName, ahk_id %hWnd%
   WinGetClass, sClass, ahk_id %hWnd%
   If !sExeName || (sExeName = sProcess) || (sExeName = pid)
   {
      DllCall("ReadProcessMemory", "Uint", hProc, "Uint", iString
                                 , "Uint", &wTooltip, "Uint", 128 * 2, "Uint", 0)
      DllCall("WideCharToMultiByte", "Uint", 0, "Uint", 0, "str", wTooltip
                                   , "int", -1, "str", sTooltip, "int", 128, "Uint", 0, "Uint", 0)
      sTrayIcons .= nMsg "|" uID "|" hWnd
   }
 }
 DllCall("VirtualFreeEx", "Uint", hProc, "Uint", pRB, "Uint", 0, "Uint", 0x8000)
 DllCall("CloseHandle", "Uint", hProc)
 Return sTrayIcons
}


ich bin mir sicher, dass man seans arbeit noch weiter schrumpfen kann, jedoch war ich zu faul für
_________________
    Code:
    /* no comment */

    -------------------------
    Moderator
Nach oben
Benutzer-Profile anzeigen Private Nachricht senden E-Mail senden
IsNull



Anmeldedatum: 20.12.2006
Beiträge: 1871
Wohnort: CH

BeitragVerfasst am: Di Feb 05, 2008 1:46 pm    Titel: Antworten mit Zitat

der "Zusammenschiss" von sean gestern hat dich geprägt, hm? Mr. Green
Zitat:
; thx, Sean ... GREAT WORK!

_________________
Tannenbäume stinken. Sehr poetisch. =)
AHK 2D GAME ENGINE
Ich hab mehr Abstürze als mein Computer Smile
Nach oben
Benutzer-Profile anzeigen Private Nachricht senden
derRaphael



Anmeldedatum: 09.01.2008
Beiträge: 1431
Wohnort: % ( RegExMatch( A_AppData, "^(?P<_Home>.*)\\", A ) ? A_Home : "" )

BeitragVerfasst am: Di Feb 05, 2008 2:06 pm    Titel: Antworten mit Zitat

IsNull hat Folgendes geschrieben:
der "Zusammenschiss" von sean gestern hat dich geprägt, hm? Mr. Green

gestern?!? öhm was genau meinst du?
_________________
    Code:
    /* no comment */

    -------------------------
    Moderator
Nach oben
Benutzer-Profile anzeigen Private Nachricht senden E-Mail senden
IsNull



Anmeldedatum: 20.12.2006
Beiträge: 1871
Wohnort: CH

BeitragVerfasst am: Di Feb 05, 2008 4:33 pm    Titel: Antworten mit Zitat

DerRaphael hat Folgendes geschrieben:
IsNull hat Folgendes geschrieben:
der "Zusammenschiss" von sean gestern hat dich geprägt, hm? Mr. Green

gestern?!? öhm was genau meinst du?

na als du seinen Namen/Post nicht erwähnt hattest...hier: http://www.autohotkey.com/forum/viewtopic.php?t=26059 Laughing
_________________
Tannenbäume stinken. Sehr poetisch. =)
AHK 2D GAME ENGINE
Ich hab mehr Abstürze als mein Computer Smile
Nach oben
Benutzer-Profile anzeigen Private Nachricht senden
derRaphael



Anmeldedatum: 09.01.2008
Beiträge: 1431
Wohnort: % ( RegExMatch( A_AppData, "^(?P<_Home>.*)\\", A ) ? A_Home : "" )

BeitragVerfasst am: Mi Feb 06, 2008 3:17 am    Titel: Antworten mit Zitat

IsNull hat Folgendes geschrieben:
DerRaphael hat Folgendes geschrieben:
IsNull hat Folgendes geschrieben:
der "Zusammenschiss" von sean gestern hat dich geprägt, hm? Mr. Green

gestern?!? öhm was genau meinst du?

na als du seinen Namen/Post nicht erwähnt hattest...hier: http://www.autohotkey.com/forum/viewtopic.php?t=26059 Laughing


*g* ach das ... das ist schon länger her, als ich noch grün hinter den ohren war. ich hatte in meiner o-post erwähnt, dass sean das script verwantwortete, jedoch war ihm das wohl nicht deutlich genug, ferner hat er sich drüber aufgeregt, dass ich seine std-lib einfach so eingesackt und mit zum download angegeben habe - obwohl wie sich herausgestellt hatte er nur alleine für das Chaos mit CoHelper, COM etc verantwortlich sein wollte.

grüße
derRaphael
_________________
    Code:
    /* no comment */

    -------------------------
    Moderator
Nach oben
Benutzer-Profile anzeigen Private Nachricht senden E-Mail senden
Beiträge der letzten Zeit anzeigen:   
Neues Thema eröffnen   Neue Antwort erstellen    AutoHotkey Community Foren-Übersicht -> Smalltalk Alle Zeiten sind GMT
Gehe zu Seite Zurück  1, 2, 3, 4
Seite 4 von 4

 
Gehe zu:  
Du kannst Beiträge in dieses Forum schreiben.
Du kannst auf Beiträge in diesem Forum antworten.


Powered by phpBB © 2001, 2005 phpBB Group
Deutsche Übersetzung von phpBB.de