Jacqueline provided some nice infos for mobile debugging some time ago, and this gave me some ideas. So I'll provide my basic Android debugging tools here. They are raw, buggy & unpolished, but nevertheless they have proven quite useful rather often ;-)
Put this into your stack script:
Code: Select all
global gScript, gPath
-- Android debug handlers -- this part in stack script!
-- The basics are by Jacqueline Landman Gay | jacque at hyperactivesw dot com
-- Source: http://www.hyperactivesw.com/resources_mobiledebugging.html
-- axwald @ forums.livecode.com
-- global gScript must be declared!
on log pText
answer pText
end log
on errorDialog pErr
log " === ERROR: === " & CR & pErr
end errorDialog
-- Additions to android debug by axwald:
-- needed: button "do_btn" & its script!
on hCl -- clears the cmd hist
put empty into gScript
end hCl
on h -- a basic command history (h for "h"istory ...)
if the environment = "mobile" then
mobilepick gScript,1,"cancel" -- show the cmd hist for selection
if the result is not 0 then
send "DoIt" && the result to btn "Do_btn" -- and send the selection to the button
end if
else
answer information "This requires a mobile device ..." -- too lazy to implent for desktop ...
end if
end h
on DF what
-- shows information for 'the specialFolderPath's;
-- sets the DefaultFolder (hence the name ...) to a certain location,
-- and displays path, files and folders for this.
-- Comes handy to find your files ;-)
-- Using the form 'DF "/path/to/anywahere"' you can explore the whole filesystem
-- (Be sure to quote your paths then, and to omit the trailing slash!)
if (what = "?") OR (what = "man") then -- Help
answer "Check those folders contents:" & CR & CR & \
"C = Cache; D = Documents;" & CR & \
"E = Engine; ( F = Fonts; S = Sounds; )" & CR & \
"H = Home; R = Resources; T = Temporary" & CR & \
quote & "/mnt" & quote & " = /mnt/ => any path (quote path, omit ending slash!)." & CR & CR & \
"(Type " & quote & "DF " & quote & " & the part before '=' !)" titled " man DF"
exit DF
else if what = "C" then -- switch modes
put "Cache" into myVar
set the defaultfolder to specialfolderPath("cache") & slash
else if what = "D" then
put "Documents" into myVar
set the defaultfolder to specialfolderPath("documents") & slash
else if what = "E" then
put "Engine" into myVar
set the defaultfolder to specialfolderPath("engine") & slash
else if what = "F" then
put "Fonts" into myVar
set the defaultfolder to specialfolderPath("engine") & "/fonts/"
else if what = "S" then
put "Sounds" into myVar
set the defaultfolder to specialfolderPath("engine") & "/sounds/"
else if what = "H" then
put "Home" into myVar
set the defaultfolder to specialfolderPath("home") & slash
else if what = "R" then
put "Resources" into myVar
set the defaultfolder to specialfolderPath("resources") & slash
else if what = "T" then
put "Temporary" into myVar
set the defaultfolder to specialfolderPath("temporary") & slash
else
put "Custom Path" into myVar
set the defaultfolder to what & slash
end if
put the result into myRes
if myRes is not empty then -- check for errors
put "_CAUTION: the Result:" & CR & myRes & CR & CR into myRes
end if
put myRes & "_Mode: " & what & " | " & myVar & CR & \ -- build result data
"_Path resulting: " & CR & the defaultfolder & CR & CR & \
"_Files: ==========" & CR & the files & CR & CR & \
"_Folders: ==========" & CR & the folders & CR & CR & "_DF is resetted!" into myMsg
if not the environment = "mobile" then
set the clipboarddata["text"] to myMsg -- choose output mode
end if
set the defaultfolder to gPath
log myMsg -- and use it
end DF
Code: Select all
global gScript
-- android debugging handlers - this lives in your debugger button!
on mouseUp
DoIt
end mouseUp
on DoIt what
if what is not empty then -- it's called by "on h"/ stack script
put line what of gScript into myPrompt
else -- user found this button
put "h" into myPrompt
end if
ask "What shall I do?" & CR & "- 'log [param]' = 'answer/ put'; Expl: 'log the screenrect';" & CR & \
"- 'DF ?' = help for the 'specialFolder checker';" & CR & \
"On mobile only:" & CR & \
"- 'h' = use a basic command history;" & CR & \
"- 'hCl' = clears this cmd hist." with myPrompt titled "Debug helper"
if it is not empty then -- we got the new command
if gScript is empty then
put it into gScript
else -- store it
put CR & it after gScript
sort lines of gScript
gSClear
end if
try
do it -- and execute it
catch theError
answer "Couldn't execute this command:" & CR & " do " & it & CR & \
"Error received:" & CR & theError titled "This didn't work:"
end try
end if
end DoIt
on gSClear -- removes duplicate lines in the cmd hist
put gScript into MyVar
repeat with i = 1 to the number of lines of myVar
if line i+1 of myVar = line i of myVar then
delete line i+1 of myVar
end if
if line i of myVar is empty then exit repeat
end repeat
put myVar into gScript
end gSClear
- "DF ?" (DefaultFolderstuff ...) gives you an overview for the "FolderList" options. "DF d" for instance lists your documents folder. You may use this to check the whole Android file system ;-)
- "log" is a shortcut for "answer" - "log the screenrect" = "answer the screenrect". Use this to get the value of variables and properties (log the textstyle of fld head_fld) ...
- "h" gives you a history of the commands you have used in this session, sorted alphabetically, dupes removed.
Use it to select an old command & modify it (log the textstyle^^^^^^font of fld head_fld) ... - Feel free to add custom commands - just add a handler in the stack script.