Sign in to follow this  
Followers 0
KyJelly

need help converting please

17 posts in this topic

i'm trying to convert this script to the new version but am having some problems. this is what i have so far:

; Script Version 81.a

; Script to run Project Tempest ver 0.9

;[start all]

runwait("pt.exe", "c:\emulators\jaguar\project tempest")

WinActive("Project Tempest")

mouseclick,("leftclick", 13, 60)

mouseclick,("leftclick", 13, 80)

WinActive("Open ROM File")

paste,<rom>

send("enter")

WinActive("Project Tempest")

; Start the game (F2).

send("F2")

;[Full Screen]

send("Esc")

;[tidy up]

waitforhotkey,Esc

; Stop the game - F3.

send("F3")

; Close Project Tempest.

WinClose("Project Tempest")

i think paste is all i need to convert. also i'll be passing via command line the location of the rom, so i'm guessing <rom> is how i use it? if i wanted to pass 2 paramaters for instance making the run function acccept a location and also pasting the rom param how would i do that?

if you could help me i'de be very greatful

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

here is after some other work i've done but it's still not right.bold lines are the trouble areas

; Script Version 81.a

; Script to run Project Tempest ver 0.9

;[start all]

run($CmdLine[1])

WinwaitActive("Project Tempest")

mouseclick("leftclick", 13, 60)

mouseclick("leftclick", 13, 80)

WinActive("Open ROM File")

send($CmdLine[2], 1)

send("{enter}")

WinwaitActive("Project Tempest")

; Start the game (F2).

send("{F2}")

;[Full Screen]

send("{Esc}")

;[tidy up]

; Stop the game - F3.

hotkeyset("{esc}", send("{f3}"))

; Close Project Tempest.

WinClose("Project Tempest")

Edited by KyJelly

Share this post


Link to post
Share on other sites

What is your $CMDLine? I don't think you can use that as a variable name as it's reserved for AutoIT

hotkeyset("{esc}", "sendKey")

Func sendKey()

Send ("{F3}")

Endfunc

here is after some other work i've done but it's still not right.bold lines are the trouble areas

; Script Version 81.a

; Script to run Project Tempest ver 0.9

;[start all]

run($CmdLine[1])

WinwaitActive("Project Tempest")

mouseclick("leftclick", 13, 60)

mouseclick("leftclick", 13, 80)

WinActive("Open ROM File")

send($CmdLine[2], 1)

send("{enter}")

WinwaitActive("Project Tempest")

; Start the game (F2).

send("{F2}")

;[Full Screen]

send("{Esc}")

;[tidy up]

; Stop the game - F3.

hotkeyset("{esc}", send("{f3}"))

; Close Project Tempest.

WinClose("Project Tempest")

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

If your calling the compiled application from the command line with 2 arguments Like "MyProgram.exe Notepad 7" then...

If $cmdline[0] = 2 Then
    $Var1 = $cmdline[1]
    $Var2 = $cmdline[2]
EndIf

;[start all]
hotkeyset("{esc}", "sendKey"); << Calls sendKey Function at the bottom

run($var1)
WinwaitActive("Project Tempest")
mouseclick("leftclick", 13, 60)
mouseclick("leftclick", 13, 80)
WinActive("Open ROM File")
send($var2, 1)
send("{enter}")
WinwaitActive("Project Tempest")
; Start the game (F2).
send("{F2}")

;[Full Screen]
send("{Esc}")

;[tidy up]
; Stop the game - F3.
; Close Project Tempest.

Func sendKey()
Send ("{F3}")
WinClose("Project Tempest"); <<I'm guessing this should be part of your hotkey function?
Endfunc
Edited by ChrisL

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

the syntax will be similar to this

jagscript.exe "c:\emulators\jaguar\project tempest\pt.exe" "c:\emulators\jaguar\roms\rom.jag"

so i want to pass the executable to the first one and the rom name to the second one.

the second one will be pasted into a text box.

Edited by KyJelly

Share this post


Link to post
Share on other sites

the syntax will be similar to this

