how I can share information between methods? Topic is solved

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
User avatar
xMaxrayx
Posts: 220
Joined: 06 Dec 2022, 02:56
Contact:

how I can share information between methods?

Post by xMaxrayx » 16 May 2024, 05:38

I tried to use

Code: Select all

set => this.musicPlayer__PID := musicPlayer__PID
but it dosn't work

I want to share musicPlayer__PID

Code: Select all

class musicPlayer {

    musicPlayer__PID := unset


    static Call(path, enableLoop := false, loopTime := 0 ) {
        musicPlayer__PID := ""

        if enableLoop == false
            enableLoop := 0


        
        Run('"musicplayerV1.py"' ' "' path '"' ' "' enableLoop '"' ' "' loopTime '"' , ,  ,&musicPlayer__PID )
        
        this.musicPlayer__PID := musicPlayer__PID ;? dosn't work

        
        
        set => this.musicPlayer__PID := musicPlayer__PID
        


    }


    static close(Pid?) {
        if !IsSet(Pid){
            ProcessClose(this.musicPlayer__PID)
        }else{
            ProcessClose(Pid)
        }


    }

image.png
image.png (148.34 KiB) Viewed 159 times
-----------------------ヾ(•ω•`)o------------------------------
https://github.com/xmaxrayx/

User avatar
xMaxrayx
Posts: 220
Joined: 06 Dec 2022, 02:56
Contact:

Re: how I can share information between methods?  Topic is solved

Post by xMaxrayx » 16 May 2024, 12:28

ok I was stupid my mistake I didn't declare my class as object for my variable ,idk was stupid to spend 60 minutes for this lol

Code: Select all

test := musicPlayer()
test.start()


Code: Select all

test := musicPlayer()

test.start(str)
Sleep(5000)
test.close()




class musicPlayer {

    musicPlayer__PID := unset


    start(path, enableLoop := false, loopTime := 0 ) {
        musicPlayer__PID := ""
        if enableLoop == false
            enableLoop := 0

        ; this.musicPlayer__PID
        
        Run('"musicplayerV1.py"' ' "' path '"' ' "' enableLoop '"' ' "' loopTime '"' , ,  ,&musicPlayer__PID )
        
       
        
        
        this.musicPlayer__PID := musicPlayer__PID
        


    }


    close(Pid?) {
        if !IsSet(Pid){
            ProcessClose(this.musicPlayer__PID)
        }else{
            ProcessClose(Pid)
        }


    }


}

my old mistake

Code: Select all

test := musicPlayer.start(str)
-----------------------ヾ(•ω•`)o------------------------------
https://github.com/xmaxrayx/

Post Reply

Return to “Ask for Help (v2)”