def run(self, Mml2vgmInfo, index): #設定値の読み込み Mml2vgmInfo.loadSetting() #初回のみ(設定値が無いときのみ)git.exeの場所をユーザーに問い合わせ、設定値として保存する gt = Mml2vgmInfo.getSettingValue("soxpath") if gt is None: gt = Mml2vgmInfo.fileSelect( "sox.exeを選択してください(この選択内容は設定値として保存され次回からの問い合わせはありません)") if not Mml2vgmInfo.confirm("sox.exeの場所は以下でよろしいですか\r\n" + gt): return None Mml2vgmInfo.setSettingValue("soxpath", gt) Mml2vgmInfo.saveSetting() #念のため if gt is None or gt == "": Mml2vgmInfo.msg("sox.exeを指定してください") return None #ファイル情報の整理 for fnf in Mml2vgmInfo.fileNamesFull: ext = Path.GetExtension(fnf) bas = Path.GetFileNameWithoutExtension(fnf) wp = Path.GetDirectoryName(fnf) Directory.SetCurrentDirectory(wp) si = ScriptInfo() # 引数を組み立てる if index == 0: args = "--i \"" + bas + ext + "\"" elif index == 1: # -b 8bit # -c 1 mono # -r 14k rate 14KHz args = bas + ext + " -b 8 -r 8k -c 1 " + bas + "_8k" + ext elif index == 2: args = bas + ext + " -r 14k -e signed-integer -c 1 " + bas + "_14k" + ext elif index == 3: args = bas + ext + " -r 16k -e signed-integer -c 1 " + bas + "_16k" + ext elif index == 4: args = bas + ext + " -r 18500 -e signed-integer -c 1 " + bas + "_18500" + ext ret = Mml2vgmInfo.runCommand(gt, args, True) if ret != "": Mml2vgmInfo.msg(ret) else: if index != 0: Mml2vgmInfo.msg("success") Mml2vgmInfo.refreshFolderTreeView() return si
def run(self, Mml2vgmInfo, index): #設定値の読み込み Mml2vgmInfo.loadSetting() #初回のみ(設定値が無いときのみ)mucom88.exeの場所をユーザーに問い合わせ、設定値として保存する mc = Mml2vgmInfo.getSettingValue("mucom88path") if mc is None: mc = Mml2vgmInfo.fileSelect( "mucom88.exeを選択してください(この選択内容は設定値として保存され次回からの問い合わせはありません)") if not Mml2vgmInfo.confirm("mucom88.exeの場所は以下でよろしいですか\r\n" + mc): return None Mml2vgmInfo.setSettingValue("mucom88path", mc) Mml2vgmInfo.saveSetting() #念のため if mc is None or mc == "": Mml2vgmInfo.msg("mucom88.exeを指定してください") return None #ファイル選択 muc = Mml2vgmInfo.fileSelect("mucファイルの選択") if muc is None: return None #ファイル情報の整理 #Mml2vgmInfo.msgLogWindow(muc) wp = Path.GetDirectoryName(muc) #Mml2vgmInfo.msgLogWindow(wp) Directory.SetCurrentDirectory(wp) #mucom88.exeでコンパイルを行いmubファイルを生成する args = "-c " + muc Mml2vgmInfo.runCommand(mc, args, True) #mubファイルが出来たかチェック(mucom88.exeはコンパイルが成功するとmucom88.mubというファイルができる) mm = Path.Combine(wp, "mucom88.mub") #Mml2vgmInfo.msgLogWindow(mm) if not File.Exists(mm): return None #mucom88.mubを本来のファイル名にリネーム mub = Path.Combine(wp, Path.GetFileNameWithoutExtension(muc) + ".mub") #Mml2vgmInfo.msgLogWindow(mub) File.Delete(mub) File.Move(mm, mub) #mucom88.exeで演奏を開始 Mml2vgmInfo.runCommand(mc, mub, False) #戻り値を生成(何もしないけど念のため) si = ScriptInfo() si.responseMessage = "" return si
def run(self, Mml2vgmInfo, index): #設定値の読み込み Mml2vgmInfo.loadSetting() #初回のみ(設定値が無いときのみ)sox.exeの場所をユーザーに問い合わせ、設定値として保存する gt = Mml2vgmInfo.getSettingValue("soxpath") if gt is None: gt = Mml2vgmInfo.fileSelect( "sox.exeを選択してください(この選択内容は設定値として保存され次回からの問い合わせはありません)") if not Mml2vgmInfo.confirm("sox.exeの場所は以下でよろしいですか\r\n" + gt): return None Mml2vgmInfo.setSettingValue("soxpath", gt) Mml2vgmInfo.saveSetting() #念のため if gt is None or gt == "": Mml2vgmInfo.msg("sox.exeを指定してください") return None #ファイル情報の整理 for fnf in Mml2vgmInfo.fileNamesFull: ext = Path.GetExtension(fnf) bas = Path.GetFileNameWithoutExtension(fnf) wp = Path.GetDirectoryName(fnf) Directory.SetCurrentDirectory(wp) si = ScriptInfo() argList = [ "--i \"{0}{1}\"", "\"{0}{1}\" -r 8000 -b 8 -c 1 \"{0}_8k{1}\"", "\"{0}{1}\" -r 14000 -b 8 -c 1 \"{0}_14k{1}\"", "\"{0}{1}\" -r 16000 -b 8 -c 1 \"{0}_16k{1}\"", "\"{0}{1}\" -r 18500 -b 8 -c 1 \"{0}_18500{1}\"", "\"{0}{1}\" -b 16 -r 14000 -e signed-integer -c 1 \"{0}_16b_14k{1}\"", "\"{0}{1}\" -b 16 -r 16000 -e signed-integer -c 1 \"{0}_16b_16k{1}\"", "\"{0}{1}\" -b 16 -r 18500 -e signed-integer -c 1 \"{0}_16b_18500{1}\"", "\"{0}{1}\" -n trim 0 1.5 noiseprof \"{0}.noise-profile\"", "\"{0}{1}\" \"{0}_cleaned{1}\" noisered \"{0}.noise-profile\" 0.2 " ] args = argList[index].format(bas, ext) ret = Mml2vgmInfo.runCommand(gt, args, True) if ret != "": Mml2vgmInfo.msg(ret) else: if index != 0: Mml2vgmInfo.msg("success") Mml2vgmInfo.refreshFolderTreeView() return si
def setUp(): ''' Sets up the DLLs directory. ''' #if it exists, we cannot continue because we will #not have the correct permissions to move/remove the #DLLs directory if Directory.Exists(DLLS_DIR): print "ERROR - cannot test anything with a pre-existing DLLs directory" raise Exception( "Cannot move/delete DLLs which is being used by this process!") Directory.CreateDirectory(DLLS_DIR) File.Copy(IP_DIR + "\\IronPython.dll", DLLS_DIR + "\\IronPython.dll") Directory.SetCurrentDirectory(DLLS_DIR) #create a number of "normal" assemblies okAssemblies(50) #create 5 assemblies in the fooFIVE namespace with nearly #identical contents dupAssemblies(5) #recreate the sys module overrideNative() #ensure corrupt DLLs cannot work corruptDLL() #ensure unmanaged DLLs don't break it unmanagedDLL() #create an exe and a DLL competing for the same #namespace dllVsExe() #create an exe in it's own namespace exeOnly() #create a DLL that's really a *.txt and #create a *.txt that's really a DLL textFiles() #creates "unique" DLL names that should be loadable #by IP uniqueDLLNames() #cleanup after ourselves File.Delete(DLLS_DIR + "\\IronPython.dll")
def run(self, Mml2vgmInfo, index): #設定値の読み込み Mml2vgmInfo.loadSetting() #初回のみ(設定値が無いときのみ)git.exeの場所をユーザーに問い合わせ、設定値として保存する gt = Mml2vgmInfo.getSettingValue("gitpath") if gt is None: gt = Mml2vgmInfo.fileSelect( "git.exeを選択してください(この選択内容は設定値として保存され次回からの問い合わせはありません)") if not Mml2vgmInfo.confirm("git.exeの場所は以下でよろしいですか\r\n" + gt): return None Mml2vgmInfo.setSettingValue("gitpath", gt) Mml2vgmInfo.saveSetting() #念のため if gt is None or gt == "": Mml2vgmInfo.msg("git.exeを指定してください") return None si = ScriptInfo() commitMsg = "" if index == 1: #git コミット commitMsg = Mml2vgmInfo.inputBox("コミット時のコメントを入力してください") if commitMsg == "": return si #ファイル情報の整理 for fnf in Mml2vgmInfo.fileNamesFull: wp = Path.GetDirectoryName(fnf) Directory.SetCurrentDirectory(wp) if index == 0: #git ステージング args = "add " + fnf ret = Mml2vgmInfo.runCommand(gt, args, True) if ret != "": Mml2vgmInfo.msg(ret) else: #git コミット args = "commit -m\"" + commitMsg + "\"" ret = Mml2vgmInfo.runCommand(gt, args, True) if ret != "": Mml2vgmInfo.msg(ret) return si
def main(): ''' Runs the test by spawning off another IP process which utilizes the newly created DLLs directory. ''' try: setUp() Directory.SetCurrentDirectory(ORIG_DIR) from iptest.process_util import launch_ironpython_changing_extensions ret_val = launch_ironpython_changing_extensions("dllsite.py", add=["-S"], additionalScriptParams=("OKtoRun",)) finally: cleanUp() exit(ret_val)
import clr import sys from System.IO import Directory, Path x86path = r'C:\Program Files\Resolver One\bin' x64path = r'C:\Program Files (x86)\Resolver One\bin' if Directory.Exists(x86path): topLevel = Path.GetDirectoryName(x86path) bin = x86path else: topLevel = Path.GetDirectoryName(x64path) bin = x64path Directory.SetCurrentDirectory(topLevel) sys.path.extend((topLevel, bin)) # This adds references to all .NET assemblies # that Resolver One spreadsheets use clr.AddReference('TopLevel') import LoadAssemblies LoadAssemblies.binDir = bin import LoadRequiredAssemblies # Needed to configure caches from MarketData import Bloomberg, Thomson from Library.Workbook import Workbook from Library.ContextDependent import MakeContextDependentFunctions
closeButton.IsDefault = True if CultureInfo.CurrentCulture.Equals( CultureInfo.GetCultureInfo("ja-JP")): closeButton.Content = "閉じる" else: closeButton.Content = "Close" closeButton.Click += onCloseClick border.Child = closeButton window.Show() Task.Factory.StartNew(onValidate).ContinueWith(onCompleted, context) Directory.SetCurrentDirectory(currentDirectory) def onStart(s, e): global menuItem, separator for window in Application.Current.Windows: if window is Application.Current.MainWindow and window.ContextMenu is not None: if not window.ContextMenu.Items.Contains(menuItem): menuItem.Click += onClick window.ContextMenu.Items.Insert( window.ContextMenu.Items.Count - 4, menuItem) if not clr.GetClrType(Separator).IsInstanceOfType( window.ContextMenu.Items[10]): separator = Separator()
# import this to load the correct standard library # As a side effect it changes directory from runworkbook import RunWorkbook # Needed for unittest - not shipped with Resolver One import sys sys.path.append(r'C:\Python25\Lib') import unittest from System.Drawing import Color from Library.CellRange import CellRange from Library.Worksheet import Worksheet Directory.SetCurrentDirectory(this_dir) spreadsheet_path = Path.Combine(this_dir, 'TestableSheet.rsl') class TestableSheetTest(unittest.TestCase): def testWorksheets(self): workbook = RunWorkbook(spreadsheet_path, useCache=True) worksheets = [sheet.Name for sheet in workbook] self.assertEquals(worksheets, ['Data'], "Incorrect worksheets in spreadsheet") def testBasicSpreadsheetConfiguration(self): workbook = RunWorkbook(spreadsheet_path, useCache=True) self.assertTrue(workbook['Data'].ShowBounds, "Data.ShowBounds is not set to True")
# IronPython imports to enable Excel interop, import clr clr.AddReference("Microsoft.Office.Interop.Excel") import Microsoft.Office.Interop.Excel as Excel from System.Runtime.InteropServices import Marshal # import system things needed below from System.IO import Directory, Path from System import DateTime # use the ANSYS function GetProjectDirectory to figure out what directory you are in # and set that to the current directory projDir = GetProjectDirectory() Directory.SetCurrentDirectory(projDir) # Open up a log file to put useful information in logFile = open("TowerTool.log", "w") # Put a header in the log file logFile.write("================================================\n") logFile.write("Tower Tool Run Log File\n") logFile.write("================================================\n") logFile.write("Start time: " + DateTime.Now.ToString('yyyy-mm-dd hh:mm:ss') + "\n") logFile.write("Proj Dir: %s\n\n" % projDir) # Use the Excel GetActiveObject funtion to get the object for the excel session ex = Marshal.GetActiveObject("Excel.Application") # Make Excel visible ex.Visible = True # Define the active workbook and worksheet