fir*_*ion 3 png windows-7 adobe-fireworks file-extension
我希望.fw.png以 Adobe Fireworks结尾的文件打开,但我希望.png在我的标准图像查看器程序中打开常规文件。
这可能吗?
使用AutoIt 脚本,以下应该执行您想要的操作:
$FIREWORKS = "C:/Program Files/Fireworks.exe"
$NORMALVWR = "C:/WindowsPictureViewer.exe"
If $CmdLine[0] > 0 Then
$toRun = ""
$fExt = StringRight($CmdLine[1], 7)
; First, we set $toRun as the proper target program to run.
If StringLen($CmdLine[1]) >= 7 And _
StringRight($fExt, 4) = ".png" And _
StringLeft(StringRight($fExt, 7), 3) = ".fw" Then
$toRun = $FIREWORKS
Else
$toRun = $NORMALVWR
EndIf
; Next, we append all command line arguments (with a space before each one).
For $i = 1 To $CmdLine[0]
$toRun &= ' "' & $CmdLine[$i] & '"' ; We surround each with quotation marks.
Next
; Finally, run the command in the current working directory.
Run($toRun, @WorkingDir)
; Since the Run() function is asynchronous, this program should close right after.
EndIf
Run Code Online (Sandbox Code Playgroud)
为了使这项工作适用于您的情况,您需要将顶部的这些常量更改为您想要启动的正确可执行文件。然后,安装 AutoIt,并将脚本编译为 .EXE 文件。将其放置在修道院位置,并设置 Windows 以使用此可执行文件打开 .PNG 文件。
我还没有测试过这段代码,但看起来它应该可以正常工作。仅供参考,编译后的程序将执行以下操作:
检查第一个参数(如果存在)是否以 .fw.png 结尾(假设您只以 .PNG 开头运行可执行文件)。如果是,则启动 Fireworks 可执行文件,否则启动普通查看器。
然后将所有命令行参数再次添加为相应应用程序的参数。
该应用程序通过 AutoItRun()函数在当前工作目录中调用。
如果有足够多的人感兴趣,我可以创建一个完整的程序来为任意一组(嵌套的)文件扩展名执行此操作。
| 归档时间: |
|
| 查看次数: |
883 次 |
| 最近记录: |