Esempio n. 1
1
def key_stroke_in_BG(on_off_key=64):
    # F6(64)
    while 1:
        keyboard.wait(on_off_key)

        frequency = 2000  # Set Frequency To 2000 Hertz
        duration = 100  # Set Duration, 1000 ms == 1 second
        for i in range(2):
            winsound.Beep(frequency, duration)

        hwnd_current = GetForegroundWindow()
        hwndChild = GetWindow(hwnd_current, GW_CHILD)
        while 1:
            # SetForegroundWindow(hwnd_current)
            if keyboard.is_pressed(on_off_key):
                break
            # print(win32gui.GetForegroundWindow())
            # PostMessage(hwndChild, WM_KEYDOWN, ord('E'), 0)
            # SendMessage(hwndChild, WM_KEYDOWN, ord('E'), 0)
            SendMessage(hwnd_current, WM_CHAR, ord('e'),
                        0 + (0 << 8) + (ord('e') << 16) + (0 << 24))
            # keyboard.press_and_release('e')
            time.sleep(0.05)

        frequency = 2000
        duration = 100
        winsound.Beep(frequency, duration)
Esempio n. 2
0
File: input.py Progetto: hulucc/xiv
    def key_press(key, delay=300):
        key_code = KEY_MAP.get(key.lower())
        hwnd = _get_hwnd()

        SendMessage(hwnd, WM_KEYDOWN, key_code, 0)
        time.sleep(delay / 1000)
        SendMessage(hwnd, WM_KEYUP, key_code, 0)
Esempio n. 3
0
def click(window_name, button: str, coords: tuple):
    window = FindWindow(None, window_name)
    coords = MAKELONG(coords[0], coords[1])
    try:
        state, hold, release = BUTTONS[button]
    except KeyError:
        raise Exception(
            'Argument invalid, correct ones are: left, right, middle')
    SendMessage(window, hold, state, coords)
    SendMessage(window, release, 0, coords)
Esempio n. 4
0
File: input.py Progetto: hulucc/xiv
 def click():
     hwnd = _get_hwnd()
     SendMessage(hwnd, WM_RBUTTONDOWN, MK_RBUTTON, 0)
     x, y = 200, 200
     for _ in xrange(10):
         lparam = y << 16 | x
         x += 200
         y += 200
         SendMessage(hwnd, WM_MOUSEMOVE, MK_RBUTTON, lparam)
     SendMessage(hwnd, WM_RBUTTONUP, MK_RBUTTON, 0)
Esempio n. 5
0
    def library_query_get_next_file(self):
        """
        :rtype: str
        """
        hwnd = self.find_hwnd()

        lr = SendMessage(hwnd, WM_USER, MBC_Library_QueryGetNextFile, 0)

        r = unpack_s(lr)

        SendMessage(hwnd, WM_USER, MBC_FreeLRESULT, lr)

        return r
Esempio n. 6
0
    def get_downloaded_artwork_url(self):
        """
        :rtype: str
        """
        hwnd = self.find_hwnd()

        lr = SendMessage(hwnd, WM_USER, MBC_GetDownloadedArtworkUrl, 0)

        r = unpack_s(lr)

        SendMessage(hwnd, WM_USER, MBC_FreeLRESULT, lr)

        return r
Esempio n. 7
0
    def now_playing_list_query_get_next_file(self):
        """
        :rtype: str
        """
        hwnd = self.find_hwnd()

        lr = SendMessage(hwnd, WM_USER, MBC_NowPlayingList_QueryGetNextFile, 0)

        r = unpack_s(lr)

        SendMessage(hwnd, WM_USER, MBC_FreeLRESULT, lr)

        return r
Esempio n. 8
0
    def get_artist_picture_thumb(self):
        """
        :rtype: str
        """
        hwnd = self.find_hwnd()

        lr = SendMessage(hwnd, WM_USER, MBC_GetArtistPictureThumb, 0)

        r = unpack_s(lr)

        SendMessage(hwnd, WM_USER, MBC_FreeLRESULT, lr)

        return r
Esempio n. 9
0
    def playlist_query_get_all_files(self):
        """
        :rtype: str
        """
        hwnd = self.find_hwnd()

        lr = SendMessage(hwnd, WM_USER, MBC_Playlist_QueryGetAllFiles, 0)

        r = unpack_s(lr)

        SendMessage(hwnd, WM_USER, MBC_FreeLRESULT, lr)

        return r
