Jump to content
Sign in to follow this  
lordicast

Stacking Commands

Recommended Posts

lordicast

Here is my way of doing it im sure there are better ways but im not there yet. this func would be used to stack commands on each other through a single line such as commands line prompt or other input devise to save time using a semi colon as a seperator.

example: m1;m2;m3

On a input would call func's m1 then m2 and m3 rather then clicking button 1 then 2 and so on. Im open to suggestions.

PS. didnt see if there was one out there I just challenged myself to make one sorry for the sloppiness.

$input = InputBox("Command Line","")

stack($input)

Func Stack($TotalStr)

If StringInStr($TotalStr,';') = 0 Then
        call($TotalStr)
    Else
;=========================== my cheesey way find out how many commands are being Executed       
$dum = StringReplace($totalstr, ";", "-")
$num = @extended
Global $LinNum = $num + 1
;==========================================================================

;======= STRING LENGTH
$StrNum = StringLen($TotalStr)
;====== Find Inst

$l0 = StringInStr($TotalStr,';')
$l1 = StringInStr($TotalStr, ";", 0, 1) 
$l2 = StringInStr($TotalStr, ";", 0, 2)
$l3 = StringInStr($TotalStr, ";", 0, 3)
$l4 = StringInStr($TotalStr, ";", 0, 4)
$l5 = StringInStr($TotalStr, ";", 0, 5) 
$l6 = StringInStr($TotalStr, ";", 0, 6)
$l7 = StringInStr($TotalStr, ";", 0, 7)
;======= MATH TO FIND SEPERATIONS

$2ndInt = $l2 - $l1
$3rdInt = $l3 - $l2
$4thInt = $l4 - $l3
$5thInt = $l5 - $l4
$6thInt = $l6 - $l5
$7thInt = $l7 - $l6
$8thInt = $StrNum - $l7
;======== FIND COMMANDS

$1stInt = StringLeft($TotalStr,$l0)
$Str2 = StringMid($TotalStr,$l1,$2ndInt)
$Str3 = StringMid($TotalStr,$l2,$3rdInt)
$Str4 = StringMid($TotalStr,$l3,$4thInt)
$Str5 = StringMid($TotalStr,$l4,$5thInt)
$Str6 = StringMid($TotalStr,$l5,$6thInt)
$Str7 = StringMid($TotalStr,$l6,$7thInt)
$Str8 = StringMid($TotalStr,$l7,$8thInt+1)

;======== TRIM OFF ";" AND GIVES YOU FINAL VARIABLES

$FinStr1 = StringTrimRight($1stInt,1)
$FinStr2 = StringTrimLeft($Str2,1)
$FinStr3 = StringTrimLeft($Str3,1)
$FinStr4 = StringTrimLeft($Str4,1)
$FinStr5 = StringTrimLeft($Str5,1)
$FinStr6 = StringTrimLeft($Str6,1)
$FinStr7 = StringTrimLeft($Str7,1)
$FinStr8 = StringTrimLeft($Str8,1)
$CheckL = StringInStr($FinStr8,';')

;======= FINAL COMMANDS or FUNC
If $CheckL = 0 Then
    
call($FinStr1)
call($FinStr2)

if $Finstr3 = '' Then
    sleep(100)
Else
call($FinStr3)
EndIf
if $Finstr4 = '' Then
    sleep(100)
Else
call($FinStr4)
EndIf
if $Finstr5 = '' Then
    sleep(100)
Else
call($FinStr5)
EndIf
if $Finstr6 = '' Then
    sleep(100)
Else
call($FinStr6)
EndIf
if $Finstr7 = '' Then
    sleep(100)
Else
call($FinStr7)
EndIf
if $Finstr8 = '' Then
    sleep(100)
Else
call($FinStr8)
EndIf

Else
    
$Strip = StringLen($FinStr8)
$LaStr = $Strip - $CheckL +1
$lostA = StringRight($FinStr8,$LaStr)
$lost = StringTrimLeft($lostA,1)
$FinStr8a = StringTrimRight($FinStr8,$LaStr)

call($FinStr1)
call($FinStr2)

if $Finstr3 = '' Then
    sleep(100)
Else
call($FinStr3)
EndIf
if $Finstr4 = '' Then
    sleep(100)
Else
call($FinStr4)
EndIf
if $Finstr5 = '' Then
    sleep(100)
Else
call($FinStr5)
EndIf
if $Finstr6 = '' Then
    sleep(100)
Else
call($FinStr6)
EndIf
if $Finstr7 = '' Then
    sleep(100)
Else
call($FinStr7)
EndIf
if $Finstr8a = '' Then
    sleep(100)
Else
call($FinStr8a)
EndIf

EndIf

EndIf
;================
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= Debugging!
;if $LinNum > 8 Then
;$NumL = $LinNum - 8
;   MsgBox(0,'','You Executed: 8 Commands'&@CRLF&'Commands Aborted: '& $NumL)
;   MsgBox(0,'','Total Commands you entered '&$LinNum)
;   MsgBox(0,'','Commands not executed '&$lost)
;Else
;   If $LinNum = '' Then
;       $LinNum = 0
;   EndIf
;   MsgBox(0,'','You Executed: '&$LinNum&' Commands')
;EndIf
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
EndFunc     ;============ END

;EXAMPLE
Func m1()
    MsgBox(0,'','Message 1')
EndFunc
Func m2()
    MsgBox(0,'','Message 2')
EndFunc
Func m3()
    MsgBox(0,'','Message 3')
EndFunc
;end example

[Cheeky]Comment[/Cheeky]

Share this post


Link to post
Share on other sites
lordicast

LOL ^_^ it was cool while it lasted

thanks Valuater! All hail Valuater!

Edited by lordicast

[Cheeky]Comment[/Cheeky]

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.