1
+ import psutil
2
+ from pypresence import Presence
3
+ import time
4
+
5
+
6
+ def checkprocess (targetname ):
7
+ for proc in psutil .process_iter ():
8
+ try :
9
+ if targetname .lower () in proc .name ().lower ():
10
+ return True
11
+ except (psutil .NoSuchProcess , psutil .AccessDenied ,
12
+ psutil .ZombieProcess ):
13
+ pass
14
+ return False
15
+
16
+ if __name__ == "__main__" :
17
+
18
+ print ("Started." )
19
+ DebugRunning = False
20
+ StandaloneRunning = False
21
+ RPCRun = False
22
+ TYPE = "Unknown"
23
+ VERSION = "Unknown"
24
+
25
+ client_id = '1013717821122936873' # Fake ID, put your real one here
26
+ RPC = Presence (client_id )
27
+ fpd = "flashplayer_32_sa_debug.exe"
28
+ fp = "flashplayer.exe"
29
+ while True : # The presence will stay on as long as the program is running
30
+ time .sleep (4 )
31
+
32
+ if checkprocess (fpd ) == True :
33
+ print ("Found Debug Build" )
34
+ TYPE = "Debug"
35
+ if DebugRunning == False and RPCRun == False :
36
+ RPC .connect ()
37
+ RPCRun = True
38
+ # RPC.update(state="Idle", details="Not Quite Dead Yet.", large_image="afp32_big", large_text=f"Version {VERSION} ({TYPE})")
39
+ DebugRunning = True
40
+ else :
41
+ print ("Debug Build Not Found" )
42
+ if DebugRunning == True and RPCRun == True :
43
+ DebugRunning = False
44
+ if StandaloneRunning == False and RPCRun == True :
45
+ RPCRun = False
46
+ RPC .close ()
47
+
48
+ if checkprocess (fp ) == True :
49
+ print ("Found Standalone Build" )
50
+ TYPE = "Standard"
51
+ if StandaloneRunning == False and RPCRun == False :
52
+ RPC .connect ()
53
+ RPCRun = True
54
+ # RPC.update(state="Idle", details="Not Quite Dead Yet.", large_image="afp32_big", large_text=f"Version {VERSION} ({TYPE})")
55
+ StandaloneRunning = True
56
+ else :
57
+ print ("Standalone Build Not Found" )
58
+ if StandaloneRunning == True and RPCRun == True :
59
+ StandaloneRunning = False
60
+ if DebugRunning == False and RPCRun == True :
61
+ RPCRun = False
62
+ RPC .close ()
63
+
64
+ if DebugRunning == True and StandaloneRunning == True :
65
+ TYPE = "Multiple Running"
66
+ if RPCRun == True :
67
+ RPC .update (state = "Idle" , details = "Not Quite Dead Yet." , large_image = "afp32_big" , large_text = f"Version { VERSION } ({ TYPE } )" )
0 commit comments