473,387 Members | 1,420 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

VB macro help

hey im trying to make something so it presses spacebar in game for me so i don't have to. i previously got this from somewhere else and tried to change it so it worked with the game i started playing.

here is the first script

'-----------------
intHighNumber = 10
intLowNumber = 5
x = 0
wow="World of Warcraft"

Set ws = WScript.CreateObject("Wscript.Shell")
ws.AppActivate wow
buff_timer1=Timer
While x < 100
Randomize
y = Int((intHighNumber - intLowNumber + 1) * Rnd + intLowNumber)
ws.AppActivate wow
ws.Sendkeys ("e")
' x = x+1
buff_timer2=Timer
If buff_timer2-buff_timer1 >= 500 Then
ws.AppActivate wow
ws.Sendkeys ("q")
Else
End If
WScript.Sleep(y*1000)
Wend
'--------------------

okay everything works fine with that and so i try to change it so spacebar gets pressed and more often but i come to a problem. first the script

The script i tried making off of the first one

'-----------------
intHighNumber = 10
intLowNumber = 5
x = 0
mu="Mu"

Set ms = MScript.CreateObject("Mscript.Shell")
ms.AppActivate mu
buff_timer1=Timer
While x < 25
Randomize
y = Int((intHighNumber - intLowNumber + 1) * Rnd + intLowNumber)
ms.AppActivate mu
ms.Sendkeys (" ")
' x = x+1
buff_timer2=Timer
If buff_timer2-buff_timer1 >= 125 Then
ms.AppActivate mu
ms.Sendkeys (" ")
Else
End If
MScript.Sleep(y*250)
Mend
'--------------------

now when i run it, it does this

Windows Script Host
Script: C:\Documents and Settings\Default\Desktop\loot.vbs
Line: 24
Char: 22
Error: Expected 'Wend'
Code 800A03FA
Source: Microsoft VBScript compilation error

i tried doing some stuff but nothing works, can anyone help me?>
Jun 5 '06 #1
2 4890
I can only assume that you made a typo on the last line as you have "Mend" instead of "Wend"
Jan 25 '07 #2
actually it looks like you messed up Wscript to Mscript as well as ws to ms
I program in a different language and have NEVER touched a Microsoft language since the original mbasic back in the late 70's but I do work with for, do & while loops all the time.
Jan 25 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

25
by: Andrew Dalke | last post by:
Here's a proposed Q&A for the FAQ based on a couple recent threads. Appropriate comments appreciated X.Y: Why doesn't Python have macros like in Lisp or Scheme? Before answering that, a...
2
by: Pete | last post by:
In Access 95/97 I used to be able to create pull down menus (File,Edit ...) from a macro. It seems there used to be some wizard for that. However in Access 2000 it seems you have to build your...
8
by: Nick M | last post by:
Hello All, Excellent info here Thanks! I am very new to using access in general and I am on a learning curve. I'm trying to import an excel workbook (with worksheets) into an access db via a...
10
by: Karim Thapa | last post by:
Why following macro does not work? #define removebrace(x) x void Foo(int a, int b, char *txt, int d, int e); main() {
4
by: Garry Freemyer | last post by:
I'm trying to convert this macro to a c# function but I have a big problem. It's on the LEFT side of an assignment statement and I am extremely flustered over this one because I'm a little rusty...
6
by: Takeadoe | last post by:
Dear NG, Can someone assist me with writing the little code that is needed to run an update table query each time the database is opened? From what I've been able to glean from this group, the...
2
by: Senthil | last post by:
Hi All I need to create an Excel report and create a command button and have to run a macro on the click event that will print all the pages in the Excel workbook. I am able to create the report...
0
by: =?Utf-8?B?TGV0emRvXzF0?= | last post by:
I'd like to create a Macro that will sort some raw data, apprx 20k lines, remove some lines based upon a condition in a certain column. Then copy this data into a new spreadsheet and sort the ...
1
by: skennd | last post by:
Hello, All your help is appreciated in this problem. I am running a macro to execute certain queries and the macro is started to run by a windows task scheduler. However, after the macro runs...
2
by: Stratocaster | last post by:
Hello, and thank you for any help in advance. I need help determining if any commands exist in VB (Excel macro style) that can enable a user to select cells and run a macro which performs...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.