Packaging use pyinstaller - F - w
Specific code is as follows:
` ` `
# fo=open (r "C: \ Users \ \ Desktop Liang Liang beam \ 123. TXT", "r", encoding="utf-8")
The import pyautogui
Pyautogui. FAILSAFE=True # safety switch
Anquans=[] # security extract data
Anquan=open (r "C: \ Users \ start \ Desktop \ security. TXT", "r", encoding="utf-8") # read security configuration file
# anquan=open (r "C: \ Users \ \ Desktop Liang Liang beam \ security. TXT", "r", encoding="utf-8")
For the line in anquan:
The line=line. Replace (" \ n ", "")
Anquans. Append (a list (map (eval, line. The split (", "))))
Anquan. Close () # close security configuration file
C=1 # main program loop preparing
For a in range (len (anquans)) : each line # traversal
For b in the range (len (anquans [a])) : # iterate through each row of each element
If (anquans [a] [b]=='pause interval) :
Pyautogui. PAUSE=anquans [a] [b + 1] # PAUSE interval
If (anquans [a] [b]=='execution times') :
C=anquans [a] [b + 1]
Def yidong1 () : # move
# print (' mobile ')
Pyautogui. MoveTo (datals a + [1], [I] datals [a + 2], [I] duration=0.25)
Def shubiaozuodanji2 () : # click
# print (' danji)
Pyautogui. Click ()
Def shubiaoyoudanji3 () : # right-click
# print (' youji)
Pyautogui. RightClick ()
Def shubiaoshuangji4 () : # double-click
# print (' shuangji)
Pyautogui. DoubleClick ()
Def jianpanshuru5 () : # enter
# print (' shuru)
Pyautogui. Typewrite (datals [I] a + [1])
Def jianpananjian6 () : # function keys
# print (a)
Pyautogui. Press (datals [I] a + [1])
Def shubiaozhongji7 () : # middle mouse button
# print (' zhongji)
Pyautogui. MiddleClick ()
Def shubiaogunlun8 () : # mouse wheel
# print (' zhongji)
Pyautogui. Scroll (datals [I] a + [1]) # it only accepts an integer, if the value is positive roll up, roll down value is negative,
Def zuhejian9 () : # mouse wheel
# print (' zhongji)
Pyautogui. Hotkey (datals a + [1], [I] datals [I] [a] + 2) # key combination
Def default () : # function to be executed by the default
"' e=2 + 1
Press the mouseDown () and pop-up mouseUp ()
Drag and drop dragTo () and dragRel (), its parameters and moveTo () and moveRel (),
KeyDown () : press a key, keyUp () : a release button, press () : a full keystroke, the combination of the two functions in front of the
"'
The switch={' 1 ': yidong1, # note here do not add parentheses
'2' : shubiaozuodanji2, # note here do not add parentheses
'3' : shubiaoyoudanji3, # note here don't add brackets
'4' : shubiaoshuangji4, # note here don't add brackets
'5' : jianpanshuru5, # note here do not add parentheses
'6' : jianpananjian6,
'7' : shubiaozhongji7,
'8' : shubiaogunlun8,
'9' : zuhejian9,
}
Datals=[] # extract data
F=open (r "C: \ Users \ start \ Desktop \ execution flow. TXT", "r", encoding="utf-8")
# f=open (r "C: \ Users \ \ Desktop Liang Liang beam \ execution flow. TXT", "r", encoding="utf-8")
For the line in f:
The line=line. Replace (" \ n ", "")
Datals. Append (a list (map (eval, line. The split (", "))))
F. lose ()
# print (datals)
For d in range (c) :
For I in range (len (datals) : each line # traversal
For a in range (len (datals [I])) : # iterate through each row of each element
# print (datals [I] [a])
Choice=datals [I] [a] # for choosing
Switch. The get (choice, default) (#) to perform the corresponding function, if there is no will perform a default function
` ` `
CodePudding user response:
Pyinstaller - F - c packaging, see what wrong execution report