明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1044|回复: 0

能否将下列程序改为非同目录下运行?

[复制链接]
发表于 2009-8-5 21:53:00 | 显示全部楼层 |阅读模式
本帖最后由 作者 于 2009-8-6 8:15:22 编辑

Dim WS, REG, Path, Key, SubKey, Value, el, flag
Set WS = WScript.CreateObject("WScript.Shell")
Path = WS.CurrentDirectory & "\Load.fas"
Set REG = GetObject("winmgmts:\\.\root\default:StdRegProv")
HKCU = &H80000001
HKLM = &H80000002
Key = "Software\Autodesk\AutoCAD"
REG.GetStringValue HKCU, Key, "CurVer", Value
Key = Key & "\" & Value
REG.GetStringValue HKCU, Key, "CurVer", Value
Key = Key & "\" & Value
SubKey = "\Profiles"
REG.GetStringValue HKCU, Key & SubKey, "", Value
SubKey = SubKey & "\" & Value & "\Dialogs\Appload\Startup"
REG.EnumValues HKCU, Key & SubKey, Item, Value
If IsNull(Item) Then
  REG.CreateKey HKCU, Key & SubKey
  REG.SetStringValue HKCU, Key & SubKey, "", "1"
  REG.SetStringValue HKCU, Key & SubKey, "NumStartup", "1"
  REG.SetStringValue HKCU, Key & SubKey, "1Startup", Path
  SubKey = "\Applications\AcadAppload"
  REG.CreateKey HKCU, Key & SubKey
  REG.GetStringValue HKLM, Key & SubKey, "DESCRIPTION", Value
  REG.SetStringValue HKCU, Key & SubKey, "DESCRIPTION", Value
  REG.GetStringValue HKLM, Key & SubKey, "LOADER", Value
  REG.SetStringValue HKCU, Key & SubKey, "LOADER", Value
  REG.GetDWORDValue HKLM, Key & SubKey, "LOADCTRLS", Value
  Value = Value or 2
  REG.SetDWORDValue HKCU, Key & SubKey, "LOADCTRLS", Value
  MsgBox "成功加入自动加载列表!"
Else
  REG.GetStringValue HKCU, Key & SubKey, "", Value
  flag = False
  If Not IsNull(Value) Then
    Item = Value & "Startup"
    REG.GetStringValue HKCU, Key & SubKey, Item, Value
    If UCase(Right(Value,9))="\LOAD.FAS" Then flag = True
  End if
  IF flag Then
    MsgBox "TB Tools 已在自动加载列表中!"
  Else
    REG.GetStringValue HKCU, Key & SubKey, "NumStartup", Value
    Value = CStr(CInt(Value)+1)
    Item = Value & "Startup"
    REG.SetStringValue HKCU, Key & SubKey, "", Value
    REG.SetStringValue HKCU, Key & SubKey, "NumStartup", Value
    REG.SetStringValue HKCU, Key & SubKey, Item, Path
    SubKey = "\Applications\AcadAppload"
    REG.GetDWORDValue HKCU, Key & SubKey, "LOADCTRLS", Value
    Value = Value or 2
    REG.SetDWORDValue HKCU, Key & SubKey, "LOADCTRLS", Value
    MsgBox "成功加入自动加载列表!"
  End if
End if

该程序为本站下载,想改为非同目录下运行,就是如何做到把(指定加载同目录下的Load.fas文件),改为(指定加载不同目录下的Load.fas文件),即我的*.VBS在D:\AA\kk.VBS,而Load.fas在C:\bb\Load.fas.请高手指导,谢谢!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-6 03:05 , Processed in 0.154784 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表