Loading ...
Sorry, an error occurred while loading the content.

SubEthaEdit and (Apple)Script Debugger

Expand Messages
  • rvamerongen
    Hi, Since I did install Script debugger, SubEthaEdit stalls for a minute and then try to opens Script Debugger. If I remove it it give me a notice that
    Message 1 of 1 , Nov 22, 2012
    • 0 Attachment

      Since I did install Script debugger, SubEthaEdit stalls for a minute and then try to opens Script Debugger. If I remove it it give me a notice that SubEthaEdit cant find Script Debugger.

      Why? Who told SubEthaEdit to open Script Debugger?

      I did make a script, quickly for now, to compile C code for the MCU MSP430 chips.
      Also, if I select that script from the SubEthaEdit script menu, it stalls again and want to debug in Script debugger.

      If I run the script manually it works correct. The script is not the final script but if it doesn't work fine with SubEthaEdit, then I have to find another way/app?

      What is going on?

      My not finished script

      on seescriptsettings()

      return {displayName:"MSP430-builder", shortDisplayName:"Build", toolbarIcon:"ToolbarIconRunInTerminal", inDefaultToolbar:"yes", toolbarTooltip:"Build and Install this file into a MSP430 chip.", inContextMenu:"yes"}

      -- Here is a overview of currently supported settings
      -- displayName: Name displayed in menus
      -- shortDisplayName: The short display name used for Toolbar
      -- keyboardShortcut: A keyboard shortcut. alt=~, ctrl=^, shift=$, cmd=@
      -- toolbarIcon: A toolbar image
      -- inDefaultToolbar: Should be in default toolbar?
      -- toolbarTooltip: Tooltip for the toolbar icon
      -- inContextMenu: Should it appear in the ctrl-click menu?

      end seescriptsettings

      tell application "SubEthaEdit"
      if exists path of front document then
      save front document
      end try
      set mypath to path of front document
      set sourceFile to name of front document
      error "You have to save the document first"
      end if
      end tell

      set myFile to POSIX file mypath
      on error errMsg
      end try

      set fileName to GetFileWithoutExt(mypath)
      set parentPath to GetParentPath(myFile)
      set realParentPath to POSIX path of parentPath
      set MCU to "msp430g2231"
      set programElfName to realParentPath & "/" & fileName & "-" & MCU & ".elf"
      set shelscriptRemoveELF to "rm -f " & programElfName
      set shellscriptCompiler to "/usr/local/msp430-uniarch-20110716/bin/msp430-gcc -Os -Wall -g -mmcu=" & MCU & " -o '" & programElfName & "' '" & realParentPath & "/" & sourceFile & "'"
      set shellscriptBuilder to "/usr/local/bin/mspdebug rf2500 'prog " & programElfName & "'"
      -- set shellscriptBuilder to "echo q5491607 | sudo -u root /usr/local/bin/mspdebug rf2500 'prog " & programElfName & "'"
      --set totalScript to "cd " & quoted form of realParentPath & ";" & shellscriptCompiler & ";" & shellscriptBuilder

      --set the res1 to (do shell script totalScript with administrator privileges)

      --set the res2 to (do shell script "cd " & quoted form of realParentPath without altering line endings)
      --set the res3 to (do shell script shellscriptCompiler)
      --set the res4 to (do shell script shellscriptBuilder) -- with administrator privileges)

      tell application "Terminal"
      set newTab to do script
      set current settings of newTab to settings set "Grass"
      do script "bin/sh/ echo 'q5491607' | su;" in newTab
      do script "cd " & quoted form of realParentPath in newTab
      do script shelscriptRemoveELF in newTab
      do script shellscriptCompiler in newTab
      do script shellscriptBuilder in newTab
      end tell

      on GetParentPath(myFile)
      set oldDelimiters to AppleScript's text item delimiters
      set AppleScript's text item delimiters to {":"}
      set pathItems to text items of (myFile as text)
      set pathItems to items 1 thru -2 of pathItems
      set pathName to (pathItems as string)
      set AppleScript's text item delimiters to oldDelimiters
      return pathName
      end GetParentPath

      on GetFileWithoutExt(mypath)
      tell application "System Events" to tell disk item (mypath) to set {theName, theExtension} to {name, name extension}
      if theExtension is not "" then set theName to text 1 thru -((count theExtension) + 2) of theName -- the name part
      return theName
      end GetFileWithoutExt


      Anyone some ideas
    Your message has been successfully submitted and would be delivered to recipients shortly.