Sign in to follow this  
Followers 0
DirtyBanditos

need help for load run!

9 posts in this topic

#1 ·  Posted (edited)

Hello :idiot:

This is my code to load a exe prog wis hotkeys wy he not wörks on my other exe to load wis Shift+Alt+y !

Mrun HotKeySet("+!d", "mRun") ;Shift-Alt-d =wörks great!

HotKeySet("+!y", "mRun1") ;Shift-Alt-y ==not wörks

; ----------------------------------------------------------------------------
; Script Start
; ----------------------------------------------------------------------------
Global $Paused
Global $MsgBox
Global $mRun
Global $mRun1
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("+{PAUSE}", "_MsgBox")
HotKeySet("+!d", "mRun");Shift-Alt-d
HotKeySet("+!y", "mRun1");Shift-Alt-y
 ----------------------------------------------------------------------------
; Script Start
; ----------------------------------------------------------------------------

While 1
   Sleep(100)
Wend
Func mRun()
   Run("C:\Programme\Multiclip\multiclip.exe", "", @SW_MAXIMIZE)
   Sleep(500)
   WinWait("multiclip.exe")
AutoItSetOption("WinTitleMatchMode", 2)
$ln = StatusbarGetText("multiclip.exe","")
MsgBox( 0, "Title", $ln & @CR & @error)

EndFunc  ;==>mRun
Func _togglePause()
   $Paused = Not $Paused
   While Not $Paused
      Sleep(200)
   Wend
   While 1
   Sleep(100)
Wend
 ----------------------------------------------------------------------------
; Script Start
; ----------------------------------------------------------------------------


Func mRun1()
   Run("C:\Programme\Notpad.exe\Notpad.exe", "", @SW_MAXIMIZE)
   Sleep(500)
   WinWait("Notpad.exe")
AutoItSetOption("WinTitleMatchMode", 2)
$ln = StatusbarGetText("Notpad.exe","")
MsgBox( 0, "Title", $ln & @CR & @error)

EndFunc  ;==>mRun1
Func _togglePause()
   $Paused = Not $Paused
   While Not $Paused
      Sleep(200)
   Wend
   While 1
   Sleep(100)
Wend

    ; ----------------------------------------------------------------------------
  ; Script Start
  ; ----------------------------------------------------------------------------
    Wend
  
EndFunc  ;==>_togglePause
Func Pauseon()
   $on = 1
   Sleep(200)
EndFunc  ;==>Pauseon
; Function to exit script
Func Pauseoff()
   $on = 0
   Sleep(200)
EndFunc  ;==>Pauseoff
; Function to exit script
Func EndScript()
   Exit
EndFunc  ;==>EndScript
AdlibDisable(); you turn it off?
Edited by Larry

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

This is my code to load a exe prog wis hotkeys

Did u mean "This is my code to load different programs with hotkeys ?"

If thats what u ment then how bout sumting like this ?

;Hotkeys

HotKeySet("+!d", "mRun");Shift-Alt-d
HotKeySet("+!y", "mRun1");Shift-Alt-y

While 1
    Sleep(100)
Wend

;Functions

Func mRun()
   Run("C:\Programme\Multiclip\multiclip.exe", "", @SW_MAXIMIZE)
   Sleep(500)
   WinWait("multiclip.exe")
   AutoItSetOption("WinTitleMatchMode", 2)
   $ln = StatusbarGetText("multiclip.exe","")
   MsgBox( 0, "Title", $ln & @CR & @error)
EndFunc;==>mRun

Func mRun1()
    Run("C:\Programme\Notpad.exe\Notpad.exe", "", @SW_MAXIMIZE)
    Sleep(500)
    WinWait("Notpad.exe")
    AutoItSetOption("WinTitleMatchMode", 2)
    $ln = StatusbarGetText("Notpad.exe","")
    MsgBox( 0, "Title", $ln & @CR & @error)
EndFunc;==>mRun1

Ive no idea what ur trying to do with the pause functions,plz explain in more detail and ill try help u with it.

Ive also no idea why u have this at the start of ur script seeing as ur not using these values in ur script at all that i can see.

Global $mRun
Global $mRun1
Edited by nova

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Did u mean "This is my code to load different programs with hotkeys ?"

If thats what u ment then how bout sumting like this ?

;Hotkeys

HotKeySet("+!d", "mRun");Shift-Alt-d
HotKeySet("+!y", "mRun1");Shift-Alt-y

While 1
    Sleep(100)
Wend

;Functions

Func mRun()
   Run("C:\Programme\Multiclip\multiclip.exe", "", @SW_MAXIMIZE)
   Sleep(500)
   WinWait("multiclip.exe")
   AutoItSetOption("WinTitleMatchMode", 2)
   $ln = StatusbarGetText("multiclip.exe","")
   MsgBox( 0, "Title", $ln & @CR & @error)
EndFunc;==>mRun

Func mRun1()
    Run("C:\Programme\Notpad.exe\Notpad.exe", "", @SW_MAXIMIZE)
    Sleep(500)
    WinWait("Notpad.exe")
    AutoItSetOption("WinTitleMatchMode", 2)
    $ln = StatusbarGetText("Notpad.exe","")
    MsgBox( 0, "Title", $ln & @CR & @error)
EndFunc;==>mRun1

Ive no idea what ur trying to do with the pause functions,plz explain in more detail and ill try help u with it.

Ive also no idea why u have this at the start of ur script seeing as ur not using these values in ur script at all that i can see.

Global $mRun
Global $mRun1

<{POST_SNAPBACK}>

hello :D

i use this code for load 1 exe Prog this wörks great my prob he not wörks to load 2 exe Progs wis Mrun1 :idiot:

; ----------------------------------------------------------------------------
;
; AutoIt Version: 3.0
; Language:       English
; Platform:       Win9x / NT
; Author:         A.N.Other <myemail@nowhere.com>
;
; Script Function:
;   Template AutoIt script.
;
; ----------------------------------------------------------------------------


; ----------------------------------------------------------------------------
; Set up our defaults
; ----------------------------------------------------------------------------

;AutoItSetOption("MustDeclareVars", 1)
;AutoItSetOption("MouseCoordMode", 0)
;AutoItSetOption("PixelCoordMode", 0)
;AutoItSetOption("RunErrorsFatal", 0)
;AutoItSetOption("TrayIconDebug", 1)
;AutoItSetOption("WinTitleMatchMode", 4)


; ----------------------------------------------------------------------------
; Script Start
; ----------------------------------------------------------------------------

