【问题标题】:Updating Folder Path - AutoHotKey更新文件夹路径 - AutoHotKey
【发布时间】:2015-04-20 07:57:14
【问题描述】:

我正试图弄清楚如何更新路径,但我不确定如何去做,而且我不断收到一些错误。

我需要更新显示在 EV 输出上的示例输出。任何帮助都会很棒。

如图所示,输出示例正在更新选定的输入文件夹。我需要它是 EV 输出中的信息。

这是我的菜单代码

;; MENU 
; Left Side Menu
Gui, Add, Button, x7 y7 w110 h30 gInput, Select Input Folder
Gui, Add, Checkbox, x7 y47 w730 h20 checked vCheck1,Include the last folder of the input folder in  the output?
Gui, Add, Text, x22 y82 w600 h20 , Output Sample:
Gui, Add, Text, x132 y82 w610 h20 vDisplayPath, %DisplayPath%  ;--Line needs to match EV Output
Gui, Add, Button, x12 y122 w110 h30 gOutputEV, Select EV Output
Gui, Add, Button, x12 y162 w110 h30 gOutputWC, Select WC Output
Gui, Add, Text, x127 y17 w275 h20 vDisplayInput, ;display selected folder - input
Gui, Add, Text, x132 y132 w250 h20 vDisplayEV, ;display selected folder -ev  <--- Selected to update Display Path
Gui, Add, Text, x132 y172 w250 h20 vDisplayWC, ;display selected folder - wc
Gui, Add, Text, x12 y215 w190 h20 , Last Name, First Name: ; Name Field
Gui, Add, Edit, x171 y215 w170 h30 vName, DoeJohn     ; Editable Name Type
Gui, Add, Text, x12 y250 w190 h30 , Collection Date (YYYYMMDD):
Gui, Add, Edit, x171 y250 w100 h30 r1 vtime,%TimeString%
Gui, Add, Button, x12 y280 w110 h30 gSubmit, Submit
; Right Side Menu
Gui, Add, Text, x757 y7 w130 h20 , Helpful Buttons:
Gui, Add, Button, x757 y77 w160 h30 gOpenTC, List Mounted TrueCrypt Devices
Gui, Add, Button, x757 y37 w160 h30 gMountTC, Auto-Mount TC Devices
Gui, Add, Button, x757 y217 w160 h30 gDismountTC, Dismount ALL TC Devices
; Version Info
Gui, Show, w936 h350, Mobile Robocopy Script v2.5,NoHide
GUI, Add, Picture, x550 y270 w350 h60, %MyPic%
Return

这是我的 EV 代码

OutputEV:
FileSelectFolder,OutputEV,, 3, Select EV Output Directory For Logs
if OutputEV =
   {
   MsgBox, You didn't select a log folder. Try again!
   return
   }
else
Guicontrol,1:,DisplayEV,%OutputEV%

    return

我尝试添加 Guicontrol,1:,DisplayOutPutEV,%DisplayOutPutEV% 之类的内容,但出现错误。我只需要样本输出来匹配 EV 输出,但我无法弄清楚。

任何帮助都会很棒。

【问题讨论】:

  • @fischgeek 我也看不出投票的理由。但是在 stackoverflow 中,恶意的投票很常见。

标签: scripting autohotkey


【解决方案1】:

乍一看,您的问题似乎与这一行有关

Guicontrol,1:,DisplayEV,%OutputEV%

您已经建立了没有标识符的 GUI,购买您正试图与 GUI 1 上不存在的控件对话。删除 GUI 标识符。

GuiControl,, DisplayEV, %OutputEV%

在您的 GUI 中,为您的控件提供不同的变量

Gui, Add, Text, x22 y82 w600 h20 vlblOutputSample, Output Sample:
Gui, Add, Text, x132 y82 w610 h20 vDisplayPath, %DisplayPath%

然后,在您的子例程中,只需将两个控件的文本设置为 OutputEV 变量。

GuiControl,, DisplayEV, %OutputEV%
GuiControl,, lblOutputSample, %OutputEV%

【讨论】:

  • 每当我再次添加 vDisplayEV 时,它都会显示错误:同一变量不能用于多个控件。那么我可以在您修复 GuiControl,, DisplayOutPutEV, %DisplayOutPutEV% 的新行下添加并将其添加到 vDisplayPath, %DisplayPath% 所在的位置吗?
  • 我删除了除 OutputEV 之外的所有 g 标签,运行代码,选择了一个文件夹,它出现在按钮旁边的文本中。所以,它有效。您的错误是由其他原因引起的。重复错误是由于对多个控件具有相同的变量声明。仔细检查您的代码。
  • 我明白这一点。它确实有效。我的意思是我希望样本输出与 EV 输出相同。所以让它显示在2个地方。所以就像在示例图片中一样,我希望输出示例:显示与 EV 输出相同的内容。
  • 我添加到我的答案中。
猜你喜欢
  • 2017-08-13
  • 1970-01-01
  • 1970-01-01
  • 2012-01-27
  • 1970-01-01
  • 1970-01-01
  • 2015-01-15
  • 2012-06-07
  • 1970-01-01
相关资源
最近更新 更多