Advertisement
OldDragon2A

Upload ComputerCraft Program

Dec 16th, 2012
476
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; The turtle should be at the prompt in the directory you want the file added to.
  2. ; It will automatically name the files based on the filename being uploaded.
  3. ;
  4. ; ctrl+c - opens a dialog to upload a file
  5. ; ctrl+f - opens a dialog to upload all of the files in a folder
  6.  
  7. ^!c::
  8.   FileSelectFile, file, 1, , *.cc
  9.   if file =
  10.     return
  11.  
  12.   FileRead, code, *t %file%
  13.   if ErrorLevel
  14.   {
  15.     MsgBox, Unable to read file
  16.     return
  17.   }
  18.  
  19.   IfWinNotActive, Tekkit
  20.     WinActivate, Tekkit
  21.  
  22.   name := RegExReplace(file, ".*\\", "")
  23.   Send {Space 5}{Enter}rm %name%{Enter}edit %name%{Enter}
  24.   SendRaw %code%
  25.   Send {LCtrl}{Enter}
  26.   Send {LCtrl}{Right}{Enter}
  27. return
  28.  
  29. ^!f::
  30.   SendMode Event
  31.  
  32.   FileSelectFolder, dir
  33.   if ErrorLevel
  34.     return
  35.  
  36.   IfWinNotActive, Tekkit
  37.     WinActivate, Tekkit
  38.  
  39.   Loop, %dir%\*.*
  40.   {
  41.     FileRead, code, *t %A_LoopFileFullPath%
  42.     if ErrorLevel
  43.     {
  44.       MsgBox, Unable to read file
  45.       return
  46.     }
  47.  
  48.     Send {Space 5}{Enter}rm %A_LoopFileName%{Enter}edit %A_LoopFileName%{Enter}
  49.     SendRaw %code%
  50.     Send {LCtrl}{Enter}
  51.     Send {LCtrl}{Right}{Enter}
  52.   }
  53. return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement