Sardith Posted May 12, 2006 Share Posted May 12, 2006 (edited) This is my code so far.. Func luanch() $reg = RegRead ( "keyname", "valuename" ) If $reg Then Run($var1, "") Else directory() EndIf EndFunc Func directory() $message = "Choose FEAR game directory" $var = FileOpenDialog($message, "", "(*.exe)", 1 + 2, "FEAR.exe" ) If @error Then MsgBox(4096,".exe Error","No .exe chosen, can't run game from trainer.") Else $var1 = StringReplace($var, "|", @CRLF) $Regwrite = RegWrite( "keyname?????" ,"valuename????", "type???", value maybe... $var1) MsgBox(4096,"Chosen Path","Going to run FEAR" & @CRLF & $var1) EndIf EndFunc My question is, how do I use regwrite to write a Directory that you selected, then after it's wrote it look to see if that registry is created; If is then it will run from that directory in the Registry. If not then it will run through, have you select a registry, then make a regwrite, and restart the read. Edited May 12, 2006 by Sardith [font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font] Link to comment Share on other sites More sharing options...
Sardith Posted May 12, 2006 Author Share Posted May 12, 2006 (edited) My past topic if you'd like to look at it, was in GUI's which it really doesn't fit in there, so I moved it.Past TopicMy code could be all wrong above, I need alot of help, so if anyone could give me a hand that would be so awesome I couldn't explain. Edited May 12, 2006 by Sardith [font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font] Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 12, 2006 Moderators Share Posted May 12, 2006 Func luanch() $Var2 = RegRead ( "HKLM\SOFTWARE", "FEARDirectory" ) If $Var2 Then $var3 = StringReplace($var2, "|", @CRLF) run($var3, "") Else directory() EndIf EndFunc Func directory() $message = "Choose FEAR game directory" $var = FileOpenDialog($message, "", "(*.exe)", 1 + 2, "FEAR.exe" ) If @error Then MsgBox(4096,".exe Error","No .exe chosen, can't run game from trainer.") Else $var1 = StringReplace($var, "|", @CRLF) $Regwrite = RegWrite( "HKLM\SOFTWARE", "FEARDirectory", "REG_SZ", $var1) MsgBox(4096,"Chosen Path","You can't change this path" & @CRLF & $var1) EndIf EndFunc Would this work? Just wrote it up... totally not sure..That's funny... "Hey I wrote something that I think I need/want, I haven't tried it but would this work?" Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Sardith Posted May 13, 2006 Author Share Posted May 13, 2006 I just syntaxed it with SciTe, im just asking does it look like a possible go. [font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font] Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 13, 2006 Share Posted May 13, 2006 I just syntaxed it with SciTe, im just asking does it look like a possible go. I don't get it... why not punch F5 and try it? _launch() Func luanch() $Var2 = RegRead ( "HKLM\SOFTWARE", "FEARDirectory" ) If $Var2 Then $var3 = StringReplace($var2, "|", @CRLF) MsgBox(64, "Debug", 'Run(" & $var3 & ', "")') ;run($var3, "") Else directory() EndIf EndFunc Func directory() $message = "Choose FEAR game directory" $var = FileOpenDialog($message, "", "(*.exe)", 1 + 2, "FEAR.exe" ) If @error Then MsgBox(4096,".exe Error","No .exe chosen, can't run game from trainer.") Else $var1 = StringReplace($var, "|", @CRLF) $Regwrite = RegWrite( "HKLM\SOFTWARE", "FEARDirectory", "REG_SZ", $var1) MsgBox(4096,"Chosen Path","You can't change this path" & @CRLF & $var1) EndIf EndFunc I poked in a debug message and commented out the Run() to make it safer to test, if that's the concern... Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Sardith Posted May 13, 2006 Author Share Posted May 13, 2006 Thanks, S0mke you need to take it easy buddy. [font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font] Link to comment Share on other sites More sharing options...
Lapo Posted May 13, 2006 Share Posted May 13, 2006 air code .. test it out : ;Func luanch() $reg = RegRead ( "HKEY_CURRENT_USER\Software\Xsoft","value") ;HKEY_CURRENT_USER\Software\Xsoft\Value >>> = 1 MsgBox(262144, "", $reg) ;If $reg = 1 Then MsgBox(262144, "", "") $Regwrite = RegWrite("HKEY_CURRENT_USER\Software\Xsoft","value", "REG_SZ", "2") ;HKEY_CURRENT_USER\Software\Xsoft\Value >>> = 2 MsgBox(262144, "", $Regwrite) $var = FileOpenDialog("", "", "(*.exe)", 1 + 2, "FEAR.exe" ) MsgBox(262144, "", $var) $varsplit = _FileGetPrevFolder($var, 1) MsgBox(262144, "", $varsplit) $Regwrite = RegWrite("HKEY_CURRENT_USER\Software\Xsoft","value", "REG_SZ", $varsplit) MsgBox(262144, "", $Regwrite) ;endif Func _FileGetPrevFolder($file, $num = 1) $file = StringSplit($file, "\") If $num > UBound($file) - 2 Then SetError(1) Return 0 EndIf Return $file[UBound($file, 1) - $num - 1] EndFunc Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 13, 2006 Moderators Share Posted May 13, 2006 (edited) Thanks, S0mke you need to take it easy buddy.Take it easy? I was taking it easy, I truly didn't say what I was thinking. I mean, you didn't ask "Does the syntax look right", you asked "Would this work? Just wrote it up... totally not sure..", which led me to believe, that you are afraid of your own work, or don't like trial and error.If you had asked, "Would someone check my syntax", I would have taken a look.Edit,Besides, why would you need to bump saying that in one post, if you had already replied to me in another post? Edited May 13, 2006 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now