; ----------------------------------------------------------------------------
; Script Start
; ----------------------------------------------------------------------------
; Initial shit
HotKeySet("{ESC}", "EndScript")
HotKeySet("{F1}", "Pauseon")
HotKeySet("{F2}", "Pauseoff")
HotKeySet("+{PAUSE}", "_MsgBox")
HotKeySet("+!d", "mRun");Shift-Alt-d
; Script code
; ----------------------------------------------------------------------------
Opt ("WinWaitDelay", 4000)
Opt ("WinTitleMatchMode", 4)
Opt ("WinDetectHiddenText", 1)
Opt ("MouseCoordMode", 0)
WinWait("Sacred")
If Not WinActive("ICQ") Then WinActivate("ICQ")
WinWaitActive("ICQ")
AdlibEnable("ICQCheck")
Sleep(1000)
Global $Paused
Global $MsgBox
Global $mRun
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("+{PAUSE}", "_MsgBox")
HotKeySet("+!d", "mRun");Shift-Alt-d
; ----------------------------------------------------------------------------
; Script code
; ----------------------------------------------------------------------------
; ----------------------------------------------------------------------------
; Script code
; ----------------------------------------------------------------------------
AdlibEnable("ICQ")
$counter = 1
While 1
   Sleep(1000)
   $Sentences = FileRead('C:\Programme\Test\ICQ.ini', FileGetSize('C:\Programme\Test\ICQ.ini'))
  ; note StringReplace($Sentences,@CRLF,@LF) by itself does nothing
   $Sentences = StringReplace($Sentences, @CRLF, @LF,);If it is a standard Dos .txt file that uses @crlf as
  ; new line chars. otherwise change as needed.
   ToolTip($Sentences)
   $Sentences = StringSplit($Sentences, @LF)
   Send('{Enter}');
   Sleep(1000)
   Send($Sentences[Int(Random(1, $Sentences[0] + 1)) ], 1);Write your Message to Spamm
   Sleep(1000)
   Send('{Enter}');
   Sleep(1100)
   If $counter = 10 Then
      Send("{ENTER}{CTRLDOWN}{ALTDOWN}[{CTRLUP}_
            {ALTUP}Test ICQ{SPACE}{ENTER}");
      $counter = 1
   EndIf
   $counter = $counter + 1
Wend
AdlibDisable(); you turn it off?
; ----------------------------------------------------------------------------
; Script code
; ----------------------------------------------------------------------------
AdlibEnable("ICQCheck")
Func SacredCheck()
   If WinExists("ICQ") == 0 Then
      MsgBox(0, "ICQ", "You need Sacred to run, and the window is not present in memory.")
      Exit
   EndIf
   If WinActive("ICQ") == 10Then
      $msgActive = MsgBox(4, "ICQ", "ICQ is not active and should be. The script is now paused. Click YES if you want to unpause the script, or NO if you want to stop its execution.")
      Select
         Case $msgActive = 6
            WinActivate("ICQ")
         Case $msgActive = 7
            Exit
      EndSelect
   EndIf
  ; ----------------------------------------------------------------------------
  ; Script code
  ; ----------------------------------------------------------------------------
  ;
EndFunc  ;==>ICQCheck
Func TogglePause()
   $Paused = Not $Paused
   While $Paused
      Sleep(100)
   Wend
EndFunc  ;==>TogglePause
; Function to exit script
Sleep(1000)
; This will create a tooltip in the upper left of the screen
ToolTip("Drücke Shift+Pause Und SHIFT+ALT+D °°", 175, 320)
Sleep(13000)   ; Sleep to give tooltip time to display
Func _MsgBox()
   $run = MsgBox(4, "This is the test prog ")
  
  ; Exit if "No"
   If $run = 7 Then
      MsgBox(0, "This is the test prog")
      Exit
   EndIf
EndFunc  ;==>_MsgBox
; ----------------------------------------------------------------------------
; Script Start
; ----------------------------------------------------------------------------
While 1
   Sleep(100)
Wend
Func mRun()
   Run("C:\Programme\test\multiclip.exe", "", @SW_MAXIMIZE)
   Sleep(500)
   WinWait("multiclip.exe")
AutoItSetOption("WinTitleMatchMode", 2)
$ln = StatusbarGetText("multiclip.exe","")
MsgBox( 0, "Title", $ln & @CR & @error)

EndFunc  ;==>mRun
Func _togglePause()
   $Paused = Not $Paused
   While Not $Paused
      Sleep(200)
   Wend
  ; ----------------------------------------------------------------------------
  ; Script Start
  ; ----------------------------------------------------------------------------
EndFunc  ;==>_togglePause
Func Pauseon()
   $on = 1
   Sleep(200)
EndFunc  ;==>Pauseon
; Function to exit script
Func Pauseoff()
   $on = 0
   Sleep(200)
EndFunc  ;==>Pauseoff
; Function to exit script
Func EndScript()
   Exit
EndFunc  ;==>EndScript
AdlibDisable(); you turn it off?
; ----------------------------------------------------------------------------
; Script code Ende!
; ----------------------------------------------------------------------------


My prob wen i adde this Mrun1 he gif me a Mrun1 error Message!
wat is wrong pls help me! :)  :) 

HotKeySet("+!d", "mRun");Shift-Alt-d
HotKeySet("+!y", "mRun1");Shift-Alt-y

While 1
    Sleep(100)
Wend

;Functions
 ----------------------------------------------------------------------------
