Jump to content

need example of running *.exe


Recommended Posts

ok i am about to partake in building a macro to open a program click certain buttons, and type in a password, and all this great stuff... but i need an example of the run command.

Can AutoIt run shortcuts?

if not then i have an alternate question. the shortcut target is:

"C:/Program Files/Sony/Launchpad/Launchpad.exe" /game:starwars

I need a written example (I learn best from seeing :)) of how to run this file with that option at the end of it.

the reason i need this is, i don't fully understand entering parameters into commands in AutoIt.

Thanks,

Beemer

Link to comment
Share on other sites

oooh crap, another question... this game takes up the full screen, and in an alternate macro i built i have it set to start when i press ctrl+z and pause when i press ctrl+x. the problem is i have to alt+tab out in order for AutoIt to accept the key presses... is there a way to fix this? i can post code if you need of the alternate macro i have made.

Beemer

Link to comment
Share on other sites

well i looked through the link... although it was really confusing i just need help to convert it to what i need.

I PM'ed Burrup about this, but since he went offline i thought i should just post it here.

I need the following converted to be able for AutoIt to recognize when i press "Ctrl+Alt+z/x/c"

;In this little example pressing n will pop up a message
;pressing Esc will leave.
While 1
  If _IsPressed('1b') = 1 Then Exit;1b is ESC
  If _IsPressed('4e') = 1 Then MsgBox(0, '', 'Wow');4e is the N
  Sleep(10)
Wend

Exit
Func _IsPressed($hexKey)
; $hexKey must be the value of one of the keys.
; _IsPressed will return 0 if the key is not pressed, 1 if it is.
; $hexKey should entered as a string, don't forget the quotes!
; (yeah, layer. This is for you)
  
  Local $aR, $bO
  
  $hexKey = '0x' & $hexKey
  $aR = DllCall("user32", "int", "GetAsyncKeyState", "int", $hexKey)
  If Not @error And BitAND($aR[0], 0x8000) = 0x8000 Then
     $bO = 1
  Else
     $bO = 0
  EndIf
  
  Return $bO
EndFunc;==>_IsPressed

#cs
  01 Left mouse button
  02 Right mouse button;does not works in my system...
  04 Middle mouse button (three-button mouse)
  05 Windows 2000/XP: X1 mouse button
  06 Windows 2000/XP: X2 mouse button
  08 BACKSPACE key
  09 TAB key
  0C CLEAR key
  0D ENTER key
  10 SHIFT key
  11 CTRL key
  12 ALT key
  13 PAUSE key
  14 CAPS LOCK key
  1B ESC key
  20 SPACEBAR
  21 PAGE UP key
  22 PAGE DOWN key
  23 END key
  24 HOME key
  25 LEFT ARROW key
  26 UP ARROW key
  27 RIGHT ARROW key
  28 DOWN ARROW key
  29 SELECT key
  2A PRINT key
  2B EXECUTE key
  2C PRINT SCREEN key
  2D INS key
  2E DEL key
  30 0 key
  31 1 key
  32 2 key
  33 3 key
  34 4 key
  35 5 key
  36 6 key
  37 7 key
  38 8 key
  39 9 key
  41 A key
  42 B key
  43 C key
  44 D key
  45 E key
  46 F key
  47 G key
  48 H key
  49 I key
  4A J key
  4B K key
  4C L key
  4D M key
  4E N key
  4F O key
  50 P key
  51 Q key
  52 R key
  53 S key
  54 T key
  55 U key
  56 V key
  57 W key
  58 X key
  59 Y key
  5A Z key
  5B Left Windows key
  5C Right Windows key
  60 Numeric keypad 0 key
  61 Numeric keypad 1 key
  62 Numeric keypad 2 key
  63 Numeric keypad 3 key
  64 Numeric keypad 4 key
  65 Numeric keypad 5 key
  66 Numeric keypad 6 key
  67 Numeric keypad 7 key
  68 Numeric keypad 8 key
  69 Numeric keypad 9 key
  6A Multiply key
  6B Add key
  6C Separator key
  6D Subtract key
  6E Decimal key
  6F Divide key
  70 F1 key
  71 F2 key
  72 F3 key
  73 F4 key
  74 F5 key
  75 F6 key
  76 F7 key
  77 F8 key
  78 F9 key
  79 F10 key
  7A F11 key
  7B F12 key
  7C-7F F13 key - F16 key
  80H-87H F17 key - F24 key
  90 NUM LOCK key
  91 SCROLL LOCK key
  A0 Left SHIFT key
  A1 Right SHIFT key
  A2 Left CONTROL key
  A3 Right CONTROL key
  A4 Left MENU key
  A5 Right MENU key