Esempio n. 10
0
    def playlist_query_get_next_playlist(self):
        """
        :rtype: str
        """
        hwnd = self.find_hwnd()

        lr = SendMessage(hwnd, WM_USER, MBC_Playlist_QueryGetNextPlaylist, 0)

        r = unpack_s(lr)

        SendMessage(hwnd, WM_USER, MBC_FreeLRESULT, lr)

        return r
Esempio n. 11
0
    def get_downloaded_lyrics(self):
        """
        :rtype: str
        """
        hwnd = self.find_hwnd()

        lr = SendMessage(hwnd, WM_USER, MBC_GetDownloadedLyrics, 0)

        r = unpack_s(lr)

        SendMessage(hwnd, WM_USER, MBC_FreeLRESULT, lr)

        return r
Esempio n. 12
0
    def get_artwork(self):
        """
        :rtype: str
        """
        hwnd = self.find_hwnd()

        lr = SendMessage(hwnd, WM_USER, MBC_GetArtwork, 0)

        r = unpack_s(lr)

        SendMessage(hwnd, WM_USER, MBC_FreeLRESULT, lr)

        return r
Esempio n. 13
0
    def get_file_url(self):
        """
        :rtype: str
        """
        hwnd = self.find_hwnd()

        lr = SendMessage(hwnd, WM_USER, MBC_GetFileUrl, 0)

        r = unpack_s(lr)

        SendMessage(hwnd, WM_USER, MBC_FreeLRESULT, lr)

        return r
Esempio n. 14
0
    def get_plugin_version_str(self):
        """
        :rtype: str
        """
        hwnd = self.find_hwnd()

        lr = SendMessage(hwnd, WM_USER, MBC_PluginVersion, 0)

        r = unpack_s(lr)

        SendMessage(hwnd, WM_USER, MBC_FreeLRESULT, lr)

        return r
Esempio n. 15
0
    def window_get_size(self):
        """
        :rtype: list of 2 int
        """
        hwnd = self.find_hwnd()

        lr = SendMessage(hwnd, WM_USER, MBC_Window_GetSize, 0)

        r = unpack_ii(lr)

        SendMessage(hwnd, WM_USER, MBC_FreeLRESULT, lr)

        return r
Esempio n. 16
0
    def now_playing_list_get_list_file_url(self, index):
        """
        :param index:
        :type index: int
        :rtype: str
        """
        hwnd = self.find_hwnd()

        lr = SendMessage(hwnd, WM_USER, MBC_NowPlayingList_GetListFileUrl, index)

        r = unpack_s(lr)

        SendMessage(hwnd, WM_USER, MBC_FreeLRESULT, lr)

        return r
Esempio n. 17
0
    def setting_get_field_name(self, field):
        """
        :param field:
        :type field: MBMetaData
        :rtype: str
        """
        hwnd = self.find_hwnd()

        lr = SendMessage(hwnd, WM_USER, MBC_Setting_GetFieldName, field)

        r = unpack_s(lr)

        SendMessage(hwnd, WM_USER, MBC_FreeLRESULT, lr)

        return r
Esempio n. 18
0
    def get_artist_picture(self, fading_percent):
        """
        :param fading_percent:
        :type fading_percent: int
        :rtype: str
        """
        hwnd = self.find_hwnd()

        lr = SendMessage(hwnd, WM_USER, MBC_GetArtistPicture, fading_percent)

        r = unpack_s(lr)

        SendMessage(hwnd, WM_USER, MBC_FreeLRESULT, lr)

        return r
Esempio n. 19
0
    def get_file_tag(self, field):
        """
        :param field:
        :type field: MBMetaData
        :rtype: str
        """
        hwnd = self.find_hwnd()

        lr = SendMessage(hwnd, WM_USER, MBC_GetFileTag, field)

        r = unpack_s(lr)

        SendMessage(hwnd, WM_USER, MBC_FreeLRESULT, lr)

        return r
Esempio n. 20
0
    def get_file_property(self, file_property):
        """
        :param file_property:
        :type file_property: MBFileProperty
        :rtype: str
        """
        hwnd = self.find_hwnd()

        lr = SendMessage(hwnd, WM_USER, MBC_GetFileProperty, file_property)

        r = unpack_s(lr)

        SendMessage(hwnd, WM_USER, MBC_FreeLRESULT, lr)

        return r
