compass テンプレートプログラム{ モード プログラム サイズ設定 600, 300 表示位置 右下 # 記録フォーム表示 左下 # 記録フォームサイズ設定 600, 300 } sub 初期設定{ } sub 停止時{ } 変数 $address = 1 #GPIBアドレス 変数 $port = "COM1" #RS232Cポート番号 変数 $result #受信文字列 変数 $wait = 2000 #待ち時間 変数 $repeat = 10 #繰り返し回数 変数 $x = 1 #変数 x 変数 $y = 2 #変数 y 変数 $z(0) = 1 #配列変数 z(0) 変数 $z(1) = 10 #配列変数 z(1) 変数 $z(2) = 100 #配列変数 z(2) 変数 $filename = "c:\test.bmp" #ファイル名 変数 $dirname = "fig" #フォルダ名 exe メインプログラム{ ■呼び出し サブルーチン # ■繰り返し サブルーチン, $wait, $repeat # ■条件付き呼び出し sub1, $x = 1, sub2 # ■条件付き呼び出し sub1, $port = "COM1", sub2 } exe サンプルプログラムを開く{ 実行 "ActiveCompass.exe", "SampleProgram.txt" } sub サブルーチン{ メッセージ "サブルーチンを呼び出しました。" # 入力 ($x) # テキスト入力 ($txt) # 計算 $y = ($x + 1) * 2 # 記録 $txt # 記録 "test" # 記録データ取得 ($txt) # 記録フォーム表示 右下 # 記録フォームクリア # 全変数記録 # ステータスバーに表示 $txt # 待機 $wait # クリック待機 # マウスイベント待機 # 一時停止 # 停止 # 再読み込み # 閉じる # 前面へ # メッセージ $x # メッセージ "Hello World!" # 実行 "ActiveCompass.exe" # 実行 "MSPAINT.EXE", "c:\test.bmp" # 最小化で実行 "ActiveCompass.exe" # 実行待機 "ActiveCompass.exe" # 実行待機 "MSPAINT.EXE", "c:\test.bmp" # 実行待機して結果を取得 ($result), "test.exe", $args # 結合 ($result) = $x & ":" & $y # 連結 ($txt), $txt1, "(CR)", $txt2, "(CR)" # 置換 ($txt), $from, $to # 抽出 ($txt), $target, $delimiter # 並べ替え昇順 ($txt), $delimiter # 並べ替え降順 ($txt), $delimiter # 行取得 ($txt), $delimiter, $line # 重複行の削除, ($txt), $target, $number # 時刻取得 ($txt) # ランダム値取得 ($x) # クリップボードに保存 $txt # クリップボードから取得 ($txt) # クリップボードの画像を保存 $dirname, $filename, $type # ※ type は "jpg", "bmp", "tif", "gif", "wmf", "png"から選択 # デスクトップの一部をクリップボードに保存 $width, $height, $left, $top # マウス座標取得 ($x), ($y) # マウスボタン状態取得 ($result) # マウスボタン状態取得番号 ($result) # RS232C.開始 $port, 9600, 8, 0, 0 # RS232C.開始 $port, $BaudRate, $ByteSize, $Parity, $StopBit # RS232C.開始 $port # RS232C.送信 "*TRG(CRLF)" # 待機 $wait # RS232C.受信 ($result) # RS232C.終了 # Serial.開始 $port, 9600, 8, 0, 0 # Serial.開始 $port, $BaudRate, $ByteSize, $Parity, $StopBit # Serial.開始 $port # Serial.送信 "*TRG(CRLF)" # 待機 $wait # Serial.受信 ($result) # Serial.終了 # GPIB.開始 $address # GPIB.送信 $address, "*TRG(CRLF)" # GPIB.受信 ($result), $address # GPIB.終了 $address # Excel起動 "panel.xlsm" # panel.セル内容の取得 ($result), "B3" # panel.セル内容の書込み "Hello World!", "D2" # panel.セル内容のクリア "D2:E5" # panel.セル内容の実行 "B4" # 右クリック $x, $y # 右クリック # 左クリック $x, $y # 左クリック # マウス移動 $x, $y # マウス移動スピード設定 $speed # ※$speedは1-5から選択 # クリック後にキー送信 $x, $y, $txt # ダブルクリック後にキー送信 $x, $y, $txt # ドラッグ $x1, $y1, $x2, $y2 # ドラッグ後にキー送信 $x1, $y1, $x2, $y2, $txt # トリガ送信 "192.168.0.2", 9000 # トリガ送信 "localhost", 9000 # トリガ待機 9000 # コマンド送信 "192.168.0.2", 9000, $cmd # コマンド送信 "localhost", 9000, $cmd # コマンド待機 ($cmd), 9000 # コマンド受信 ($cmd), "192.168.0.2", 9000 # Excel起動 "panel.xlsm" # cygwin.パス設定 "C:\cygwin\bin\bash.exe" # cygwin.実行 $cmd # cygwin.実行待機 $cmd # cygwin.Enter待ちで実行 $cmd # cygwin.Enter待ちで実行待機 $cmd # ファイル書き出し $txt, $filename # ファイル追加書き出し $txt, $filename # ファイル読み込み ($txt), $filename # 一覧取得 ($txt), $dirname # ファイル一覧取得 ($txt), $dirname # file.消去 $filename # file.コピー "c:\test.txt", "c:\test2.txt" # file.移動 "c:\test.txt", "c:\test2.txt" # 縦軸セット $bottom, $top # 横軸セット $left, $right # プロットモード設定 "y" # プロットモード設定 "log(y)" # プロットモード設定 "x/y" # プロットモード設定 "x/log(y)" # プロット $y # プロットサイズ設定 "0.2" # プロット "2,3,1,4,2" # プロット "1,2,3,4,5/2,3,1,4,2" # ブラウザを開く # ウェブページを開く $url # ブラウザを閉じる # ソースを取得 $url # ダウンロード $url } compass template_program{ mode program set_size 600, 300 display_position right_bottom # display_record_form left_bottom # set_record_form_size 600, 300 } sub initialize{ } sub when_stopped{ } variable $address = 1 #GPIB address variable $port = "COM1" #RS232C port number variable $result #received string variable $wait = 2000 #wait time variable $repeat = 10 #repeatation number variable $x = 1 #variable x variable $y = 2 #variable y variable $z(0) = 1 #variable z(0) variable $z(1) = 10 #variable z(1) variable $z(2) = 100 #variable z(2) variable $filename = "c:\test.bmp" #file name variable $dirname = "fig" #directory name exe main_program{ call subroutine # repeat subroutine, $wait, $repeat # call_if sub1, $x = 1, sub2 # call_if sub1, $port = "COM1", sub2 } exe open_panel.xlsm{ } sub subroutine{ message "Subroutine is called." # input ($x) # input_text ($txt) # calculation $y = ($x + 1) * 2 # record $txt # record "test" # get_record_data ($txt) # display_record_form right_bottom # record_form_clear # record_variables # show_to_statusbar $txt # wait $wait # wait_click # wait_mouse_event # break # stop # reload # close # bring_to_front # message $x # message "Hello World!" # execute "ActiveCompass.exe" # execute "MSPAINT.EXE", "c:\test.bmp" # execute_with_minimized_style "ActiveCompass.exe" # execute_and_wait "ActiveCompass.exe" # execute_and_wait "MSPAINT.EXE", "c:\test.bmp" # execute_and_get_result ($result), "test.exe", $args # combine ($result) = $x & ":" & $y # connect ($txt), $txt1, "(CR)", $txt2, "(CR)" # replace ($txt), $from, $to # extract ($txt), $target, $delimiter # sort_up ($txt), $delimiter # sort_down ($txt), $delimiter # get_line ($txt), $delimiter, $line # detele_overlap_line, ($txt), $target, $number # gettime ($txt) # get_random_value ($x) # save_to_clipboard $txt # get_from_clipboard ($txt) # save_image_from_clipboard $dirname, $filename, $type # ※ type should be chosen from "jpg", "bmp", "tif", "gif", "wmf", "png" # printscreenregion_to_clipboard $width, $height, $left, $top # get_mouse_position ($x), ($y) # get_mouse_button_state ($result) # get_mouse_button_number ($result) # RS232C.open $port, 9600, 8, 0, 0 # RS232C.open $port, $BaudRate, $ByteSize, $Parity, $StopBit # RS232C.open $port # RS232C.write "*TRG(CRLF)" # wait $wait # RS232C.read ($result) # RS232C.close # Serial.open $port, 9600, 8, 0, 0 # Serial.open $port, $BaudRate, $ByteSize, $Parity, $StopBit # Serial.open $port # Serial.write "*TRG(CRLF)" # wait $wait # Serial.read ($result) # Serial.close # GPIB.open $address # GPIB.write $address, "*TRG(CRLF)" # GPIB.read ($result), $address # GPIB.close $address # right_click $x, $y # right_click # left_click $x, $y # left_click # move_mouse $x, $y # set_mouse_move_speed $speed # ※select 1-5 for $speed # sendkeys_after_click $x, $y, $txt # sendkeys_after_doubleclick $x, $y, $txt # sendkeys_after_drag $x1, $y1, $x2, $y2, $txt # send_trigger "192.168.0.2", 9000 # send_trigger "localhost", 9000 # wait_trigger 9000 # send_command "192.168.0.2", 9000, $cmd # send_command "localhost", 9000, $cmd # wait_command ($cmd), 9000 # read_command ($cmd), "192.168.0.2", 9000 # open_excel "panel.xlsm" # cygwin.set_path "C:\cygwin\bin\bash.exe" # cygwin.execute $cmd # cygwin.execute_and_wait $cmd # cygwin.execute_with_enter_waiting $cmd # cygwin.execute_and_wait_enter $cmd # write_to_file $txt, $filename # write_append_to_file $txt, $filename # read_from_file ($txt), $filename # get_list ($txt), $dirname # get_filelist ($txt), $dirname # file.delete $filename # file.copy "c:\test.txt", "c:\test2.txt" # file.move "c:\test.txt", "c:\test2.txt" # set_y_axis $bottom, $top # set_x_axis $left, $right # set_plot_mode "y" # set_plot_mode "log(y)" # set_plot_mode "x/y" # set_plot_mode "x/log(y)" # plot $y # set_plot_size 0.2 # plot "2,3,1,4,2" # plot "1,2,3,4,5/2,3,1,4,2" # プロットサイズ設定 "0.2" # プロット "2,3,1,4,2" # プロット "1,2,3,4,5/2,3,1,4,2" # open_browser # open_webpage $url # close_browser # get_source $url # download $url }