; Script code
; ----------------------------------------------------------------------------
Opt ("WinWaitDelay", 4000)
Opt ("WinTitleMatchMode", 4)
Opt ("WinDetectHiddenText", 1)
Opt ("MouseCoordMode", 0)
WinWait("Sacred")
If Not WinActive("ICQ") Then WinActivate("ICQ")
WinWaitActive("ICQ")
AdlibEnable("ICQCheck")
Sleep(1000)
Global $Paused
Global $MsgBox
Global $mRun
Global $mRun1
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("+{PAUSE}", "_MsgBox")
HotKeySet("+!d", "mRun");Shift-Alt-d
HotKeySet("+!d", "mRun1");Shift-Alt-d
; ----------------------------------------------------------------------------
; Script code
; ----------------------------------------------------------------------------
; ----------------------------------------------------------------------------
; Script code
; ----------------------------------------------------------------------------
AdlibEnable("ICQ")
$counter = 1
While 1
   Sleep(1000)
   $Sentences = FileRead('C:\Programme\Test\ICQ.ini', FileGetSize('C:\Programme\Test\ICQ.ini'))
  ; note StringReplace($Sentences,@CRLF,@LF) by itself does nothing
   $Sentences = StringReplace($Sentences, @CRLF, @LF,);If it is a standard Dos .txt file that uses @crlf as
  ; new line chars. otherwise change as needed.
   ToolTip($Sentences)
   $Sentences = StringSplit($Sentences, @LF)
   Send('{Enter}');
   Sleep(1000)
   Send($Sentences[Int(Random(1, $Sentences[0] + 1)) ], 1);Write your Message to Spamm
   Sleep(1000)
   Send('{Enter}');
   Sleep(1100)
   If $counter = 10 Then
      Send("{ENTER}{CTRLDOWN}{ALTDOWN}[{CTRLUP}_
            {ALTUP}Test ICQ{SPACE}{ENTER}");
      $counter = 1
   EndIf
   $counter = $counter + 1
Wend
AdlibDisable(); you turn it off?
; ----------------------------------------------------------------------------
; Script code
; ----------------------------------------------------------------------------
AdlibEnable("ICQCheck")
Func SacredCheck()
   If WinExists("ICQ") == 0 Then
      MsgBox(0, "ICQ", "You need Sacred to run, and the window is not present in memory.")
      Exit
   EndIf
   If WinActive("ICQ") == 10Then
      $msgActive = MsgBox(4, "ICQ", "ICQ is not active and should be. The script is now paused. Click YES if you want to unpause the script, or NO if you want to stop its execution.")
      Select
         Case $msgActive = 6
            WinActivate("ICQ")
         Case $msgActive = 7
            Exit
      EndSelect
   EndIf
  ; ----------------------------------------------------------------------------
  ; Script code
  ; ----------------------------------------------------------------------------
  ;
EndFunc  ;==>ICQCheck
Func TogglePause()
   $Paused = Not $Paused
   While $Paused
      Sleep(100)
   Wend
EndFunc  ;==>TogglePause
; Function to exit script
Sleep(1000)
; This will create a tooltip in the upper left of the screen
ToolTip("Drücke Shift+Pause Und SHIFT+ALT+D °°", 175, 320)
Sleep(13000)   ; Sleep to give tooltip time to display
Func _MsgBox()
   $run = MsgBox(4, "This is the test prog ")
  
  ; Exit if "No"
   If $run = 7 Then
      MsgBox(0, "This is the test prog")
      Exit
   EndIf
EndFunc  ;==>_MsgBox
; ----------------------------------------------------------------------------
; Script Start
; ----------------------------------------------------------------------------
While 1
   Sleep(100)
Wend
Func mRun()
   Run("C:\Programme\Multiclip\multiclip.exe", "", @SW_MAXIMIZE)
   Sleep(500)
   WinWait("multiclip.exe")
   AutoItSetOption("WinTitleMatchMode", 2)
   $ln = StatusbarGetText("multiclip.exe","")
   MsgBox( 0, "Title", $ln & @CR & @error)
EndFunc;==>mRun

EndFunc  ;==>mRun
Func _togglePause()
   $Paused = Not $Paused
   While Not $Paused
      Sleep(200)
   Wend
Func mRun1()
    Run("C:\Programme\Notpad.exe\Notpad.exe", "", @SW_MAXIMIZE)
    Sleep(500)
    WinWait("Notpad.exe")
    AutoItSetOption("WinTitleMatchMode", 2)
    $ln = StatusbarGetText("Notpad.exe","")
    MsgBox( 0, "Title", $ln & @CR & @error)

EndFunc;==>mRun1
EndFunc  ;==>mRun
Func _togglePause()
   $Paused = Not $Paused
   While Not $Paused
      Sleep(200)
   Wend

  ; ----------------------------------------------------------------------------
  ; Script Start
  ; ----------------------------------------------------------------------------
EndFunc  ;==>_togglePause
Func Pauseon()
   $on = 1
   Sleep(200)
EndFunc  ;==>Pauseon
; Function to exit script
Func Pauseoff()
   $on = 0
   Sleep(200)
EndFunc  ;==>Pauseoff
; Function to exit script
Func EndScript()
   Exit
EndFunc  ;==>EndScript
AdlibDisable(); you turn it off?
Edited by Larry

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Im going to assume that your primary language isnt English!

Hey thats grand, and im sure that you are finding it very hard to communicate your problem, becasue im finding it very hard to translating it.

Anyway you need to put some structure into your code so as its easier to read !

When I look at your code I find it very very hard to read !

One thing that I find really hard to understand is why you keep doing this ?

; ----------------------------------------------------------------------------
; Script Start
; ----------------------------------------------------------------------------

Surly a script can only start at one point !

See my example code posted above, try tidy ur code up into looking something along those lines,then maby someone can figure out why ur second hotkey isnt working !

Best of luck

Nova

Edited by nova

Share this post


Link to post
Share on other sites

Im going to assume that your primary language isnt English!

Hey thats grand, and im sure that you are finding it very hard to communicate your problem, becasue im finding it very hard to translating it.

Anyway you need to put some structure into your code so as its easier to read !

When I look at your code I find it very very hard to read !

One thing that I find really hard to understand is why you keep doing this ?

; ----------------------------------------------------------------------------
; Script Start
; ----------------------------------------------------------------------------

Surly a script can only start at one point !

See my example code posted above, try tidy ur code up into looking something along those lines,then maby someone can figure out why ur second hotkey isnt working !

Best of luck

Nova

<{POST_SNAPBACK}>

Hello Nova ok you have right its really hard to understand me my english ar bad(

thx you nova for Helps :idiot:

Share this post


Link to post
Share on other sites

Test this by itself and see if it works, I dont think your problem is the function mRun1 its-self.Its more likly in the code before mRun1 thats stopping it from working!

HotKeySet("+!y", "mRun1") 

While 1
   sleep (10)
Wend

Func mRun1()
    AutoItSetOption("WinTitleMatchMode", 2)
    Run("C:\Programme\Notpad.exe\Notpad.exe", "", @SW_MAXIMIZE)
    WinWait("Notpad.exe")
    $ln = StatusbarGetText("Notpad.exe","")
    MsgBox( 0, "Title", $ln & @CR & @error)
EndFunc;==>mRun1

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Tip:

Put all HotKeySets at the top of the script before any loops.

Edit:

Ow. You did that already...

Never mind.

Edited by SlimShady

Share this post


Link to post
Share on other sites

Ok firstly your gonna have to rewrite all your functions in the style I posted above and place them all together at the bottom of your script !

Heres an example of what I mean

;Script goes here
 
Bla bla
Bla bla
Bla bla

;Functions
Func mRun()
   Line 1
   Line 2
   Line 3
EndFunc 

Func mRun1()
   Line 1
   Line 2
   Line 3
EndFunc 

Func SacredCheck()
   Line 1
   Line 2
   Line 3
EndFunc 

TogglePause()
   Line 1
   Line 2
   Line 3
EndFunc

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Ok firstly your gonna have to rewrite all your functions in the style I posted above and place them all together at the bottom of your script !

Heres an example of what I mean

;Script goes here
 
Bla bla
Bla bla
Bla bla

;Functions
Func mRun()
   Line 1
   Line 2
   Line 3
EndFunc 

Func mRun1()
   Line 1
   Line 2
   Line 3
EndFunc 

Func SacredCheck()
   Line 1
   Line 2
   Line 3
EndFunc 

TogglePause()
   Line 1
   Line 2
   Line 3
EndFunc

<{POST_SNAPBACK}>

Hello Nova Thx you :idiot:

but i use this from my Mrun load exe and wörks great^^

Thx for help i test your exampel to learn more ))

