EXCEL VBA调用adobe的api识别电子PDF发票里内容并登记台账

EXCEL VBA调用adobe的api识别电子PDF发票里内容并登记台账

实现效果如上
代码如下


使用须知:
1、工具--引用里勾选[Adobe Acrobat 10.0 Type Library]
2、安装Adobe Acrobat pro软件Dim sht As Worksheet
Function BrowseFolders() As String  '浏览目录Dim objshell As ObjectDim objFolder As ObjectSet objshell = CreateObject("Shell.Application")Set objFolder = objshell.BrowseForFolder(0, "请指定发票文件所在的文件夹", 0, 0)BrowseFolders = ""If Not objFolder Is Nothing ThenBrowseFolders = objFolder.Self.PathEnd IfSet objFolder = NothingSet objshell = Nothing
End FunctionSub cmd_getpdf_Click()Dim Pth As String '文件路径Dim PDFName As String, Wapp As Object, Mstr As StringApplication.ScreenUpdating = False'============================================Pth = BrowseFoldersIf Pth = "" ThenPth = Sheet1.Range("A9").TextEnd IfIf Pth = "" ThenPth = ThisWorkbook.PathEnd IfIf Right(Pth, 1) <> "\" Then Pth = Pth & "\"Sheet1.Range("A8") = "上次路径:"Sheet1.Range("A9") = PthSheet1.Range("a15:a10000") = ""If Dir(Pth & "*.pdf") = "" ThenMsgBox "指定目录没有找到发票PDF文件!"Sheet1.Range("A9") = ""Exit SubEnd If'Debug.Print Pth'============================================For Each sht In ThisWorkbook.SheetsApplication.DisplayAlerts = FalseIf sht.Name = "发票资料读取到Excel" Then sht.DeleteApplication.DisplayAlerts = TrueNextSet sht = Worksheets.Add(, Worksheets(Sheets.Count))sht.Name = "发票资料读取到Excel"sht.Range("A1:J1") = Array("发票号码", "发票日期", "货物或*名称", "规格型号", "单位", "数量", "单价", "金额", "税率", "税额")'============================================定义表头字段PDFName = Dir(Pth & "*.pdf")Do While PDFName <> ""Call Imp_Into_XL(Pth & PDFName)PDFName = DirLoopsht.Columns.AutoFitMsgBox "操作完成!"'============================================Application.ScreenUpdating = True
End SubSub Imp_Into_XL(PDF_File As String)Dim AC_PD As Acrobat.AcroPDDocDim AC_Hi As Acrobat.AcroHiliteListDim AC_PG As Acrobat.AcroPDPageDim AC_PGTxt As Acrobat.AcroPDTextSelectDim Yes_Fir As BooleanDim Ct_Page As LongDim i As Long, j As Long, k As Long, m As IntegerDim T_Str As StringDim Hld, XL, Brr(), RowNo%, Arr As Variant, sss%Dim Hld_Txt As VariantDim FPHM As String   '发票号码Dim FPRQ As String   '发票日期Dim GGXH As String   '规格型号Dim HWMC As String   '货物名称Dim SL_SV As String  '数量-税率Dim SL_SV_Temp As String  '数量-税率的临时存变量Dim HWDW As String   '货物单位Dim SL As String     '数量Dim DW As String     '单位Dim XH As String     '型号'====================================================定义字段类型Set AC_PD = New Acrobat.AcroPDDocSet AC_Hi = New Acrobat.AcroHiliteListAC_Hi.Add 0, 32767With AC_PD.Open PDF_FileCt_Page = .GetNumPagesIf Ct_Page = -1 ThenMsgBox "请确认发票文件 '" & PDF_File & "'".CloseGoTo h_endEnd IfFor i = 1 To 1 ' Ct_Page    '只考虑一个文档有一张发票的情形T_Str = ""Set AC_PG = .AcquirePage(i - 1)Set AC_PGTxt = AC_PG.CreateWordHilite(AC_Hi)If Not AC_PGTxt Is Nothing ThenWith AC_PGTxtFor j = 0 To .GetNumText - 1T_Str = T_Str & .GetText(j)Next jEnd WithEnd If'==========================================================If T_Str <> "" ThenHld_Txt = Split(T_Str, vbCrLf)FPHM = "": FPRQ = "":: GGXH = "": HWMC = ""For j = 0 To UBound(Hld_Txt)If InStr(Hld_Txt(j), "年月日") = 0 ThenIf InStr(Hld_Txt(j), "年") > 0 And InStr(Hld_Txt(j), "月") > 0 And InStr(Hld_Txt(j), "日") > 0 Then   '当字符串里含有年月日时Hld_Txt(j) = Repce2(Hld_Txt(j))Hld_Txt(j) = Trim(Replace(Hld_Txt(j), "开票日期:", ""))            '如果有"开票日期:"几个字,将其替换掉FPRQ = Left(Hld_Txt(j), 4) & "-" & Mid(Hld_Txt(j), 6, 2) & "-" & Mid(Hld_Txt(j), 9, 2)Exit ForEnd IfEnd IfNext jFor j = 0 To UBound(Hld_Txt)If TestNumber(Hld_Txt(j)) Then   '测试是否含有数字并以数字结尾的类型,加以判断If Len(Hld_Txt(j)) = 10 And TestCH(Hld_Txt(j)) = False Then '当字符串里没有年月日,但是以"2023 06 30"有空格,共有10个字符串位置形式存在时取得发票日期If InStr(Hld_Txt(j), " ") > 0 And UBound(Split(Hld_Txt(j), " ")) > 0 ThenFPRQ = "'" & RegR(Hld_Txt(j))    '取得发票日期Exit ForEnd IfEnd IfEnd IfNext jFor j = 0 To UBound(Hld_Txt)If TestNumber(Hld_Txt(j)) Then   '测试是否含有数字并以数字结尾的类型,加以判断Hld_Txt(j) = Trim(Replace(Hld_Txt(j), "发票号码:", ""))            '如果有"发票号码:"几个字,将其替换掉If Len(Hld_Txt(j)) = 8 Or Len(Hld_Txt(j)) = 20 Then          '//***限定要取出的发票号码为8位或者20位数字,否则发票号码取不出来If IsNumeric(Hld_Txt(j)) ThenIf InStr(Hld_Txt(j), ".") = 0 And InStr(Hld_Txt(j), ChrW(165)) = 0 ThenFPHM = Regs(Hld_Txt(j)) '取得8位或者20位的发票号码Exit ForEnd IfEnd IfEnd IfEnd IfNext jk = 0For j = 0 To UBound(Hld_Txt)If Len(Trim(Hld_Txt(j))) > 2 Then        '//***当字符数大于2,有的只有一个*,这种情形需要排除If Left(Trim(Hld_Txt(j)), 1) = "*" Or InStr(Hld_Txt(j), "详见") > 0 Then  '////当货物名称前面第一个字符是*号或者含有(详见)时Arr = Array("+", "<", ">")   '/***密码区有许多有这几个符号,遇到了就避开它sss = 0For m = LBound(Arr) To UBound(Arr)               '//***避免遇到密码区以*号开头,并且有Arr数组里符号的情形If InStr(Hld_Txt(j), Arr(m)) > 0 Then sss = sss + 1Next mIf sss = 0 ThenHld_Txt(j) = Trim(Hld_Txt(j))                '清除前后空格Hld_Txt(j) = StrConv(Hld_Txt(j), vbNarrow)   '全角转为半角Hld_Txt(j) = Repce(Hld_Txt(j))               '将字符串中多个空格变成一个If InStr(Hld_Txt(j), "%") > 0 Or Right(Trim(Hld_Txt(j)), 1) = "*" ThenFor m = UBound(Split(Hld_Txt(j), " ")) To 0 Step -1If TestCHNum(Split(Hld_Txt(j), " ")(m)) = False Or Trim(Split(Hld_Txt(j), " ")(m)) = "*" Then   '循环判定,取出有数字的数量-税额部分//有部分的金额和税额是*号If TestCH(Split(Hld_Txt(j), " ")(m)) = True And InStr(Hld_Txt(j), "不征税") = 0 Then Exit ForSL_SV = Split(Hld_Txt(j), " ")(m) & " " & SL_SVSL_SV_Temp = Split(Hld_Txt(j), " ")(m) & " " & SL_SV_Temp       '增加这个变量,存下原始的数量金额部分If InStr(SL_SV, "不征税") > 0 And Len(SL_SV) > 3 Then SL_SV = Left(SL_SV, InStr(SL_SV, "税")) & " " & Right(SL_SV, Len(SL_SV) - InStr(SL_SV, "税"))SL_SV = Trim(SL_SV)SL_SV_Temp = Trim(SL_SV_Temp)If m < UBound(Split(Hld_Txt(j), " ")) And Split(Hld_Txt(j), " ")(m) < 0 Then Exit ForElseIf TestCHNum(Split(Hld_Txt(j), " ")(m)) = True Then    '循环判定,如含有中文+数字,则需拆分SL_SV = RegSL(Split(Hld_Txt(j), " ")(m)) & " " & SL_SVSL_SV_Temp = RegSL(Split(Hld_Txt(j), " ")(m)) & " " & SL_SV_TempSL_SV = Trim(SL_SV)SL_SV_Temp = Trim(SL_SV_Temp)Exit ForEnd IfNext mSL_SV = Repce(SL_SV): SL_SV_Temp = Repce(SL_SV_Temp)  '用原始的数量金额部分来方便取出GGXHGGXH = Trim(Replace(Hld_Txt(j), SL_SV_Temp, ""))  '去掉数量-税额部分,下余的是规格型号   ////***前面做过变动后,这里用replace取不出余下的规格型号SL_SV_Temp = ""SL_SV = SL_JE(SL_SV)                         '数量-税额部分,不能用trim去掉前面空格If InStr(GGXH, "费") > 0 ThenHWMC = Left(GGXH, InStr(GGXH, "费"))         '货物名称,有费字的取费字前面字符(含费字)作为货物名称GGXH = Trim(Replace(GGXH, HWMC, ""))         '费字后面的是规格型号+单位ElseIf InStr(GGXH, " ") = 0 ThenHWMC = GGXH: GGXH = ""                   '规格型号没有包含空格时,货物名称就取ggxh,将原来的ggxh置空ElseHWMC = Split(GGXH, " ")(0)               '规格型号有包含空格时,货物名称取ggxh的第一个空格前的字符GGXH = Trim(Replace(GGXH, HWMC, ""))     '规格型号取除了货物名称后的余下的值End IfEnd IfIf InStr(GGXH, " ") = 0 Then          '当规格型号没有空格时********Select Case Len(GGXH)Case Is = 0                    '当费后面的字符数量为0时If Split(SL_SV, " ")(0) = "" Then     '当数据部分第一个字符为空时,货物名称就只为货物名称HWMC = HWMC & " " & " "Else                                '当数据部分第一个字符不为空时,货物名称取最后一个值为单位,次一个值为规格型号If Mid(HWMC, Len(HWMC) - 1, 2) = "服务" Or InStr(HWMC, "费") > 0 ThenHWMC = HWMC & " " & " "                '当货物名称最后两个字是"服务"时或含有"费",已经不能拆开了.ElseIf InStr(HWMC, "费") = 0 ThenDW = Right(HWMC, 1)                      '取右边一位做单位*****XH = Mid(HWMC, Len(HWMC) - 1, 1)HWMC = Left(HWMC, Len(HWMC) - 2)If InStr(HWMC, XH & DW) > 0 Or InStr(HWMC, XH) > 0 Or InStr(HWMC, DW) > 0 ThenHWMC = HWMC & XH & DW & " " & " "ElseHWMC = HWMC & " " & XH & " " & DWEnd IfEnd IfEnd IfCase Is >= 1                   '当费后面的字符数量为1或者大于1时DW = Right(GGXH, 1)                         '取右边一位做单位XH = Replace(GGXH, DW, "")               '余下的是型号If Split(SL_SV, " ")(0) = "" ThenHWMC = HWMC & " " & " "ElseIf XH <> "" ThenHWMC = HWMC & " " & XH & " " & DWElseHWMC = HWMC & " " & " " & DWEnd IfEnd IfEnd SelectElseIf InStr(GGXH, " ") > 0 Then       '当规格型号有空格时If Split(SL_SV, " ")(0) <> "" ThenHWDW = Split(GGXH, " ")(UBound(Split(GGXH, " ")))     '单位If Len(HWDW) > 1 ThenHWDW = Right(HWDW, 1)GGXH = Replace(GGXH, HWDW, "")GGXH = Replace(GGXH, " ", "_")HWMC = HWMC & " " & GGXH & " " & HWDWElseXH = Trim(Replace(GGXH, HWDW, ""))             '规格型号If XH = "" ThenIf Len(HWDW) > 1 ThenDW = Right(HWDW, 1)XH = Replace(HWDW, DW, "")HWMC = HWMC & " " & XH & " " & DWElseIf Len(HWDW) = 1 ThenHWMC = HWMC & " " & " " & DWEnd IfElseDW = HWDWXH = Trim(Replace(XH, " ", "_"))                 '去掉规格型号中的空格,用下横线连接HWMC = HWMC & " " & XH & " " & DWEnd IfEnd IfElseIf Split(SL_SV, " ")(0) = "" ThenXH = Replace(GGXH, " ", "_")                 '去掉规格型号中的空格,用下横线连接HWMC = HWMC & " " & XH & " "                 '没有单位,要加上表示单位的空格End IfEnd IfElseIf UBound(Split(Hld_Txt(j), " ")) <= 2 And InStr(Hld_Txt(j), "%") = 0 Then           '当品名与数量金额等不在同一行时HWMC = Hld_Txt(j)For m = j To UBound(Hld_Txt)If InStr(Hld_Txt(m), "%") > 0 Then SL_SV_Temp = Hld_Txt(m): Exit ForNext mFor m = UBound(Split(SL_SV_Temp, " ")) To 0 Step -1If TestCHNum(Split(SL_SV_Temp, " ")(m)) = False Or Trim(Split(SL_SV_Temp, " ")(m)) = "*" Then   '循环判定,取出有数字的数量-税额部分//有部分的金额和税额是*号If TestCH(Split(SL_SV_Temp, " ")(m)) = True And InStr(SL_SV_Temp, "不征税") = 0 Then Exit ForSL_SV = Split(SL_SV_Temp, " ")(m) & " " & SL_SV       '增加这个变量,存下原始的数量金额部分If InStr(SL_SV, "不征税") > 0 And Len(SL_SV) > 3 Then SL_SV = Left(SL_SV, InStr(SL_SV, "税")) & " " & Right(SL_SV, Len(SL_SV) - InStr(SL_SV, "税"))SL_SV = Trim(SL_SV)If m < UBound(Split(SL_SV_Temp, " ")) And Split(SL_SV_Temp, " ")(m) < 0 Then Exit ForElseIf TestCHNum(Split(SL_SV_Temp, " ")(m)) = True Then    '循环判定,如含有中文+数字,则需拆分SL_SV = RegSL(Split(SL_SV_Temp, " ")(m)) & " " & SL_SVSL_SV = Trim(SL_SV)Exit ForEnd IfNext mSL_SV_Temp = Replace(SL_SV_Temp, SL_SV, "")SL_SV = Repce(SL_SV) '用原始的数量金额部分来方便留下GGXHGGXH = Trim(Replace(SL_SV_Temp, SL_SV, ""))  '去掉数量-税额部分,下余的是规格型号   ////***前面做过变动后,这里用replace取不出余下的规格型号If Len(GGXH) = 0 Then         '当规格型号为空时DW = Split(HWMC, " ")(UBound(Split(HWMC, " ")))HWMC = Trim(Replace(HWMC, DW, ""))XH = Trim(Replace(HWMC, Split(HWMC, " ")(0), " "))HWMC = Trim(Replace(HWMC, XH, ""))If InStr(HWMC, " ") > 0 Then HWMC = Replace(HWMC, " ", "_")    '将货物名称里原有的空格用下划线代替If InStr(XH, " ") > 0 Then XH = Replace(XH, " ", "_")          '将型号里原有的空格用下划线代替If Len(XH) > 0 ThenHWMC = HWMC & " " & XH & " " & DWElseHWMC = HWMC & " " & " " & DWEnd IfElseIf Len(GGXH) > 0 Then                        '当规格型号不为空时If InStr(HWMC, " ") > 0 Then HWMC = Replace(HWMC, " ", "_")    '将货物名称里原有的空格用下划线代替If InStr(GGXH, " ") > 0 ThenDW = Split(GGXH, " ")(UBound(Split(GGXH, " ")))   '单位XH = Trim(Replace(SL_SV_Temp, DW, ""))                     '型号If InStr(XH, " ") > 0 Then XH = Replace(XH, " ", "_")          '将型号里原有的空格用下划线代替If Len(XH) > 0 ThenHWMC = HWMC & " " & XH & " " & DWElseHWMC = HWMC & " " & " " & DWEnd IfElseDW = Right(GGXH, 1)                      '取右边一位做单位*****XH = Replace(GGXH, DW, "")HWMC = HWMC & " " & XH & " " & DWEnd IfEnd IfEnd IfIf Split(SL_SV, " ")(0) = "" Then     '///*****************Hld_Txt(j) = HWMC & SL_SVElseHld_Txt(j) = HWMC & " " & SL_SVEnd IfHWMC = "": SL_SV = "":   SL = "": DW = "": XH = "": GGXH = "": HWDW = "": SL_SV_Temp = ""If UBound(Split(Hld_Txt(j), " ")) = 7 Thenk = k + 1ReDim Preserve Brr(1 To 10, 1 To k)Brr(1, k) = "'" & FPHM: Brr(2, k) = FPRQ       '编号及日期For m = 0 To UBound(Split(Hld_Txt(j), " "))Brr(3 + m, k) = Split(Hld_Txt(j), " ")(m)Next mElseGoTo 0End IfEnd IfEnd IfEnd IfNext jWith shtIf k = 0 Then GoTo 0RowNo = .Cells(65536, 1).End(3).Row + 1.Cells(RowNo, 1).Resize(UBound(Brr, 2), UBound(Brr)) = Application.Transpose(Brr)'  .Cells(RowNo, 11) = PDF_File              '将文件名称放在最后一列Erase BrrEnd WithElseIf T_Str = "" Then
0MsgBox PDF_File & "文件没有取到数据,请检查!", vbOKOnly, "ExcelHome"Sheet1.Cells(Sheet1.Cells(65536, 1).End(3).Row + 1, 1) = PDF_File    '将有问题的文件名称放在sheet1表中,方便查验Exit ForEnd If'===========================================================Next i.CloseEnd Withh_end:Set AC_PGTxt = NothingSet AC_PG = NothingSet AC_Hi = NothingSet AC_PD = Nothing
End Sub
Function Regs(STR)        '取发票号码
Dim reg As Object, mh As VariantSet reg = CreateObject("VBScript.RegExp")With reg.Global = True.Pattern = "(^\d{8}$|^\d{20}$)"    '是8位或者是20位Set mh = .Execute(STR)Regs = mh.Item(0).SubMatches.Item(0)End With
End Function
Function RegR(STR)        '取发票日期
Dim reg As Object, mh As VariantSet reg = CreateObject("VBScript.RegExp")With reg.Global = True.Pattern = "(^\d{4} \d{2} \d{2}$)"    '前四位年,中两位月,后两位日Set mh = .Execute(STR)RegR = Replace(mh.Item(0).SubMatches.Item(0), " ", "-")End With
End Function
Function RegSL(STR)        '取数量
Dim reg As Object, mh As VariantSet reg = CreateObject("VBScript.RegExp")With reg.Global = True'.Pattern = "[\u4e00-\u9fff](\d+\.\d+|\d+)"    '中文后面跟的数量为小数或整数.Pattern = "[\u4e00-\u9fff]([-]?\d+\.\d+$|[-]?\d+$)"    '中文后面跟的数量为小数或整数Set mh = .Execute(STR)RegSL = mh.Item(0).SubMatches.Item(0)End With
End Function
Function TestNumber(STR)        '测试是否最后是数字
Dim reg As ObjectSet reg = CreateObject("VBScript.RegExp")With reg.Global = True.Pattern = "^\d+\.\d+$|\d+$"TestNumber = .test(STR)End With
End Function
Function TestCH(STR)        '测试是否以中文开始
Dim reg As ObjectSet reg = CreateObject("VBScript.RegExp")With reg.Global = True.Pattern = "[\u4e00-\u9fff]+"TestCH = .test(STR)End With
End Function
Function TestCHNum(STR)        '测试是否以中文后跟随数字
Dim reg As ObjectSet reg = CreateObject("VBScript.RegExp")With reg.Global = True.Pattern = "[\u4e00-\u9fff]([-]?\d+\.\d+$|[-]?\d+$)"TestCHNum = .test(STR)End With
End Function
Public Function Repce(STR)        '多个空格变成一个
With CreateObject("VBSCRIPT.REGEXP").Global = True.Pattern = "\s+"Repce = .Replace(STR, " ")
End With
End Function
Public Function Repce2(STR)        '去掉中间空格
With CreateObject("VBSCRIPT.REGEXP").Global = True.Pattern = "\s+"Repce2 = .Replace(STR, "")
End With
End Function
Public Function SL_JE(STR)        '处理数量金额这部分Dim i%, str_tempSelect Case UBound(Split(STR, " "))Case Is >= 5For i = UBound(Split(STR, " ")) To UBound(Split(STR, " ")) - 4 Step -1str_temp = Split(STR, " ")(i) & " " & str_tempNext iSL_JE = Trim(str_temp)Case 4SL_JE = STRCase 2SL_JE = "   " & STREnd Select
End Function

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.rhkb.cn/news/245343.html

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Unity之动画和角色控制

