Posts: 16
Threads: 1
Joined: Jul 2009
Hello...i`m kinda nub when it comes to QM...
I would like to ask a few questions...well here they are..
First i want to make a "counter" that will do like next:
print numbers in a text field like notepad and type the numbers in order like:
1
2
3
4
5
6
7
...
I tried to make it but i just couldn`t get it
I tried like:
wait 0 KF (VK_F1)
int j
int i; str s
for j 0 50
for i 0 20
key "i"
wait 0 KF (VK_F1)
int j
int i+1
for j 0 50
key "i"
But it just wont work...i know im a newbie...so plz help =)))
The second thing i wanna ask is..
How can i press by "sendkeys" or "key (...)" a backspace button?
I couldn`t wind a way anywhere...
And the third thing a wanna ask is how can i multi my actions like do key left 8 times
but to not use:
key (VK_LEFT)
key (VK_LEFT)
key (VK_LEFT)
key (VK_LEFT)
key (VK_LEFT)
key (VK_LEFT)
key (VK_LEFT)
key (VK_LEFT)
???
Thanks =)
Posts: 12,073
Threads: 140
Joined: Dec 2002
To use variables with key, enclose in (). Also it must be a string variable.
Macro Macro1170
int i
for i 0 20
,str s=i
,key (s) Y
or
Macro Macro1170
str k=""
int i
for i 0 20
,str s=i
,k.addline(s)
key (k)
;or
outp k
----------------------------------
backspace is
key B
or
key (VK_BACK)
You can record.
-------------------------------
rep(8) key (VK_LEFT)
Posts: 16
Threads: 1
Joined: Jul 2009
Hmmm...i kinda got it but i cant make my macro work...this is my macro:
Macro
,,,wait 0 KF (VK_F1) ;;wait for F1 to be pressed
,,key (VK_UP) ;;go the line up
,,key (VK_RETURN) ;;make a new line
,,key "Start" ;;type in "Start"
,,key (VK_DOWN) ;;go back to line down
,,,,int i
,,,,,,,int j
,,,,str s=i
,for j 0 40 ;;(how much times!!!!)
,,key (VK_HOME) ;;go to start of the line
,,key "bla =)" ;;type "bla =)"
,,key (VK_END) ;; Go to the end of the line
,,key "some text" (s)". bla" ;;type in "some text 1. bla"
,,key (VK_DOWN) ;;go to next line and repeat 40 times
I want to get something like this:
Start
bla =)TEXTEXTEXTEXTsome text 1 bla
bla =)TEXTEXTEXTEXTsome text 2 bla
bla =)TEXTEXTEXTEXTsome text 3 bla
bla =)TEXTEXTEXTEXTsome text 4 bla
bla =)TEXTEXTEXTEXTsome text 5 bla
bla =)TEXTEXTEXTEXTsome text 6 bla
....
bla =)TEXTEXTEXTEXTsome text 40 bla
and i don`t know if its possible to add a text after those 40 lines...like:
bla =)TEXTEXTEXTEXTsome text 39 bla
bla =)TEXTEXTEXTEXTsome text 40 bla
End!
Posts: 16
Threads: 1
Joined: Jul 2009
Can i get my answer? please...
Posts: 85
Threads: 16
Joined: Aug 2009
The codes that Gintaras presented for you, work perfectly fine!
I took your macro and used what Gintaras wrote and it worked
perfectly! Read what he wrote and use it! It works good for me! :wink:
Posts: 12,073
Threads: 140
Joined: Dec 2002
Maybe number of tabs is incorrect in some places. In QM, tabs at line beginning are important. They are used with rep, for, if and some other control flow keywords, and should not be used where not needed. Read in QM help.
Posts: 16
Threads: 1
Joined: Jul 2009
Can someone just repair my script and post it...?
Cause i cant find a way to put together my and Gintaras script together...
Posts: 16
Threads: 1
Joined: Jul 2009
Posts: 85
Threads: 16
Joined: Aug 2009
Do what gintaras said! Dont expect us to do your work for you! Afterall, this is just a help forum! Not a forum where you expect us to do things for you! It's also a good idea to learn this stuff and figure it out
Posts: 16
Threads: 1
Joined: Jul 2009
I figured it out but
int i
for i 1 (n)
str s=i
this part is bugged i want to go 1,2,3,4.... not 0,1,2,3,4.... how to do that?
And why this isnt working on your script:
str n
if(!inp(n "Input number of parts" "Bounty part adder")) ret
int i
for i 1 (n)
, str s=i
key "text" (s) "text"
Just this and i wont bore you anymore =)
Posts: 16
Threads: 1
Joined: Jul 2009
Can ya help in this? please....
Posts: 858
Threads: 196
Joined: Apr 2005
Macro Macro5
Trigger CSu
str n
if(!inp(n "Input number of parts" "Bounty part adder")) ret
;
int i ifinal=val(n)
for i 1 ifinal+1
,str s=i
,key "bla =)TEXTEXTEXTEXTsome text " (s) " bla" Y
key "text after..." Y
s=i
key "bla =)TEXTEXTEXTEXTsome text " (s) " bla" Y
Posts: 16
Threads: 1
Joined: Jul 2009
Wow...that helped me alot... but im sooooo confusied...could you please make my script work...
This is the original:
,,wait 0 KF (VK_F1)
,,key (VK_UP)
,,key (VK_RETURN)
,,key "<start>"
,,key (VK_DOWN)
,,,,,,,int j
,for j 0 7 ;;number of copies
,,key (VK_HOME)
,,key "text1-"
,,key (VK_END)
,,key "-text 1 text"
,,key (VK_DOWN)
this script gives this:
<start>
text1-this is some text-text 1 text
text1-this is some text-text 1 text
text1-this is some text-text 1 text
text1-this is some text-text 1 text
text1-this is some text-text 1 text
text1-this is some text-text 1 text
text1-this is some text-text 1 text
in witch i have to add on the end <end> and to change all numbers like 1,2,3,4,5,6,7.
Could you make my script do this:
<start>
text1-this is some text-text 1 text
text1-this is some text-text 2 text
text1-this is some text-text 3 text
text1-this is some text-text 4 text
text1-this is some text-text 5 text
text1-this is some text-text 6 text
text1-this is some text-text 7 text
<end>
Without my edit?
I tried everything...hah you don`t wanna see my failed works xD i just can`t make it...
Without my edit?
pleeeaaaaassseeeee =)
Posts: 41
Threads: 10
Joined: Jun 2008
You may want to look into setwintext that way it will know what window to put the text into. Like this...
Function Function4
Trigger F11
str b c s
b="<end>"
str k="<start>"
int i
for i 1 8
,s.format("text1-this is some text-text %i text" i)
,k.addline(s)
c.from(k b)
c.setwintext(id(15 "Notepad"))
or you can do it with key but you will prolly want to act the window to paste the words
Function Function4
Trigger F1
key "<start>"
key Y
int j
str s
for j 1 8
,s.format("text1-this is some text-text %i text" j)
,key (s)
,key Y
key "<end>"
or
Function Function4
Trigger F11
key "<start>"
key Y
str k=""
int i
for i 1 8
,str s
,s.format("text1-this is some text-text %i text" i)
,k.addline(s)
key (k)
key "<end>"
Posts: 16
Threads: 1
Joined: Jul 2009
Omg...u don`t get it....the script must wait for F1 to begin,the "this is some text" is a text that already exist in notepad.All i need is to add "text1-" in front of the line and on the end "-text [number] text". that is why VK_END and VK_HOME are for...Also i need:
str n
if(!inp(n "Input" "test")) ret
to define (s):
"bla =)TEXTEXTEXTEXTsome text " (s) " bla"
and that same command to define how much times i want it to repeat...
Your scripts are damn awesome but in every you are missing some of these...:/
Maybe i don`t know how to explain...i need this it means a lot....
Just to mention
,,, wait 0 KF (VK_F1)
,,,,, str t
,,if(!inp(t "Input text" "some text xD")) ret
,,, key (VK_UP)
,,key (VK_RETURN)
,,key "<start>"
,,key (VK_DOWN)
,,int i
,for i 1 16
, str s=i
,,key (VK_HOME)
,,key "text="
,,key (VK_END)
,,key "="(t)" "(s)"some text"
,,key (VK_DOWN)
This works perfect...but it`s missing an input script and at the end of the script and text key "<end>"...but i dont know how to make that...
Posts: 16
Threads: 1
Joined: Jul 2009
Posts: 85
Threads: 16
Joined: Aug 2009
Newbie! Listen to me! Look back a few comments where Gintaras posted your solutions! He will not answer you again because he's already provided you with the correct formula! I know! I've tested it my self and i know what your trying to accomplish! It took me 10 minutes to get it what you want it to to! So do not ask me for the code! How ever, use the code Gintaras provided for you as it works perfectly! Also, try using, Getwintxt or Setwintxt,()
Posts: 16
Threads: 1
Joined: Jul 2009
I don`t wanna cause trouble i just want to make my script work and as you can see my nick name is newbie what tells you that that i am a beginner at scripting QM and all i need is a minute or two of your time to make me that script cause i can look whole day and night and still not find the answer in posts above.....cause as i said i`m a beginner......
........if you can`t help me at least tell me who can....
Posts: 12,073
Threads: 140
Joined: Dec 2002
It probably does not work because you use tabs incorrectly. Try to create the macro again from the beginning. In small steps. At first create something simpler. Run, see how it works. Then add more code, again run, see how it works. Read a little in qm help about if, rep, for, and how tabs are used with them. Also read about key. You will have to learn it anyway, others will not write simple macros for you.
Posts: 16
Threads: 1
Joined: Jul 2009
I must tab correctly cause when i run my macro it shows it like an error....i spent whole night figuring this out and i finnaly did...Just i`m missing this part....how to add a key "" command AFTER the counting finishes when value s reaches value i?
I have gone trough all of this scripts and still didn`t find my answer...
Posts: 12,073
Threads: 140
Joined: Dec 2002
Lucas and crip showed how to do it.
Posts: 16
Threads: 1
Joined: Jul 2009
Hi hi hi,it seams that ive miss that spot
Got almost all my answers...just i wonder could i make an exe out of this?
Posts: 12,073
Threads: 140
Joined: Dec 2002
Posts: 16
Threads: 1
Joined: Jul 2009
I tried to do this but it says that "wait 0 KF (VK_F1)" function don`t work in .exe okay i erased it...but i don`t know what is .res file and witch one to specify...can ya help me outa this one? xP
Posts: 12,073
Threads: 140
Joined: Dec 2002
res is optional, as well as any other changes in the Make Exe dialog
Posts: 16
Threads: 1
Joined: Jul 2009
Posts: 12,073
Threads: 140
Joined: Dec 2002
Don't change anything in the Make Exe dialog, maybe only exe name an path.
Posts: 16
Threads: 1
Joined: Jul 2009
Thank you all very much...you helped me to understand some basic and non basic things about QM.
I managed to make my script work perfectly. Thanks =)
Posts: 85
Threads: 16
Joined: Aug 2009
I noticed that if you put everything that your macro requires into a folder, it works but if its all spread apart, it may still work but some parts may not! I've had that problem BUT if your having a problem making that file an .exe file, exe may not be compadable of what you've created i assume.
|