Esempio n. 21
0
    def now_playing_list_query_files_ex(self, query):
        """
        :param query:
        :type query: str
        :rtype: list of str
        """
        hwnd = self.find_hwnd()

        lr = SendMessage(hwnd, WM_COPYDATA, MBC_NowPlayingList_QueryFilesEx, pack_s(query))

        r = unpack_sa(lr)

        SendMessage(hwnd, WM_USER, MBC_FreeLRESULT, lr)

        return r
Esempio n. 22
0
    def library_get_artist_picture_thumb(self, artist_name):
        """
        :param artist_name:
        :type artist_name: str
        :rtype: str
        """
        hwnd = self.find_hwnd()

        lr = SendMessage(hwnd, WM_COPYDATA, MBC_Library_GetArtistPictureThumb, pack_s(artist_name))

        r = unpack_s(lr)

        SendMessage(hwnd, WM_USER, MBC_FreeLRESULT, lr)

        return r
Esempio n. 23
0
    def playlist_get_name(self, playlist_url):
        """
        :param playlist_url:
        :type playlist_url: str
        :rtype: str
        """
        hwnd = self.find_hwnd()

        lr = SendMessage(hwnd, WM_COPYDATA, MBC_Playlist_GetName, pack_s(playlist_url))

        r = unpack_s(lr)

        SendMessage(hwnd, WM_USER, MBC_FreeLRESULT, lr)

        return r
Esempio n. 24
0
    def get_soundtrack_picture_urls(self, local_only):
        """
        :param local_only:
        :type local_only: bool
        :rtype: list of str
        """
        hwnd = self.find_hwnd()

        lr = SendMessage(hwnd, WM_USER, MBC_GetSoundtrackPictureUrls, int(local_only))

        r = unpack_sa(lr)

        SendMessage(hwnd, WM_USER, MBC_FreeLRESULT, lr)

        return r
Esempio n. 25
0
def drag(window_name: str, coords: tuple, to_y: int):
    """Window_name: The name of the emulator window without the version
    coords: mouse cordinates from where the scroll should start (x, y)
    to_y: maximum y range that scroll should stop."""
    x, y = coords
    window = FindWindow(None, window_name)
    coords = MAKELONG(coords[0], coords[1])
    SendMessage(window, 0x201, 0x0001, coords)

    while y < to_y:
        y += 1
        coords = MAKELONG(x, y)
        SendMessage(window, 0x200, 0x0001, coords)
        sleep(0.001)
    SendMessage(window, 0x202, 0, coords)
Esempio n. 26
0
    def library_query_get_lookup_table_value(self, key):
        """
        :param key:
        :type key: str
        :rtype: str
        """
        hwnd = self.find_hwnd()

        lr = SendMessage(hwnd, WM_COPYDATA, MBC_Library_QueryGetLookupTableValue, pack_s(key))

        r = unpack_s(lr)

        SendMessage(hwnd, WM_USER, MBC_FreeLRESULT, lr)

        return r
Esempio n. 27
0
    def playlist_query_files_ex(self, playlist_url):
        """
        :param playlist_url:
        :type playlist_url: str
        :rtype: list of str
        """
        hwnd = self.find_hwnd()

        lr = SendMessage(hwnd, WM_COPYDATA, MBC_Playlist_QueryFilesEx, pack_s(playlist_url))

        r = unpack_sa(lr)

        SendMessage(hwnd, WM_USER, MBC_FreeLRESULT, lr)

        return r
Esempio n. 28
0
 def playlist_query_files(self, playlist_url):
     """
     :param playlist_url:
     :type playlist_url: str
     :rtype: MBError
     """
     return SendMessage(self.find_hwnd(), WM_COPYDATA, MBC_Playlist_QueryFiles, pack_s(playlist_url))
Esempio n. 29
0
 def now_playing_list_query_files(self, query):
     """
     :param query:
     :type query: str
     :rtype: MBError
     """
     return SendMessage(self.find_hwnd(), WM_COPYDATA, MBC_NowPlayingList_QueryFiles, pack_s(query))
Esempio n. 30
0
 def playlist_get_type(self, playlist_url):
     """
     :param playlist_url:
     :type playlist_url: str
     :rtype: MBPlaylistFormat
     """
     return SendMessage(self.find_hwnd(), WM_COPYDATA, MBC_Playlist_GetType, pack_s(playlist_url))