About
Community
Bad Ideas
Drugs
Ego
Erotica
Fringe
Society
Technology
register | bbs | search | rss | faq | about
meet up | add to del.icio.us | digg it
Go Back   Community > Technology > It came from Redmond
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

It came from Redmond Windows OS tricks, tips, and annoyances. The latest security holes and how to patch them. Server setup, tuning, and hardening.

Reply
 
Thread Tools Display Modes
  #1   Add origamimavin to your ignore list  
Old 2007-12-25, 07:58
origamimavin origamimavin is offline
Regular
 
IL USA Send a message via AIM to origamimavin
Question batch file coding help

how can i send keystrokes in a batch file to something like firefox?

what i'm trying to do is download warez files via rapidshare faster. usually, i copy all the links into a .txt file and then copy them individually into firefox and go through all the steps to download it. i have a premium account, so thats not an issue (and i'm not asking about getting past it). what i'd like to do is copy my list of links into a batch file, then when i click on it, firefox will open, it will go to the website, then it will automatically click the premium button. i figure this would be done by sending a set number of TAB's until it gets to the button and then press ENTER. then it will select the server using the same TAB/ENTER type of code. it will then press enter twice to save the file. then close the window and repeat until about 6 or 7 files are downloading.

i'm not looking for someone to write the batch file, i'm looking for the commands so i can write it myself or if someone can point me in the right direction. i tried google, but can't seem to find exactly what i'm looking for.
Reply With Quote
  #2   Add sonora to your ignore list  
Old 2008-01-02, 15:22
sonora sonora is offline
New Arrival
 
Default Re: batch file coding help

well the simple fact of life is that batch files dont support sending keystrokes you will need to create a visual basic script(vbs) instead its simple enough.

Dim WSHShell
Set WSHShell = WScript.CreateObject("WScript.Shell")

WSHShell.Exec("C:\Program Files\Mozilla Firefox\firefox.exe")

'wscript.sleep just stops the vbs file from executing the next command for however many milliseconds u decide i put 6000 because i am unaware of your processor speeds, hence it gives firefox a chance to open before carrying on
WScript.Sleep 6000

'just fill in the appropriate lines for how many times you need tab and enter, for other characters and keys just google for vbs send keys
WSHShell.SendKeys "{TAB}"
WSHShell.SendKeys "{Enter}"

WScript.Quit

you can make the file in notepad and just save as .vbs with all files as the file type.
hope this helps
Reply With Quote
  #3   Add Rolloffle to your ignore list  
Old 2008-01-03, 08:31
Rolloffle Rolloffle is offline
Regular
 
Default Re: batch file coding help

Thanks sonora!

Checkout what I just made, I had to split things up in an odd manner because VBScript seems to cause errors with strings longer than 1024 characters, but it's still pretty cool.

Code:
Dim WSHShell

Set WSHShell = WScript.CreateObject("WScript.Shell")



WSHShell.Exec("C:\Windows\notepad.exe")



WScript.Sleep 500



Dim s

s = "The day I was born in 1984 was the day that Sandinista Front won the elections in Nicaragua.$$My first memory was my father burning my back with a cigarette. He used to wear an old electrical cord from a box-fan for a belt, and to this day "

s = s & "I have faded scars from the prongs in odd places all over my body, like the two thin lines you see above my right eyebrow.$$When he was really into the sauce, he'd grab me by the neck and add to the burn from that first cigarette. If I "

s = s & "broke a plate, he burned me with a cigarette. If I cried when he beat me, he burned me with a cigarette. If he couldn't steal or beg enough money for booze, I hid, but he always found me, and there was always a lit cigarette waiting.$$"

s = s & "By the time I went to elementary school, there were over 100 burns on my back in the shape of a model Swastika. Our house was right down the road from the YMCA pool, but I never went. He said if I showed the scars to anyone he'd kill my "

s = s & "mother and make me watch, "



Dim t

t = "then kill me. Then he laughed and said he might do it anyway, then he burned me again, I was his canvas.$$The social workers came, but they didn't take me away from him. They saw the bottles all over the house, they saw the track marks "

t = t & "on my mother's arms, bruises on her face, they saw that I was filthy and cut up, and they told my father that I had to go to elementary school. I still don't remember what happened after they left, I don't wanna.$$They tested me and they "

t = t & "were surprised to find that I could read, write, and do math though I'd never been to school. I wasn't, he made my mother teach me to read, and had me read out of Mein Kampf to him and his Nazi friends. God help me if I ever stumbled.$$"

t = t & "I had a little Hitler Youth uniform that he said was priceless, but it was tattered wreck and too small, and I was terrified that a seam would burst or a button would pop in front of his cronies and they'd beat me to death. Once the "

t = t & "armpit of the shirt tore "



Dim u

u = "when I was made the Nazi salute at the end of 'nation and race', but he didn't notice, he was too busy cheering.$$Sometimes he'd point his old Luger at me, and order me to make a speech right there, if I wasn't a race traitor. It's no "

u = u & "suprise that I've always been able to speak off the cuff and that I make all my speeches from memory, thanks dad.$$I learned math from counting "

u = u & "change. He'd send me out to get his liquor and the only place that'd let me buy it tried to jew me every single time. If I came back with a cent "

u = u & "less than the price of his swill the swastika would grow.$$Later, I learned that if I stole the liquor instead I could use the money to eat. "

