Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Empfohlene Antworten

Veröffentlicht

Guten Abend,

ich grübel nun schon seit Stunden am folgenden VBA Code:

Private Declare Function SetCursorPos Lib "user32" (ByVal X As Long, ByVal Y As Long) As Long

Private Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)

Private Const MOUSEEVENTF_LEFTDOWN = &H2

Private Const MOUSEEVENTF_LEFTUP = &H4

Private Const MOUSEEVENTF_RIGHTDOWN As Long = &H8

Private Const MOUSEEVENTF_RIGHTUP As Long = &H10



Sub foo()

    'activate the window

    AppActivate (Programm-Name")

    'move the cursor where you need it, I guessed at 200,200

    SetCursorPos 375, 528

    'send a down event

    mouse_event MOUSEEVENTF_LEFTDOWN, 0&, 0&, 0&, 0&

    mouse_event MOUSEEVENTF_LEFTUP, 0&, 0&, 0&, 0&


    'mouse_event MOUSEEVENTF_LEFTUP, 0&, 0&, 0&, 0&

    'mouse_event MOUSEEVENTF_RIGHTDOWN, 0&, 0&, 0&, 0&

    'and an up

    'mouse_event MOUSEEVENTF_RIGHTUP, 0&, 0&, 0&, 0&

End Sub


Sub test()


AppActivate ("Programm-Name")

    SetCursorPos 375, 528

    mouse_event MOUSEEVENTF_LEFTDOWN, 0&, 0&, 0&, 0&

    mouse_event MOUSEEVENTF_LEFTUP, 0&, 0&, 0&, 0&

    Application.Wait Now + TimeSerial(0, 0, 0.5) 

SendKeys "^{TAB}", Wait:=True

Application.Wait Now + TimeSerial(0, 0, 0.5) 

    SetCursorPos 375, 528

    mouse_event MOUSEEVENTF_LEFTDOWN, 0&, 0&, 0&, 0&

    mouse_event MOUSEEVENTF_LEFTUP, 0&, 0&, 0&, 0&

    Application.Wait Now + TimeSerial(0, 0, 0.5)

SendKeys "^{TAB}", Wait:=True

Application.Wait Now + TimeSerial(0, 0, 0.5)

    SetCursorPos 375, 528

    mouse_event MOUSEEVENTF_LEFTDOWN, 0&, 0&, 0&, 0&

    mouse_event MOUSEEVENTF_LEFTUP, 0&, 0&, 0&, 0&

    Application.Wait Now + TimeSerial(0, 0, 0.5)

    SendKeys "^{TAB}", Wait:=True

Application.Wait Now + TimeSerial(0, 0, 0.5) 

    SetCursorPos 375, 528

    mouse_event MOUSEEVENTF_LEFTDOWN, 0&, 0&, 0&, 0&

    mouse_event MOUSEEVENTF_LEFTUP, 0&, 0&, 0&, 0&

    Application.Wait Now + TimeSerial(0, 0, 0.5)

    SendKeys "^{TAB}", Wait:=True

Application.Wait Now + TimeSerial(0, 0, 0.5) 

    SetCursorPos 375, 528

    mouse_event MOUSEEVENTF_LEFTDOWN, 0&, 0&, 0&, 0&

    mouse_event MOUSEEVENTF_LEFTUP, 0&, 0&, 0&, 0&

    SendKeys "^{TAB}", Wait:=True

Application.Wait Now + TimeSerial(0, 0, 0.1) 

    SetCursorPos 375, 528

    mouse_event MOUSEEVENTF_LEFTDOWN, 0&, 0&, 0&, 0&

    mouse_event MOUSEEVENTF_LEFTUP, 0&, 0&, 0&, 0&

    SendKeys "^{TAB}", Wait:=True

Application.Wait Now + TimeSerial(0, 0, 0.1) 

    SetCursorPos 375, 528

    mouse_event MOUSEEVENTF_LEFTDOWN, 0&, 0&, 0&, 0&

    mouse_event MOUSEEVENTF_LEFTUP, 0&, 0&, 0&, 0&



End Sub

Im Endeffekt soll er folgendes Machen:

Im Firefox hab ich mehrere Tabs offen (z.B. 4). Nun möchte ich per Script Firefox in den Vordergrund holen, einen Klick (linke Maustaste) auslösen an Position(X, Y). Anschließend soll der nächste Tab angesteuert werden, und es soll wieder ein Klick ausgelöst werden an der selben Position X und Y. Anschließend wieder der nächste Tab ...

Insgesamt klappt es relativ gut. Allerdings bekomme ich dies nicht hin, dass dies mit kurzen Unterbrechungen in Milliskendunenbereich funktioniert. Zwischen Klick 1 und Klick 2 ... sollen am besten 125 - 200 Millisekunden liegen.

Könnt Ihr mir dabei helfen?

Danke schon mal und viele Grüße

Darth Sidioius

Erstelle ein Konto oder melde dich an, um einen Kommentar zu schreiben.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.