gpt4 book ai didi

com - AHK COM 保存时通过文件路径传递变量

转载 作者:行者123 更新时间:2023-12-01 16:14:33 29 4
gpt4 key购买 nike

我希望文件保存为使用用户在开头输入的变量 STYLE。

我还需要帮助将数据发送到打印数量可变的打印机。

从这里开始我需要帮助:

ComObjActive("Word.Application").ActiveDocument.SaveAs("L:\10. 2016\TKT Issued\"%Style%")

请查看下面的代码,了解我已有的代码。

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.

F12::
Gui, Add, Text,, Please enter Style:
Gui, Add, Edit, vStyle
Gui, Add, Text,, Please enter Price:
Gui, Add, Edit, vPrice
Gui, Add, Text,, Please enter Docket Number:
Gui, Add, Edit, vDocket
Gui, Add, Text,, Please enter Page Quantity:
Gui, Add, Edit, vPages
Gui, Add, Button, default, OK
Gui, Show,, Cutting Ticket Producer
return


GuiClose:
ButtonOK:
Gui, Submit
MsgBox You entered Style: %Style%, Price: %Price%, Docket Number: %Docket% and%Pages% Pages. Data will be sent to printer.


MSWordMultiReplace("STYLE",Style, "PRICE", Price, "DKT", Docket)

MSWordMultiReplace(params*) { ; by Learning one

oWord := ComObjCreate("Word.Application")
a:="L:\10. 2016\TKT Issued\TEMPLATE.doc"
oWord.Documents.Open(a)
oWord.Selection.Find.ClearFormatting
oWord.Selection.Find.Replacement.ClearFormatting
For k,v in Params
{
c++
if (c = 1)
{
st := v
continue
}
rt := v, c := 0
oWord.Selection.Find.Execute(st, 0, 0, 0, 0, 0, 1, 1, 0, rt, 2)
}
ComObjActive("Word.Application").ActiveDocument.SaveAs("L:\10. 2016\TKT Issued\"%Style%")


ExitApp
}
Reload

最佳答案

尝试:

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.

F12::
Gui, Add, Text,, Please enter Style:
Gui, Add, Edit, vStyle
Gui, Add, Text,, Please enter Price:
Gui, Add, Edit, vPrice
Gui, Add, Text,, Please enter Docket Number:
Gui, Add, Edit, vDocket
Gui, Add, Text,, Please enter Page Quantity:
Gui, Add, Edit, vPages
Gui, Add, Button, default, OK
Gui, Show,, Cutting Ticket Producer
return


GuiClose:
ButtonOK:
Gui, Submit
MsgBox You entered Style: %Style%, Price: %Price%, Docket Number: %Docket% and%Pages% Pages. Data will be sent to printer.


MSWordMultiReplace("STYLE",Style, "PRICE", Price, "DKT", Docket)

MSWordMultiReplace(params*) { ; by Learning one

oWord := ComObjCreate("Word.Application")
a:="L:\10. 2016\TKT Issued\TEMPLATE.doc"
oWord.Documents.Open(a)
oWord.Selection.Find.ClearFormatting
oWord.Selection.Find.Replacement.ClearFormatting
For k,v in Params
{
c++
if (c = 1)
{
st := v
continue
}
if (k == 2)
Style := v

rt := v, c := 0
oWord.Selection.Find.Execute(st, 0, 0, 0, 0, 0, 1, 1, 0, rt, 2)
}
oWord.ActiveDocument.SaveAs("L:\10. 2016\TKT Issued\" Style)


ExitApp
}
Reload

关于com - AHK COM 保存时通过文件路径传递变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39392844/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com