#ce

would it be like this?:

While 1
  If _IsPressed('11') = 1 Then Send ( "{LCTRL}" )
  If _IsPressed('12') = 1 Then Send ( "{LALT}" )
  If _IsPressed('5a') = 1 Then Send ( "z" )
  If _IsPressed('58') = 1 Then Send ( "x" )
  If _IsPressed('43') = 1 Then Send ( "c" )
  Sleep(10)
Wend

are there other things i need to change? i really can't tell :)

Edited by Beemer101
Link to comment
Share on other sites

well it gave me an error on line 30 (the $ar cmd)

here is my code right now:

HotKeySet("^!z", "Begin")
HotKeySet("^!x", "Pause")
HotKeySet("^!c", "MyExit")

;In this little example pressing n will pop up a message
;pressing Esc will leave.
While 1
   If _IsPressed('11') = 1 AND _IsPressed('12') = 1 AND _IsPressed('5A') = 1 Then
     Send ("^!z")
   EndIf
   If _IsPressed('11') = 1 AND _IsPressed('12') = 1 AND _IsPressed('58') = 1 Then
     Send ("^!x")
   EndIf
   If _IsPressed('11') = 1 AND _IsPressed('12') = 1 AND _IsPressed('43') = 1 Then
     Send ("^!c")
   EndIf
  Sleep(10)
Wend

Exit
Func _IsPressed($hexKey)
; $hexKey must be the value of one of the keys.
; _IsPressed will return 0 if the key is not pressed, 1 if it is.
; $hexKey should entered as a string, don't forget the quotes!
; (yeah, layer. This is for you)
  
  Local $aR, $bO
  
  $hexKey = '0x' & $hexKey
  $aR = DllCall("user32", "int", "GetAsyncKeyState", "int", $hexKey)
  If Not @error And BitAND($aR[0], 0x8000) = 0x8000 Then
     $bO = 1
  Else
     $bO = 0
  EndIf
  
  Return $bO
EndFunc ;==>_IsPressed

#cs
  01 Left mouse button
  02 Right mouse button;does not works in my system...
  04 Middle mouse button (three-button mouse)
  05 Windows 2000/XP: X1 mouse button
  06 Windows 2000/XP: X2 mouse button
  08 BACKSPACE key
  09 TAB key
  0C CLEAR key
  0D ENTER key
  10 SHIFT key
  11 CTRL key
  12 ALT key
  13 PAUSE key
  14 CAPS LOCK key
  1B ESC key
  20 SPACEBAR
  21 PAGE UP key
  22 PAGE DOWN key
  23 END key
  24 HOME key
  25 LEFT ARROW key
  26 UP ARROW key
  27 RIGHT ARROW key
  28 DOWN ARROW key
  29 SELECT key
  2A PRINT key
  2B EXECUTE key
  2C PRINT SCREEN key
  2D INS key
  2E DEL key
  30 0 key
  31 1 key
  32 2 key
  33 3 key
  34 4 key
  35 5 key
  36 6 key
  37 7 key
  38 8 key
  39 9 key
  41 A key
  42 B key
  43 C key
  44 D key
  45 E key
  46 F key
  47 G key
  48 H key
  49 I key
  4A J key
  4B K key
  4C L key
  4D M key
  4E N key
  4F O key
  50 P key
  51 Q key
  52 R key
  53 S key
  54 T key
  55 U key
  56 V key
  57 W key
  58 X key
  59 Y key
  5A Z key
  5B Left Windows key
  5C Right Windows key
  60 Numeric keypad 0 key
  61 Numeric keypad 1 key
  62 Numeric keypad 2 key
  63 Numeric keypad 3 key
  64 Numeric keypad 4 key
  65 Numeric keypad 5 key
  66 Numeric keypad 6 key
  67 Numeric keypad 7 key
  68 Numeric keypad 8 key
  69 Numeric keypad 9 key
  6A Multiply key
  6B Add key
  6C Separator key
  6D Subtract key
  6E Decimal key
  6F Divide key
  70 F1 key
  71 F2 key
  72 F3 key
  73 F4 key
  74 F5 key
  75 F6 key
  76 F7 key
  77 F8 key
  78 F9 key
  79 F10 key
  7A F11 key
  7B F12 key
  7C-7F F13 key - F16 key
  80H-87H F17 key - F24 key
  90 NUM LOCK key
  91 SCROLL LOCK key
  A0 Left SHIFT key
  A1 Right SHIFT key
  A2 Left CONTROL key
  A3 Right CONTROL key
  A4 Left MENU key
  A5 Right MENU key
