Sign in to follow this  
Followers 0
Th0r

Write an variable into notepad

13 posts in this topic

I have been trying to google it but all the codes I find is way too complex for me. I used autoit for like half an year ago at a very low level of knowledge. Now, i have forgotten alot.

Right now. I tried to make autoit launch notepad2 and type the variable.

Settings.ini:

[category]
string=Hello world!

IniRead("settings.ini", "kategori", "string", "1")

Run('notepad.exe')
WinWait("Untitled - Notepad2","")
If Not WinActive("Untitled - Notepad2","") Then WinActivate("Untitled - Notepad2","")
Send(&{$string})

How do I make it type the variable "string" in some way? It is to submit a password to a program.

Share this post


Link to post
Share on other sites



$string = IniRead("settings.ini", "kategori", "string", "1")

Run('notepad.exe')
WinWait("Untitled - Notepad2","")
If Not WinActive("Untitled - Notepad2","") Then WinActivate("Untitled - Notepad2","")
Send($string)

:)


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Thanks :)

New pit stop:

This one launch an app and set the priority on the app to low and then minimize it. And it should load the values in settings.ini

Opt("WinWaitDelay",1000)
Opt("WinTitleMatchMode",4)
Opt("WinDetectHiddenText",1)
Opt("MouseCoordMode",0)

$filnavn = IniRead("settings.ini", "noobpoengbot", "filnavn", "1")
$pfilsti = IniRead("settings.ini", "noobpoengbot", "filsti", "1")
$passord = IniRead("settings.ini", "noobpoengbot", "passord", "1")

ShellExecute("taskkill.exe",""/F /IM $pfilnavn"" ")
sleep(1000)
Run('C:\n00bs poengbot Thor.exe')
WinWait("n00bs poengbot","")
sleep(100)
ShellExecute("Process.exe","-p "$pfilnavn" low ")
If Not WinActive("n00bs poengbot","") Then WinActivate("n00bs poengbot","")
WinWaitActive("n00bs poengbot","")
Send("{TAB}"$passord"{TAB}{SPACE}")
WinWait("Aktivert!","")
If Not WinActive("Aktivert!","") Then WinActivate("Aktivert!","")
WinWaitActive("Aktivert!","")
Send("{SPACE}")
WinWait("n00bs poengbot | Hold inne F12 for å stoppe! :)","")
If Not WinActive("n00bs poengbot | Hold inne F12 for å stoppe! :)","") Then WinActivate("n00bs poengbot | Hold inne F12 for å stoppe! :)","")
WinWaitActive("n00bs poengbot | Hold inne F12 for å stoppe! :)","")
Send("{ALTDOWN}{SPACE}n")
Send("{ALTUP}")

settings.ini:

[noobpoengbot]
filnavn=n00bpoengbot.exe

filsti=C:\noobautoit\
passord=**

It should work. I know there is a special caracter i am missing but I dont know where or what. (please don't finish the code, just show an example of correct use/show me how it's correct.)

Share this post


Link to post
Share on other sites

The first mistake is here

ShellExecute("Process.exe","-p "$pfilnavn" low ")

Use

ShellExecute("Process.exe","-p " & $pfilnavn & " low ")

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

So I have yo use "&" before and after an $variable?

Share this post


Link to post
Share on other sites

So I have yo use "&" before and after an $variable?

You use the & to concatenate a string. The way you had it you were sending the variable as a literal string instead of a variable.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

Thanks :)

THe script works as it should now. It first kills the app, relaunch it again and logging in and set the priority to low and minimize it. I also has an issue with complie the au3 file and the "complie script" app crashes. (my antivirus is disabled atm)

Posted Image

Could someone just build it to an .exe

Opt("WinWaitDelay",1000)
Opt("WinTitleMatchMode",4)
Opt("WinDetectHiddenText",1)
Opt("MouseCoordMode",0)

$pfilnavn = IniRead("settings.ini", "noobpoengbot", "filnavn", "1")
$pfilsti = IniRead("settings.ini", "noobpoengbot", "filsti", "1")
$passord = IniRead("settings.ini", "noobpoengbot", "passord", "1")

ShellExecute("taskkill.exe","-f -im " & $pfilnavn & " ")
sleep(1000)
ShellExecute($pfilsti)
WinWait("n00bs poengbot","")
sleep(100)
ShellExecute("Process.exe","-p " & $pfilnavn & " low ")
If Not WinActive("n00bs poengbot","") Then WinActivate("n00bs poengbot","")
WinWaitActive("n00bs poengbot","")
Send("{TAB}"& $passord &"{TAB}{SPACE}")
WinWait("Aktivert!","")
If Not WinActive("Aktivert!","") Then WinActivate("Aktivert!","")
WinWaitActive("Aktivert!","")
Send("{SPACE}")
WinWait("n00bs poengbot | Hold inne F12 for å stoppe! :)","")
If Not WinActive("n00bs poengbot | Hold inne F12 for å stoppe! :)","") Then WinActivate("n00bs poengbot | Hold inne F12 for å stoppe! :)","")
WinWaitActive("n00bs poengbot | Hold inne F12 for å stoppe! :)","")
Send("{ALTDOWN}{SPACE}n")
Send("{ALTUP}")

Share this post


Link to post
Share on other sites

Sånn? :)

Like this? ;)

Share this post


Link to post
Share on other sites

Sånn? :)

Like this? ;)

I dont see any attached files.

Jeg ser ingen vedlagte filer :D

Share this post


Link to post
Share on other sites

Thanks

Mission accomplished. :)

Share this post


Link to post
Share on other sites

Thanks

Mission accomplished. :)

That might have solved this problem but I would suggest that you re-install AutoIt.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

Weird. I installed Autoit five days ago but, reinstalling worked :).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0