Re: Application icons in Linux
Posted: Fri Jan 04, 2019 8:29 pm
... and here is the updated automatic version. Any and all feedback on either maker welcome
Questions and answers about the LiveCode platform.
https://forums.livecode.com/
Code: Select all
on pickExe
put shell("file *") into tmpExe
// find the executable file, if there is one...
if tmpExe is not empty then
repeat with x=1 to the number of lines of tmpExe
set the itemDelimiter to ":"
if matchChunk(line x of tmpExe, "LSB executable") then
put item 1 of line x of tmpExe into line x of tmpExe
else
put "" into line x of tmpExe
end if
end repeat
filter tmpExe without empty
end if
// put the possible executable files into tmpName...
put tmpExe into tmpName
set the itemDelimiter to slash // make sure we return this to / for the rest of the program...
// make sure there is only one line left in tmpName...
if tmpName is not "" then
if the number of lines of tmpName > 1 then
repeat for each line x in tmpName
add 1 to tmpLineNum
put tmpLineNum & " " & x before line tmpLineNum of tmpLine
end repeat
end if
ask question "Is one of the following the correct program?" & return & return & "Put the line number of the correct name below..." & return & return & tmpLine
if the result is "Cancel" then
exit to top
else
put the number of lines of tmpLine into tmpLineNum
repeat until (it > 0 and it <= tmpLineNum)
if it is not empty then // if the number entered is greater or less than the possible number of choices, then ask again for the right number...
ask question "Is one of the following the correct program?" & return & return & "Put the line number of the correct name below..." & return & return & tmpLine
if it is "" then
answer question "Would you like to quit?" with "Yes" or "No"
if it is "Yes" then exit to top
if it is "No" then answer question "Would you like to pick the executable manually?" with "Yes" or "No"
if it is "Yes" then answer file "Please select an executable..." with (tmpPath)
if it is "No" then exit to top
end if
end if
end repeat
breakpoint
// assume we have the right program...
put line it of tmpName into tmpName
end if
else
answer file "Unable to find an executable file..."
if it is not empty then
put it into tmpName
end if
end if
end pickExe
Code: Select all
on pickExe
// find the executable file, if there is one...
if tmpExe is not empty then
repeat with x=1 to the number of lines of tmpExe
set the itemDelimiter to ":"
if matchChunk(line x of tmpExe, "LSB executable") then
// "LSB executable" verifies it is not a .dll or .so file
put item 1 of line x of tmpExe into line x of tmpExe
else
put "" into line x of tmpExe
end if
end repeat
filter tmpExe without empty
// may be a problem with this as I still find empty in the last line...
if the number of lines of tmpExe > 1 then
put the number of lines of tmpExe into tmpNum
set the itemDelimiter to space
repeat with x=1 to tmpNum
put quote & line x of tmpExe & quote & space & "or" & space after tmpAnswer
end repeat
if the last item of tmpAnswer = "or" then delete the last item of tmpAnswer
put "answer" && quote & "Please choose one of the options below as the executable..." & quote && "with" && quote & "Cancel" & quote && "or" && tmpAnswer into tmpAnswer
// eliminate the need for the user to do anything other than click a button...
do tmpAnswer
if it is "Cancel" then
exit to top
else
put it into tmpExe
end if
end if
end if
end pickExe
Yes, when I come back to things I wrote years ago (or decades in some cases), I really wonder what I was thinking at the time. Thankfully my addddddddddd saves me from thinking about it overly long
Having Image Magick or Inkscape (which I'm also adding a test for) or not having either of them will make no difference in the end result of the program, which is to make a menu entry with whatever you have that qualifies (an executable and an acceptable icon). It will only affect what you see (or don't see) in the icon box