#ce


Pause()

Func Begin()
   WinActivate ( "SwgClient" )
   Sleep ( "3000" )
   While 1
      MouseClick ( "right" , 281, 308 , 1 , 1 )
      Sleep ( "1000" )
      MouseClick ( "left" , 393, 245 , 1 , 1 )
      Sleep ( "1200" )
   Wend
EndFunc

Func Pause()
   While 1
      Sleep ( "10000" )
   Wend
EndFunc

Func MyExit()
    Exit
EndFunc
Link to comment
Share on other sites

Try this

While 1
   If _IsPressed('11') = 1 AND _IsPressed('12') = 1 AND _IsPressed('5A') = 1 Then
     Begin()
   EndIf
   If _IsPressed('11') = 1 AND _IsPressed('12') = 1 AND _IsPressed('58') = 1 Then
     Pause()
   EndIf
   If _IsPressed('11') = 1 AND _IsPressed('12') = 1 AND _IsPressed('43') = 1 Then
     MyExit()
   EndIf
  Sleep(100)
Wend

Func _IsPressed($hexKey)
   Local $aR
   $hexKey = '0x' & $hexKey
   $aR = DllCall("user32", "int", "GetAsyncKeyState", "int", $hexKey)
   If Not @error And BitAND($aR[0],0x8000) = 0x8000 Then Return 1
   Return 0
EndFunc

Func Begin()
   WinActivate ( "SwgClient" )
   Sleep ( "3000" )
   While 1
      MouseClick ( "right" , 281, 308 , 1 , 1 )
      Sleep ( "1000" )
      MouseClick ( "left" , 393, 245 , 1 , 1 )
      Sleep ( "1200" )
   Wend
EndFunc

Func Pause()
   While 1
      Sleep ( "10000" )
   Wend
EndFunc

Func MyExit()
    Exit
EndFunc
Edited by Burrup

qq

Link to comment
Share on other sites

ok installed the first link, and the macro works.... well almost...

ok i pressed ctrl+z to start it... and then tried the other combinations to stop, or at least pause, it, and nothing worked... i almost had to restart my computer lol.

Link to comment
Share on other sites

I think you will have to do you with the HotKeySet() like below.

HotKeySet("^!z", "Begin")
HotKeySet("^!x", "Pause")
HotKeySet("^!c", "MyExit")

Pause()

While 1
   If _IsPressed('11') = 1 AND _IsPressed('12') = 1 AND _IsPressed('5A') = 1 Then
     Send ("^!z")
   EndIf
   If _IsPressed('11') = 1 AND _IsPressed('12') = 1 AND _IsPressed('58') = 1 Then
     Send ("^!x")
   EndIf
   If _IsPressed('11') = 1 AND _IsPressed('12') = 1 AND _IsPressed('43') = 1 Then
     Send ("^!c")
   EndIf
  Sleep(10)
Wend

Func _IsPressed($hexKey)
   Local $aR
   $hexKey = '0x' & $hexKey
   $aR = DllCall("user32.dll", "int", "GetAsyncKeyState", "int", $hexKey)
   If Not @error And BitAND($aR[0],0x8000) = 0x8000 Then Return 1
   Return 0
EndFunc

Func Begin()
   WinActivate ( "SwgClient" )
   Sleep ( "3000" )
   While 1
      MouseClick ( "right" , 281, 308 , 1 , 1 )
      Sleep ( "1000" )
      MouseClick ( "left" , 393, 245 , 1 , 1 )
      Sleep ( "1200" )
   Wend
EndFunc

Func Pause()
   While 1
      Sleep ( "10000" )
   Wend
EndFunc

Func MyExit()
    Exit
EndFunc
Edited by Burrup

qq

Link to comment
Share on other sites

well i have tried and tried but can't get the script to start while the game is in full screen mode... if ya know any way to get it to work, great. if not, then oh well, i will just have to press ctrl+esc everytime to start/pause/exit the script... big whoopidy doo :)

thanks again for all your help

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...