vbscript

ISO week number in VBScript or VBA

↘锁芯ラ 提交于 2020-02-24 11:29:27
问题 How can I get the ISO week number of some date in VBScript or VBA? 回答1: First, note that: It is important to report the week year along with the week number, as the date's year could be different. Several Windows components contain a bug for some years' last Monday. In my experience the simplest, clearest and most robust way to compute this is: Sub WeekNum(someDate, isoWeekYear, isoWeekNumber, isoWeekDay) Dim nearestThursday isoWeekDay = WeekDay(someDate, vbMonday) nearestThursday = DateAdd(

Say USB path without letter (vbs)

℡╲_俬逩灬. 提交于 2020-02-23 07:09:10
问题 I am writing a piece of VBScript in which I want to Save a file (say, notepad) into my USB Stick. To do so, I am using AppActive and SendKeys "^s" which will pop up a window asking for the path. The problem is I don't know what letter will my USB have on certain computers. On mine, it's E, but on my friend's PC it is G (anyway, irrelevant). Is there a way to say the path without including the letter? I named my usb "USB" and simply tried to write the path without the letter. It works for my

Decryption function gives wrong result with special characters

浪子不回头ぞ 提交于 2020-02-21 05:33:05
问题 I'm building an encryption/decryption function in VBScript / Classic ASP. It all works as long as the string to be encrypted/decrypted does not contain special characters. ' str = "Bayern München" ' key = "ab34ehyd67hy6752daskjh" Function EncryptString(val, key) valLen = Len(val) keyLen = Len(key) keyPos = 1 newVal = "" revVal = val For x = 1 To valLen calc = AscW(Mid(revVal, x, 1)) + AscW(Mid(key, keyPos, 1)) 'Response.Write ":" & AscW(Mid(revVal, x, 1)) & " + " & AscW(Mid(key, keyPos, 1)) &

Run any file with vbs at a specific time

半城伤御伤魂 提交于 2020-02-15 06:45:08
问题 Is it possible to run any type of file (like,. mp3, doc, exe..) with a Vbscript file at a specific time? I looked in many places but there were no success.. 回答1: Give a try for this example that can schedule Notepad to be executed everyday at 10:00 AM So, you need just to modify those 3 arguments in this script to yours : TaskName App_FullPath strTime Option Explicit Dim TaskName,App_FullPath,strTime TaskName = "Execute_Notepad" App_FullPath = "C:\windows\notepad.exe" strTime = "10:00" Call

Run any file with vbs at a specific time

纵然是瞬间 提交于 2020-02-15 06:45:05
问题 Is it possible to run any type of file (like,. mp3, doc, exe..) with a Vbscript file at a specific time? I looked in many places but there were no success.. 回答1: Give a try for this example that can schedule Notepad to be executed everyday at 10:00 AM So, you need just to modify those 3 arguments in this script to yours : TaskName App_FullPath strTime Option Explicit Dim TaskName,App_FullPath,strTime TaskName = "Execute_Notepad" App_FullPath = "C:\windows\notepad.exe" strTime = "10:00" Call

vbs学习,书籍,看书笔记(5) 客户端web脚本 .Power shell 使用 脚本文件的类型2

心已入冬 提交于 2020-02-13 17:27:52
只需要使用 script标签 就可以使用脚本,可以放在任意位置,一般放在< head>标签中 现在已经不能使用vbs 导航 1.javaScritpt ,vbScript认识 2.Power shell 使用 3.脚本文件的类型2 4.wscript对象 ———————————————————————————————————————— 1.javaScritpt ,vbScript认识 javaScritpt: vbScript : 对于现在vbs在网页上使用: 新版IE之所以不再支持VBScript,就是因为微软已经放弃把VBScript作为前端脚本了,它已经改邪归正彻底向标准浏览器(Chrome、FireFox等)靠拢了。Javascript已经是事实上的唯一的网页前端脚本语言了。你现在最佳的解决办法就是尽快把原VBScript代码转为javascript,如果要继续抱着VBScript不放,那就只能用你不愿意听的办法,就是退回去使用老版本的IE(IE6~IE10)了。除此之外,真没别的办法了,即使有(比如模拟器),那速度也肯定会让你有以头撞墙的冲动! 看到这里,有点慌哈哈,继续先看完书再说 一小段html < html > < head > < title > A sample page < / title > < style > body { margin : 0 ;

Disable “Make new folder” in Select Folder Dialog

冷暖自知 提交于 2020-02-07 07:47:50
问题 I'm making a script that uses the dialog box below to select the folder where this run commands the problem is that it is not necessary as an option to create a new folder ... I wonder how can I remove the "make new folder"? My Code: Option Explicit Dim strPath strPath = SelectFolder( "" ) If strPath = vbNull Then WScript.Echo "Cancelled" Else WScript.Echo "Selected Folder: """ & strPath & """" End If Function SelectFolder( myStartFolder ) ' Standard housekeeping Dim objFolder, objItem,

Cannot execute external vb script from Java program through Jenkins Slave setup

浪尽此生 提交于 2020-02-07 07:30:14
问题 Through Jenkins - Slave setup (running in Windows), we have created a ANT job which in internally calls the below JAVA Program, String[] command = {"cmd" , "/c", System.getProperty("user.dir")+"/Read_email/ReadEmail.vbs"}; Process p = Runtime.getRuntime().exec(command); System.out.println("Process Completed"); The ReadEmail.vbs file never gets called or executed. There is no error message or warning getting generated. When I run this java program from eclipse or through Master Jenkinks, VB

Cannot execute external vb script from Java program through Jenkins Slave setup

拥有回忆 提交于 2020-02-07 07:26:05
问题 Through Jenkins - Slave setup (running in Windows), we have created a ANT job which in internally calls the below JAVA Program, String[] command = {"cmd" , "/c", System.getProperty("user.dir")+"/Read_email/ReadEmail.vbs"}; Process p = Runtime.getRuntime().exec(command); System.out.println("Process Completed"); The ReadEmail.vbs file never gets called or executed. There is no error message or warning getting generated. When I run this java program from eclipse or through Master Jenkinks, VB

How can I reformat a date stored as a string in VB?

冷暖自知 提交于 2020-02-06 11:14:16
问题 I have a date (11/1/2012) stored as a string variable called "sTemp". I want to assign this date to the string variable LessOfFiveDates in the format yyyyMMdd. I've been trying variants of the following code, but it's not working. How can I reformat this so it will create the desired output? If IsDate(sTemp) Then dtTemp = CDate(sTemp) LessOfFiveDates = CStr(Format(dtTemp, "yyyyMMdd")) Else 回答1: You supplied your own solution, upvotes for that! In your other question, you asked for an elegant