目录 &#x1f4d5; 一、动画 1.创建最简单的动画 2.动画控制器 &#x1f4d5;二、把动画和角色控制相结合 &#x1f4d5;三、实现实例 3.1 鼠标控制角色视角旋转 3.2 拖尾效果 &#x1f4d5;四、混合动画 最近学到动画了&#xff0c;顺便把之前创建的地形&#xff0…

服务器运维小技巧(二)——如何进行监控告警

服务器运维难度高的原因&#xff0c;很大程度是因为服务器一旦出现问题&#xff0c;生产环境的业务就会受到严重影响&#xff0c;极有可能带来难以承担的后果。因此这份工作要求工程师保持高要求的服务质量&#xff0c;能够快速响应问题&#xff0c;及时解决问题。 但是“及时…

【数据结构】 双链表的基本操作 (C语言版)

目录 一、双链表 1、双链表的定义&#xff1a; 2、双链表表的优缺点&#xff1a; 二、双链表的基本操作算法&#xff08;C语言&#xff09; 1、宏定义 2、创建结构体 3、双链表的初始化 4、双链表表插入 5、双链表的查找 6、双链表的取值 7、求双链表长度 8、双链表…

【视频媒体】深入了解直播视频流

深入了解直播视频流&#x1f3a5; YouTube、TikTok live和Twitch上的直播视频是如何工作的&#xff1f; 直播视频流与常规流媒体不同&#xff0c;因为视频内容通过互联网近乎实时发送&#xff0c;通常只有几秒钟的延迟。 下图解释了实现这一目标背后所发生的事情。 步骤1&…