jagscript.exe "c:\emulators\jaguar\project tempest\pt.exe" "c:\emulators\jaguar\roms\rom.jag"

so i want to pass the executable to the first one and the rom name to the second one.

the second one will be pasted into a text box.

OK as above then, I moved the winClose into the sendKey func as I guess you want it to close the window after the F3 key to close

Share this post


Link to post
Share on other sites

OK as above then, I moved the winClose into the sendKey func as I guess you want it to close the window after the F3 key to close

it really wouldn't matter would it?

Share this post


Link to post
Share on other sites

the thing is, this script is just going to run through once then close, is that what you want it to do or is it part of something bigger?

If its part of something bigger and the script does other stuff and stays running until you press esc and you want the other window/game/application to stay open then yes it does matter because it would get to the line and close the window.

Share this post


Link to post
Share on other sites

it just runs once through

do i need to declare the variables? i'm getting an error about that, but i'm not passing any cmdlines yet either

Share this post


Link to post
Share on other sites

it just runs once through

do i need to declare the variables? i'm getting an error about that, but i'm not passing any cmdlines yet either

If your not passing any variables via cmdline then yes, declare them above the If $cmdline[0] = 2 Then line

So set the path when you declare them, but if you pass it a CMDline it will change them to the new values.

If this runs through once then exits why do you need the hotkey, surely its never going to get to it

Share this post


Link to post
Share on other sites

good question

i guess i really dont need it :o

so with my example

var1=c:\emulators\jaguar\project tempest\pt.exe

var2=c:\emulators\jaguar\roms\rom.jag

???

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

I would have thought this is what you were aiming for, it will run through then sit there and wait for you to press esc, then send F3 and close the window.. or have \i got what your trying to do totally arse about face?

Edit* Should this be winwaitactive? WinActive("Open ROM File")

$Var1="c:\emulators\jaguar\project tempest\pt.exe" 
$Var2="c:\emulators\jaguar\roms\rom.jag"

If $cmdline[0] = 2 Then
    $Var1 = $cmdline[1]
    $Var2 = $cmdline[2]
EndIf

;[start all]
hotkeyset("{esc}", "sendKey"); << Calls sendKey Function at the bottom

run($var1)
WinwaitActive("Project Tempest")
mouseclick("leftclick", 13, 60)
mouseclick("leftclick", 13, 80)
WinActive("Open ROM File")
send($var2, 1)
send("{enter}")
WinwaitActive("Project Tempest")
; Start the game (F2).
send("{F2}")

;[Full Screen]
send("{Esc}")

While 1
Sleep (1000); Idle around waiting for you to press esc to tidy up
Wend

;[tidy up]
; Stop the game - F3.
; Close Project Tempest.

Func sendKey()
Send ("{F3}")
WinClose("Project Tempest"); <<I'm guessing this should be part of your hotkey function?
Endfunc
Edited by ChrisL

Share this post


Link to post
Share on other sites

i need it to close the app after hitting the esc key

esc in the app minimizes ans f3 stops emulation

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

well the mouse click function isn't working because the app keeps opening in different places!!! is there a way to open the "file" menu then select another item in it called "open rom..." then do my text paste?

maybe something with...WinMenuSelectItem("project tempest", "", "&File", "open rom..." )

?

Edited by KyJelly

Share this post


Link to post
Share on other sites

yes! i got it:

if $cmdline[0] = 2 Then

$Var1 = $cmdline[1]

$Var2 = $cmdline[2]

EndIf

;[start all]

hotkeyset("{esc}", "sendKey")

run($var1)

WinwaitActive("Project Tempest")

send("!f")

send("{enter}")

WinActive("Open ROM File")

send($var2, 1)

send("{enter}")

WinwaitActive("Project Tempest")

; Start the game (F2).

send("{F2}")

While 1

Sleep (1000)

Wend

;[tidy up]

; Stop the game - F3.

; Close Project Tempest.

Func sendKey()

Send ("{F3}")

WinClose("Project Tempest")

Endfunc

thanks so much for your help ChrisL

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