Jump to content

Recommended Posts

Posted (edited)

I have this code, and I'm trying to fill the array , with files in a folder to create a list...I know I need to use "_FileListToArray" but I can't put the array into the menu...I know about the fish/net thing, but I'm really going crazy with so many codes...Give me a break please guys! My Project is almost done...Thank you very much! I'm learning a lot here!

 

func mobile()
    If _Metro_ToggleIsChecked($Togglechoose) Then
        Local $MenuButtonsArray[4] = ["Comando 1", "Comando 2", "Comando 3","Comando 4"]
        ; Open the rightclick Menu. See decleration of $MenuButtonsArray above.
        Local $MenuSelect = _Metro_RightClickMenu($Form1, 100, $MenuButtonsArray)
        Switch $MenuSelect ;Above function returns the index number of the selected button from the provided buttons array.
            Case "0"
                ConsoleWrite("Returned 0 = Button 1 clicked." & @CRLF)
            Case "1"
                ConsoleWrite("Returned 1 = Button 2 clicked." & @CRLF)
            Case "2"
                ConsoleWrite("Returned 2 = Button 3 clicked." & @CRLF)
            Case "3"
                ConsoleWrite("Returned 3 = Button 4 clicked." & @CRLF)
        EndSwitch
    Else
        Local $MenuButtonsArray[1] = ["Root"]
        ; Open the rightclick Menu. See decleration of $MenuButtonsArray above.
        Local $MenuSelect = _Metro_RightClickMenu($Form1, 100, $MenuButtonsArray)
        Switch $MenuSelect ;Above function returns the index number of the selected button from the provided buttons array.
            Case "0"
                ConsoleWrite("Returned 0 = Button 1 clicked." & @CRLF)
        EndSwitch
    EndIf
EndFunc

I just need to fill the array with the files names, and store the selected one to call him later...Thanks!

Edited by edumanilha
Posted

How can use this, the way the script are right now? Sorry Like I said I'm having headaches trying to do this thing...

And now I found a new problem trying to execute the .exes...Probably I'll need to open another topic, my desktop is full with tries...LOL...
 

 

Posted

What do you mean?  The following would be a 1d array of all files on your desktop, you just delete the first item which includes the file count and that's it.

Local $MenuButtonsArray = _FileListToArray(@DesktopDir, "*")
_ArrayDelete($MenuButtonsArray, 0) ;~ Delete the first item (file count).

 

Posted
20 minutes ago, Subz said:

What do you mean?  The following would be a 1d array of all files on your desktop, you just delete the first item which includes the file count and that's it.

Local $MenuButtonsArray = _FileListToArray(@DesktopDir, "*")
_ArrayDelete($MenuButtonsArray, 0) ;~ Delete the first item (file count).

 

Sorry...That's enought for today....I'm dizzy...KKKK

Thanks for your help! I'll try tomorrow! 

Posted
14 hours ago, Subz said:

What do you mean?  The following would be a 1d array of all files on your desktop, you just delete the first item which includes the file count and that's it.

Local $MenuButtonsArray = _FileListToArray(@DesktopDir, "*")
_ArrayDelete($MenuButtonsArray, 0) ;~ Delete the first item (file count).

 

Man.....Thank you very much! It works! 

Posted (edited)
On 2/18/2020 at 7:20 PM, Subz said:

What do you mean?  The following would be a 1d array of all files on your desktop, you just delete the first item which includes the file count and that's it.

Local $MenuButtonsArray = _FileListToArray(@DesktopDir, "*")
_ArrayDelete($MenuButtonsArray, 0) ;~ Delete the first item (file count).

 

This way, file list will fill the array, sort and erase the .txt part!

 

func mobile()
    If _Metro_ToggleIsChecked($Togglechoose) Then
        ;Local $MenuButtonsArray[4] = ["Comando 1", "Comando 2", "Comando 3","Comando 4"]
        Local $MenuButtonsArray = _FileListToArray(@ScriptDir & "\Dados\Comandos\", "*")
        _ArrayDelete($MenuButtonsArray, 0) ;~ Delete the first item (file count).
        _ArraySort($MenuButtonsArray)

        For $i = 0 To UBound($MenuButtonsArray) - 1
$MenuButtonsArray[$i] = StringRegExpReplace($MenuButtonsArray[$i], '^.*\\|\.[^.]*$', "")
        Next

        ; Open the rightclick Menu. See decleration of $MenuButtonsArray above.
        Local $MenuSelect = _Metro_RightClickMenu($Form1, 200, $MenuButtonsArray)
        Switch $MenuSelect ;Above function returns the index number of the selected button from the provided buttons array.
            Case "0"
                ConsoleWrite("Returned 0 = Button 1 clicked." & @CRLF)
            Case "1"
                ConsoleWrite("Returned 1 = Button 2 clicked." & @CRLF)
            Case "2"
                ConsoleWrite("Returned 2 = Button 3 clicked." & @CRLF)
            Case "3"
                ConsoleWrite("Returned 3 = Button 4 clicked." & @CRLF)
        EndSwitch
    Else
        Local $MenuButtonsArray[1] = ["Root"]
        ; Open the rightclick Menu. See decleration of $MenuButtonsArray above.
        Local $MenuSelect = _Metro_RightClickMenu($Form1, 100, $MenuButtonsArray)
        Switch $MenuSelect ;Above function returns the index number of the selected button from the provided buttons array.
            Case "0"
                    $CMD = @ScriptDir & "\Dados\putty.exe -ssh -pw password user@" & $Final
                    ;$iPID = Run(@ComSpec & " /c " & $CMD, @WindowsDir, @SW_ENABLE)
                    ;RunWait(@ComSpec & ' /c ' & @ScriptDir & "\Dados\putty.exe -ssh -pw riachuelo root@" & $Final)
                    ;ProcessClose("$iPID")
                    ShellExecute(@ScriptDir & "\Dados\putty.exe","-ssh -pw password user@" & $Final)
                    WinActivate("root@")
        EndSwitch
    EndIf
EndFunc

I realized that I'll have trouble with this part looking like this...

 

 

Edited by edumanilha
other topic

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...