Your my hero Nova :D

; ----------------------------------------------------------------------------
;
; AutoIt Version: 3.0
; Language:       English
; Platform:       Win9x / NT
; Author:         A.N.Other <myemail@nowhere.com>
;
; Script Function:
;   Template AutoIt script.
;
; ----------------------------------------------------------------------------
; ----------------------------------------------------------------------------
; Set up our defaults
; ----------------------------------------------------------------------------
;AutoItSetOption("MustDeclareVars", 1)
;AutoItSetOption("MouseCoordMode", 0)
;AutoItSetOption("PixelCoordMode", 0)
;AutoItSetOption("RunErrorsFatal", 0)
;AutoItSetOption("TrayIconDebug", 1)
;AutoItSetOption("WinTitleMatchMode", 4)
; ----------------------------------------------------------------------------
; Script Start
; ----------------------------------------------------------------------------
Global $Paused
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
$DirtyBanditosKeyOne = HotKeySet("1", "DirtyBanditosOne")
$DirtyBanditosKeyTwo = HotKeySet("2", "DirtyBanditosTwo")
$DirtyBanditosKeyOne = HotKeySet("3", "DirtyBanditosThree")
$DirtyBanditosKeyTwo = HotKeySet("4", "DirtyBanditosFour")
;;;; Body of program would go here;;;;
While 1
   Sleep(100)
