set pathToScpt to path to me as text
set pathToScptPOSIX to POSIX file pathToScpt as string
-- i don't know where to go from here
So i was trying to have an applescript app do a shell script on other apps i put inside of it, but i want to edit the path to include backslashes as the application has spaces in it, and i want to keep spaces in it. I have also tried the trim_line subroutine but it didn’t work
set pathToScpt to path to me as text
set pathToScptPOSIX to POSIX file pathToScpt as string
display dialog pathToScptPOSIX
set shellScriptString to trim_line(pathToScptPOSIX, "(copy+paste of end part of result of display dialog pathToScpotPOSIX i wanted to get rid of)", 2)
display dialog pathToScptPOSIX
-- pathToScptPOSIX after being trimmed ends up being the same as pathToScptPOSIX before begin
on trim_line(this_text, trim_chars, trim_indicator)
set x to the length of the trim_chars
if the trim_indicator is in {0, 2} then
repeat while this_text begins with the trim_chars
try
set this_text to characters (x + 1) thru -1 of this_text as string
on error
return ""
end try
end repeat
end if
if the trim_indicator is in {1, 2} then
repeat while this_text ends with the trim_chars
try
set this_text to characters 1 thru -(x + 1) of this_text as string
on error
return ""
end try
end repeat
end if
return this_text
end trim_line