Numpy入门

Numpy入门 前言1. Numpy介绍2. Numpy中的array3. Numpy怎么对数组按照索引进行查询5. Numpy常用的random随机函数6. Numpy的数学统计函数7. Numpy计算数组中满足条件元素的个数8. Numpy怎样给数组增加一个维度&#xff08;转置&#xff09;9. Numpy非常重要的数据合并操作10. N…

[设计模式Java实现附plantuml源码~创建型] 多态工厂的实现——工厂方法模式

前言&#xff1a; 为什么之前写过Golang 版的设计模式&#xff0c;还在重新写Java 版&#xff1f; 答&#xff1a;因为对于我而言&#xff0c;当然也希望对正在学习的大伙有帮助。Java作为一门纯面向对象的语言&#xff0c;更适合用于学习设计模式。 为什么类图要附上uml 因为很…

k8s图形化管理工具之rancher

前言 在前面的k8s基础学习中&#xff0c;我们学习了各种资源的搭配运用&#xff0c;以及命令行&#xff0c;声明式文件创建。这些都是为了k8s管理员体会k8s的框架&#xff0c;内容基础。在真正的生产环境中&#xff0c;大部分的公司还是会选用图形化管理工具来管理k8s集群&…

人工智能时代:让AIGC成为你的外部智慧源(文末送书)