u = u & "When my mother finally got to strung out to stand in the welfare lines that was all I could get, it was never enough.$$They put me in school, the other kids laughed at me because my clothes "



Dim v

v = "were torn and I stank. After class, I beat the living shit out of them, nobody laughed then. I took "

v = v & "their money, their clothes, everything. Some of the kids were bigger than me, but none of them were hungrier.$$On my tenth birthday, my mother died. I got beaten for it. Him screaming his stale liquor breath in my face how it was all "

v = v & "my fault, pistol whipping me the Luger and threatening to kill me. I remember him pointing the gun at me, cocking it, and I watched his hands shake realizing for the first that my father was a coward. He still beat the living shit "

v = v & "out of me.$$In high school, I pilfered lockers, organized walk-outs, punk rock shows, shop-lifted, covered the town with graffiti, anything. I spent more time in Juvi than out. I was 14 years old when I stole my first car, and it "

v = v & "took every cop in the shit stain of a town to bring me back. I sold weed, broke into houses, anything to keep myself fed. This went on for 6 years until I met Bill Keller, and I learned that I could have more, much more...."



Dim c



c = 1



Dim d



Do While c =< Len(s)

	d = Mid(s,c,1)



	If d = "$" Then

	WSHShell.SendKeys "{Enter}"

	Else

	WSHShell.SendKeys d

	End If

	

	WScript.Sleep 12



	c = c + 1

Loop



c = 1



Do While c =< Len(t)

	d = Mid(t,c,1)



	If d = "$" Then

	WSHShell.SendKeys "{Enter}"

	Else

	WSHShell.SendKeys d

	End If

	

	WScript.Sleep 12



	c = c + 1

Loop



c = 1



Do While c =< Len(u)

	d = Mid(u,c,1)



	If d = "$" Then

	WSHShell.SendKeys "{Enter}"

	Else

	WSHShell.SendKeys d

	End If

	

	WScript.Sleep 12



	c = c + 1

Loop



c = 1



Do While c =< Len(v)

	d = Mid(v,c,1)



	If d = "$" Then

	WSHShell.SendKeys "{Enter}"

	Else

	WSHShell.SendKeys d

	End If

	

	WScript.Sleep 12



	c = c + 1

Loop



WScript.Quit
Reply With Quote
  #4   Add origamimavin to your ignore list  
Old 2008-01-06, 10:12
origamimavin origamimavin is offline
Regular
 
IL USA Send a message via AIM to origamimavin
Smile Re: batch file coding help

Quote:
Originally Posted by sonora View Post
well the simple fact of life is that batch files dont support sending keystrokes you will need to create a visual basic script(vbs) instead its simple enough.

Dim WSHShell
Set WSHShell = WScript.CreateObject("WScript.Shell")

WSHShell.Exec("C:\Program Files\Mozilla Firefox\firefox.exe")

'wscript.sleep just stops the vbs file from executing the next command for however many milliseconds u decide i put 6000 because i am unaware of your processor speeds, hence it gives firefox a chance to open before carrying on
WScript.Sleep 6000

'just fill in the appropriate lines for how many times you need tab and enter, for other characters and keys just google for vbs send keys
WSHShell.SendKeys "{TAB}"
WSHShell.SendKeys "{Enter}"

WScript.Quit

you can make the file in notepad and just save as .vbs with all files as the file type.
hope this helps
thanks for the response! i'll give it a shot in the morning.
Reply With Quote
  #5   Add origamimavin to your ignore list  
Old 2008-01-12, 20:37
origamimavin origamimavin is offline
Regular
 
IL USA Send a message via AIM to origamimavin
Question Re: batch file coding help

didn't work. i wrote this:

Code:
Dim WSHShell

Set WSHShell = WScript.CreateObject("WScript.Shell")



WSHShell.Exec("C:\Program Files\Mozilla Firefox\firefox.exe")



WScript.Sleep 600



WScript.SendKeys "{^L}"



WScript.SendKeys "{^V}"



WScript.SendKeys "{ENTER}"



WScript.SendKeys "{+TAB}"

WScript.SendKeys "{+TAB}"

WScript.SendKeys "{+TAB}"

WScript.SendKeys "{+TAB}"



WScript.SendKeys "{ENTER}"



WScript.SendKeys "{+TAB}"

WScript.SendKeys "{+TAB}"

WScript.SendKeys "{+TAB}"

WScript.SendKeys "{+TAB}"



WScript.SendKeys "{ENTER}"



WScript.SendKeys "{ENTER}"

WScript.SendKeys "{ENTER}"



WScript.SendKeys "{^J}"



WScript.SendKeys "{%TAB}"



WScript.SendKeys "{%F4}"



WScript.Quit
i also made one where i changed the WScript to WSHshell, and it didn't work. i keep getting an error in firefox. i think firefod isn't allowing sendkey commands. would a macro work? if so, how can i write one?
Reply With Quote
Reply

Thread Tools
Show Printable Version Show Printable Version
Email this Page Email this Page
Display Modes
Linear Mode Linear Mode
Hybrid Mode Switch to Hybrid Mode
Threaded Mode Switch to Threaded Mode

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

 
To the best of our knowledge, the text on this page may be freely reproduced and distributed.
 

totse.com certificate signatures
 
 
About | Community | Bad Ideas | Drugs | Ego | Erotica | Fringe | Society | Technology
Hot Topics