Wend
;;;;;;;;
Func TogglePause()
   $Paused = Not $Paused
   While $Paused
      Sleep(100)
      ToolTip('Script is "Paused"', 0, 0)
   Wend
   ToolTip("")
EndFunc  ;==>TogglePause
Func Terminate()
   Exit 0
EndFunc  ;==>Terminate
WinWaitActive("Sacred")
;====== Main Body =======================
While 1
   $DirtyBanditosKeyOne = HotKeySet("6", "DirtyBanditosOne")
   $DirtyBanditosKeyTwo = HotKeySet("5", "DirtyBanditosTwo")
   $DirtyBanditosKeyOne = HotKeySet("6", "DirtyBanditosThree")
   $DirtyBanditosKeyTwo = HotKeySet("5", "DirtyBanditosFour")
   Select
      Case $DirtyBanditosKeyOne = 0
         DirtyBanditosOne()
      Case $DirtyBanditosKeyTwo = 0
         DirtyBanditosTwo()
      Case $DirtyBanditosKeyThree = 0
         DirtyBanditosThree()
      Case $DirtyBanditosKeyFour = 0
         DirtyBanditosFour()
      Case WinWaitClose("Sacred")
   EndSelect
Wend
; =========== Subroutines ===============
; ----------- First DirtyBanditos key ------------
Func DirtyBanditosOne()
   Run("C:\Programme\DirtyBanditos\Sacred Dark Fight Club.exe", "", @SW_MAXIMIZE)
   Sleep(1000)
EndFunc  ;==>DirtyBanditosOne
; ----------- Second DirtyBanditos key -----------
Func DirtyBanditosTwo()
   Run("C:\Programme\DirtyBanditos\Thc.exe", "", @SW_MAXIMIZE)
   Sleep(1000)
EndFunc  ;==>DirtyBanditosTwo
Func DirtyBanditosThree()
   Run("C:\Programme\DirtyBanditos\Sacred Dark Fight Club.exe", "", @SW_MAXIMIZE)
   Sleep(1000)
EndFunc  ;==>DirtyBanditosThree
; ----------- Second DirtyBanditoskey -----------
Func DirtyBanditosFour()
   Run("C:\Programme\DirtyBanditos\Thc.exe", "", @SW_MAXIMIZE)
   Sleep(1000)
EndFunc  ;==>DirtyBanditosFour
Edited by Larry

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