&#x1f308;个人主页&#xff1a;聆风吟 &#x1f525;系列专栏&#xff1a;数据结构、网络奇遇记 &#x1f516;少年有梦不应止于心动&#xff0c;更要付诸行动。 文章目录 &#x1f4cb;前言一. 什么是AIGC?二. AIGC如何运作&#xff1f;2.1 步骤一&#xff1a;收集数据2.…

爬虫是什么 怎么预防

爬虫是一种自动化程序&#xff0c;用于从网页或网站中提取数据。它们通过模拟人类用户的行为&#xff0c;发送HTTP请求并解析响应&#xff0c;以获取所需的信息。 爬虫可以用于各种合法用途&#xff0c;如搜索引擎索引、数据采集和监测等。然而&#xff0c;有些爬虫可能是恶意的…

【Fooocus 深度学习】SDXL,AIGC生图,源码解读

文章目录 使用通配符增加prompt多样性Fooocus的风格实现 使用通配符增加prompt多样性 prompt和negative_prompt都可以通过apply_wildcards函数来实现通配符替换&#xff0c;apply_wildcards会从txt中随机找一个出来。 promptsunshine, river, trees, __artist__ task_prompt …

固态硬盘优化设置

目录 前言&#xff1a; 关闭Windows Search 禁用系统保护&#xff08;不建议&#xff09; 不建议禁用系统保护原因 关闭碎片整理 提升固态硬盘速度 开启TRIM 合理使用固态硬盘的容量 正确关机 关闭开机自启 前言&#xff1a; 电脑配备固态硬盘就能一劳永逸吗&#…

