Jump to content

Learner looking for help!, Func etc..


Recommended Posts

This is what I'm trying to do:

1. If the file C:\Temp\Burnbuddy.ini exsist, then start func Start().

2. Else Start Func Filefolder(), and after, start func Start()

I'm been playing around with If Fileexisist, then, else. But didn't work out as I believed it would.

This is my first script, so I'm just a noob =/

Here is my ugly code/script/macro =/

The Func Start()

FileDelete($mapp)
blockinput(1)
ControlClick("µTorrent 1.6.1", "", "[CLASS:SysListView32; INSTANCE:1]", "right", 1, 100, 31)
ControlSend("µTorrent 1.6.1", "", "[CLASS:SysListView32; INSTANCE:1]", "{down 15}{enter}")
ControlClick("Torrentegenskaper", "", "[CLASS:SysTabControl32; INSTANCE:1]", "left", 1, 81, 11)
ControlClick("Torrentegenskaper", "", "[CLASS:Edit; INSTANCE:1]", "left", 1, 180, 7)
ControlSend("Torrentegenskaper", "", "[ID:1001]", "c:\windows\system32\notepad.exe")
ControlClick("Torrentegenskaper", "", "[CLASS:Button; INSTANCE:12]", "left", 1, 38, 12)
Blockinput(0)
WinWaitActive("Untitled - Notepad")
Blockinput(1)
Sleep("1000")
Winclose("Untitled - Notepad")
ControlClick("µTorrent 1.6.1", "", "[CLASS:SysListView32; INSTANCE:1]", "right", 1, 100, 31)
ControlSend("µTorrent 1.6.1", "", "[CLASS:SysListView32; INSTANCE:1]", "{Down}{Enter}")
Blockinput(1)
sleep("2000")
Send("{down}{enter}")
Blockinput(0)
Winwaitactive("WinRAR")
Sleep("1000")
Winwaitactive("Please purchase WinRAR license")
ControlClick("Please purchase WinRAR license", "", "[CLASS:Button; INSTANCE:3]", "left", 1, 49, 11)
Blockinput(1)
Send("{alt}{right}{down 2}{enter}")
Send($mapp)
Blockinput(0)
ControlClick("Uppackning sökväg och valmöjligheter", "", "[CLASS:Button; INSTANCE:16]", "left", 1, 31, 11)
Opt("WinTitleMatchMode", 2) ; 2 = Match any substring in the title
WinWaitClose(".rar - WinRAR")
WinClose("WinRAR")
send("#r")
WinWaitActive("Run")
Blockinput(1)
Send($mapp)
Blockinput(0)
ControlClick("Run", "", "[CLASS:Button; INSTANCE:2]", "left", 1, 41, 14)
Sleep("2000")
Winwaitactive("IMG")
ControlClick("IMG", "", "[CLASS:SysListView32; INSTANCE:1]", "left", 2, 32, 32)
WinWaitActive("ImgBurn")
sleep("2000")
ControlClick("ImgBurn", "", "[CLASS:TPanel; INSTANCE:1]", "left", 1, 147, 292)
MsgBox(0, "Burnbuddy", "Bränning är klar!")
oÝ÷ Ù8^éÜ)^~]z¶®¶­s`¢b33c·f"ÒfÆU6VÆV7DföÆFW"gV÷CµnFÆ¢VâÖNG"äÔrfÆVâÎFvw2FÆÆnFÆÆwBâgV÷C²ÂgV÷C²gV÷C²¤æw&FRgV÷C´3¢b3#µFV×b3#´'W&æ'VFGæægV÷C²ÂgV÷Cµ6V7FöãgV÷C²ÂgV÷C´ÔtÔgV÷C²Âb33c·f"¢b33c¶ÖÒæ&VBgV÷C´3¢b3#µFV×b3#´'W&æ'VFGæægV÷C²ÂgV÷Cµ6V7FöãgV÷C²ÂgV÷C´ÔtÔgV÷C²ÂgV÷C´æ÷Df÷VæBgV÷C²¤×6t&÷CbÂgV÷CµfÆBÖgV÷C²Âb33c¶Ö¤VæDgVæ0
Link to comment
Share on other sites

Im not sure if this code will work, cause I cant test it:

If FileExists("C:\Temp\Burnbuddy.ini") Then
    Start("C:\Temp\Burnbuddy.ini")
Else
    FileFolder()
    Start("C:\Temp\Burnbuddy.ini")
EndIf
Func Start($mapp)
    FileDelete($mapp)
blockinput(1)
ControlClick("µTorrent 1.6.1", "", "[CLASS:SysListView32; INSTANCE:1]", "right", 1, 100, 31)
ControlSend("µTorrent 1.6.1", "", "[CLASS:SysListView32; INSTANCE:1]", "{down 15}{enter}")
ControlClick("Torrentegenskaper", "", "[CLASS:SysTabControl32; INSTANCE:1]", "left", 1, 81, 11)
ControlClick("Torrentegenskaper", "", "[CLASS:Edit; INSTANCE:1]", "left", 1, 180, 7)
ControlSend("Torrentegenskaper", "", "[ID:1001]", "c:\windows\system32\notepad.exe")
ControlClick("Torrentegenskaper", "", "[CLASS:Button; INSTANCE:12]", "left", 1, 38, 12)
Blockinput(0)
WinWaitActive("Untitled - Notepad")
Blockinput(1)
Sleep("1000")
Winclose("Untitled - Notepad")
ControlClick("µTorrent 1.6.1", "", "[CLASS:SysListView32; INSTANCE:1]", "right", 1, 100, 31)
ControlSend("µTorrent 1.6.1", "", "[CLASS:SysListView32; INSTANCE:1]", "{Down}{Enter}")
Blockinput(1)
sleep("2000")
Send("{down}{enter}")
Blockinput(0)
Winwaitactive("WinRAR")
Sleep("1000")
Winwaitactive("Please purchase WinRAR license")
ControlClick("Please purchase WinRAR license", "", "[CLASS:Button; INSTANCE:3]", "left", 1, 49, 11)
Blockinput(1)
Send("{alt}{right}{down 2}{enter}")
Send($mapp)
Blockinput(0)
ControlClick("Uppackning sökväg och valmöjligheter", "", "[CLASS:Button; INSTANCE:16]", "left", 1, 31, 11)
Opt("WinTitleMatchMode", 2) ; 2 = Match any substring in the title
WinWaitClose(".rar - WinRAR")
WinClose("WinRAR")
send("#r")
WinWaitActive("Run")
Blockinput(1)
Send($mapp)
Blockinput(0)
ControlClick("Run", "", "[CLASS:Button; INSTANCE:2]", "left", 1, 41, 14)
Sleep("2000")
Winwaitactive("IMG")
ControlClick("IMG", "", "[CLASS:SysListView32; INSTANCE:1]", "left", 2, 32, 32)
WinWaitActive("ImgBurn")
sleep("2000")
ControlClick("ImgBurn", "", "[CLASS:TPanel; INSTANCE:1]", "left", 1, 147, 292)
MsgBox(0, "Burnbuddy", "Bränning är klar!")
EndFunc
Func FileFolder()
    $var = FileSelectFolder("Välj en mapp där .IMG filen läggs tillfälligt.", "")
IniWrite("C:\Temp\Burnbuddy.ini", "Section1", "IMGMAPP", $var)
$mapp = IniRead("C:\Temp\Burnbuddy.ini", "Section1", "IMGMAPP", "NotFound")
MsgBox(4096, "Vald Mapp", $mapp)
EndFunc
Link to comment
Share on other sites

Hi there,

But do you want a loop? Like is monitoring if file exists and there do a func?

While 1

If FileExists("C:\Temp\Burnbuddy.ini") Then
    Start("C:\Temp\Burnbuddy.ini")
Else
    FileFolder()
EndIf

Sleep (20)

Wend

Func Start($mapp)
    FileDelete($mapp)
blockinput(1)
ControlClick("µTorrent 1.6.1", "", "[CLASS:SysListView32; INSTANCE:1]", "right", 1, 100, 31)
ControlSend("µTorrent 1.6.1", "", "[CLASS:SysListView32; INSTANCE:1]", "{down 15}{enter}")
ControlClick("Torrentegenskaper", "", "[CLASS:SysTabControl32; INSTANCE:1]", "left", 1, 81, 11)
ControlClick("Torrentegenskaper", "", "[CLASS:Edit; INSTANCE:1]", "left", 1, 180, 7)
ControlSend("Torrentegenskaper", "", "[ID:1001]", "c:\windows\system32\notepad.exe")
ControlClick("Torrentegenskaper", "", "[CLASS:Button; INSTANCE:12]", "left", 1, 38, 12)
Blockinput(0)
WinWaitActive("Untitled - Notepad")
Blockinput(1)
Sleep("1000")
Winclose("Untitled - Notepad")
ControlClick("µTorrent 1.6.1", "", "[CLASS:SysListView32; INSTANCE:1]", "right", 1, 100, 31)
ControlSend("µTorrent 1.6.1", "", "[CLASS:SysListView32; INSTANCE:1]", "{Down}{Enter}")
Blockinput(1)
sleep("2000")
Send("{down}{enter}")
Blockinput(0)
Winwaitactive("WinRAR")
Sleep("1000")
Winwaitactive("Please purchase WinRAR license")
ControlClick("Please purchase WinRAR license", "", "[CLASS:Button; INSTANCE:3]", "left", 1, 49, 11)
Blockinput(1)
Send("{alt}{right}{down 2}{enter}")
Send($mapp)
Blockinput(0)
ControlClick("Uppackning sökväg och valmöjligheter", "", "[CLASS:Button; INSTANCE:16]", "left", 1, 31, 11)
Opt("WinTitleMatchMode", 2) ; 2 = Match any substring in the title
WinWaitClose(".rar - WinRAR")
WinClose("WinRAR")
send("#r")
WinWaitActive("Run")
Blockinput(1)
Send($mapp)
Blockinput(0)
ControlClick("Run", "", "[CLASS:Button; INSTANCE:2]", "left", 1, 41, 14)
Sleep("2000")
Winwaitactive("IMG")
ControlClick("IMG", "", "[CLASS:SysListView32; INSTANCE:1]", "left", 2, 32, 32)
WinWaitActive("ImgBurn")
sleep("2000")
ControlClick("ImgBurn", "", "[CLASS:TPanel; INSTANCE:1]", "left", 1, 147, 292)
MsgBox(0, "Burnbuddy", "Bränning är klar!")
EndFunc

Func FileFolder()
    $var = FileSelectFolder("Välj en mapp där .IMG filen läggs tillfälligt.", "")
IniWrite("C:\Temp\Burnbuddy.ini", "Section1", "IMGMAPP", $var)
$mapp = IniRead("C:\Temp\Burnbuddy.ini", "Section1", "IMGMAPP", "NotFound")
MsgBox(4096, "Vald Mapp", $mapp)
Return
EndFunc

Cheers

Old Scriptology

Visual Ping 1.8 - Mass Ping Program with export to txt delimited.

Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code.

Desktop 2 RGB - Pick a color in the desktop and get the RGB code.

ShootIT 1.0 - Screen Capture full and partial screen

[font="'Arial Black';"]Remember Remember The Fifth of November.[/font]

Link to comment
Share on other sites

Thank's for the replys!

Sorry for my bad english, I will try to explain it more further.

The thing is that I dont want to start the ".ini" file, I want it to check if the .ini exsist and if it does

then start the rest of the script (The FileDelete($mapp),blockinput(1)).....

If it dosen't exsist, then a popwindows will appear and ask the user to enter

the mapp location, like in this code (could need some modifications)

$var = FileSelectFolder("Välj en mapp där .IMG filen läggs tillfälligt.", "")
IniWrite("C:\Temp\Burnbuddy.ini", "Section1", "IMGMAPP", $var)
$mapp = IniRead("C:\Temp\Burnbuddy.ini", "Section1", "IMGMAPP", "NotFound")
MsgBox(4096, "Vald Mapp", $mapp)

When the user has picked the location, then start the rest of the script ((The FileDelete($mapp),blockinput(1))..... )

Hope you understand =/

Edited by walle
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...