Sign in to follow this  
Followers 0
walle

Learner looking for help!, Func etc...

5 posts in this topic

#1 ·  Posted (edited)

Can't get my script to work properly, or as it was planned.

Here is what it should do/ I want it to do...

1. Check if the file (C:\temp\burnbuddy.ini exsist), If it does, then continue with the func "Start"

2. If the file dosn't exsist, then start the func "Filefolder", finish that func and then continue with func "Start"

What it do now:

*If Burnbuddy.ini dosn't exsist, then it starts func Filefolder(),finish that and exit.

*If Burnbuddy.ini exsist, then it stopps on Line:47, Send($mapp), Can't find variable.

Any idea?

;#include "TrayGetMsg.au3"
Opt("WinTitleMatchMode", 2) ; 2 = Match any substring in the title

If FileExists("C:\Temp\Burnbuddy.ini") Then
    Start()
Else
    FileFolder()
    EndIf
Func Start()
Select
Case DriveStatus( "e:\" ) = "NOTREADY"
MsgBox(0, "", "Vad god sätt in en DVDR skiva")
CDTray("E:", "open")
MsgBox(0, "", "Läs in skiva?")
CDTray("E:", "close")
EndSelect
blockinput(1)
Select 
Case ProcessExists("µTorrent 1.6.1") = 0
    Run("D:\program\utorrent[1].exe", "D:\Program\", @SW_MINIMIZE)
    EndSelect
Sleep("2000")
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)
sleep("1000")
ControlSend("Torrentegenskaper", "", "[ID:1001]", "c:\windows\system32\notepad.exe")
ControlClick("Torrentegenskaper", "", "[CLASS:Button; INSTANCE:12]", "left", 1, 38, 12)
Blockinput(0)
WinWaitActive("- Notepad")
Blockinput(1)
Sleep("1000")
Winclose("- 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}")
$mapp = IniRead("C:\Temp\Burnbuddy.ini", "Section1", "IMGMAPP", "NotFound")
Send($mapp)
Blockinput(0)
Sleep("100000")
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)
$Var1 = InputBox("","Beteckning på brännare",  "", "")
IniWrite("C:\Temp\Burnbuddy.ini", "Section2", "Burner", $var1)
$Burner = IniRead("C:\Temp\Burnbuddy.ini", "Section2", "Burner", "NotFound")
EndFunc
Edited by walle

Share this post


Link to post
Share on other sites



You dont fall through the code an d into a function

so add a call in your logic.

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

Share this post


Link to post
Share on other sites

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


[right]Software is like sex - it's better when it's free. (Linus Torvalds)[/right]

Share this post


Link to post
Share on other sites

Thanks for the replys..

Got it to work :)

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

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

*If Burnbuddy.ini dosn't exsist, then it starts func Filefolder(),finish that and exit.

if not fileexists("Burnbuddy.ini")then
Filefolder()
exit
endif
Edited by backstabbed

tolle indicium

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