docker 安装python3.8环境镜像并导入局域网

一、安装docker yum -y install docker docker version #显示 Docker 版本信息 可以看到已经下载下来了 拉取镜像python3镜像 二、安装docker 中python3环境 运行本地镜像&#xff0c;并进入镜像环境 docker run -itd python-38 /bin/bash docker run -itd pyth…

Qt-QFileDialog保存文件及获取带扩展名的文件名

正确用法 QFileDialog dialog(this, "Save File", QDir::currentPath(), "Text Files (.txt)"); dialog.setAcceptMode(QFileDialog::AcceptSave); dialog.setDefaultSuffix("txt"); // << if (!dialog.exec())return; QString fileName …

uniapp 用css animation做的鲤鱼跃龙门小游戏

第一次做这种小游戏&#xff0c;刚开始任务下来我心里是没底的&#xff0c;因为我就一个‘拍黄片’的&#xff0c;我那会玩前端的动画啊&#xff0c;后面尝试写了半天&#xff0c;当即我就给我领导说&#xff0c;你把我工资加上去&#xff0c;我一个星期给你做出来&#xff0c;…

【嵌入式学习】网络通信基础-项目篇:简单UDP聊天室

源码已在GitHub开源&#xff1a;0clock/LearnEmbed-projects/chat 实现的功能 客户端功能&#xff1a; 上线发送登录的用户名[yes] 发送消息和接收消息[yes] quit退出 服务器端功能&#xff1a; 统计用户上线信息&#xff0c;放入链表中[yes] 接收用户信息并给其他用户发送消…

Scapy编程指南(基础概念)

Scapy编程指南&#xff08;基础概念&#xff09; Scapy是什么 Scapy是Python中一个非常强大的库&#xff0c;它专门用于处理、发送和捕获网络协议中的数据包&#xff0c;它允许开发人员通过Python代码构建、解析和发送自定义网络协议的数据包。Scapy提供了一种直观、灵活的方…

k8s---包管理器helm

内容预知 目录 内容预知 helm相关知识 Helm的简介与了解 helm的三个重要概念 helm的安装和使用 将软件包拖入master01上 使用 helm 安装 Chart 对chart的基本使用 查看chart信息 安装chart 对chart的基本管理 helm自定义模板 在镜像仓库中拉取chart&#xff0c;查…

【操作系统】实验七 显示进程列表

&#x1f57a;作者&#xff1a; 主页 我的专栏C语言从0到1探秘C数据结构从0到1探秘Linux &#x1f618;欢迎关注&#xff1a;&#x1f44d;点赞&#x1f64c;收藏✍️留言 &#x1f3c7;码字不易&#xff0c;你的&#x1f44d;点赞&#x1f64c;收藏❤️关注对我真的很重要&…

深度学习记录--Momentum gradient descent

Momentum gradient descent 正常的梯度下降无法使用更大的学习率&#xff0c;因为学习率过大可能导致偏离函数范围&#xff0c;这种上下波动导致学习率无法得到提高&#xff0c;速度因此减慢(下图蓝色曲线) 为了减小波动&#xff0c;同时加快速率&#xff0c;可以使用momentum…

数据结构(数组)

一.数组的概念 1. 数组定义 数组(Array)是一种线性结构。它用一组连续的内存空间&#xff0c;来存储一组具有相同数据类型的数据。 2. 数组的特点 ①用来存储一组类型相同的数据。 ②在内存中&#xff0c;分配连续的空间&#xff0c;数组创建时需要指定容量。因为数组为了保持内…