Run Post: Difference between revisions
From Macros Wiki
Jump to navigationJump to search
New page: ! Set post parameters, prompt user for post and<br> ! run the post to create code<br> <br> a1$ = "This macro will prompt for a post, set some"<br> a2$ = "post parameters and run the post t... |
No edit summary |
||
| Line 1: | Line 1: | ||
! Set post parameters, prompt user for post and | {| | ||
! run the post to create code | |! Set post parameters, prompt user for post and | ||
|- | |||
a1$ = "This macro will prompt for a post, set some" | |! run the post to create code | ||
a2$ = "post parameters and run the post to create code" | |- | ||
| | |||
message "%a1$\n%a2$" | |- | ||
|a1$ = "This macro will prompt for a post, set some" | |||
check part_open, "You must have a part open to run this macro" | |- | ||
|a2$ = "post parameters and run the post to create code" | |||
! create a file open dialog and get post filename | |- | ||
! ----------------------------------------------- | | | ||
|- | |||
file_dialog_new "Select Post" | |message "%a1$\n%a2$" | ||
file_dialog_extension "Post files (*.pst)", "pst" | |- | ||
file_dialog_show open, post_file$ | | | ||
|- | |||
! create a file save dialog and get code filename | |check part_open, "You must have a part open to run this macro" | ||
! ----------------------------------------------- | |- | ||
| | |||
file_dialog_new "Post Output File" | |- | ||
file_dialog_extension "All files (*.*)", "*" | |! create a file open dialog and get post filename | ||
file_dialog_show open, output_file$ | |- | ||
|! ----------------------------------------------- | |||
! get some post parameters | |- | ||
! ------------------------ | | | ||
|- | |||
get_post_data, start_prog_num, post_start_prog_num | |file_dialog_new "Select Post" | ||
get_post_data, seq_from, post_seq_from | |- | ||
get_post_data, seq_by, post_seq_by | |file_dialog_extension "Post files (*.pst)", "pst" | ||
|- | |||
a$ = "Original Post Parameters\n" | |file_dialog_show open, post_file$ | ||
|- | |||
b$ = "Start Program Number = " + format$(post_start_prog_num, "#####0") | | | ||
a$ = a$ + "\n" + b$ | |- | ||
|! create a file save dialog and get code filename | |||
b$ = "Sequence From = " + format$(post_seq_from, "#####0") | |- | ||
a$ = a$ + "\n" + b$ | |! ----------------------------------------------- | ||
|- | |||
b$ = "Sequence By = " + format$(post_seq_by, "#####0") | | | ||
a$ = a$ + "\n" + b$ | |- | ||
|file_dialog_new "Post Output File" | |||
! change these post parameters | |- | ||
! ---------------------------- | |file_dialog_extension "All files (*.*)", "*" | ||
|- | |||
set_post_data, start_prog_num, 1234 | |file_dialog_show open, output_file$ | ||
set_post_data, seq_from, 12 | |- | ||
set_post_data, seq_by, 15 | | | ||
|- | |||
! get them again, to show they have been changed | |! get some post parameters | ||
! ---------------------------------------------- | |- | ||
|! ------------------------ | |||
get_post_data, start_prog_num, post_start_prog_num | |- | ||
get_post_data, seq_from, post_seq_from | | | ||
get_post_data, seq_by, post_seq_by | |- | ||
|get_post_data, start_prog_num, post_start_prog_num | |||
b$ = "New Post Parameters\n" | |- | ||
a$ = a$ + "\n\n" + b$ | |get_post_data, seq_from, post_seq_from | ||
|- | |||
b$ = "Start Program Number = " + format$(post_start_prog_num, "#####0") | |get_post_data, seq_by, post_seq_by | ||
a$ = a$ + "\n" + b$ | |- | ||
| | |||
b$ = "Sequence From = " + format$(post_seq_from, "#####0") | |- | ||
a$ = a$ + "\n" + b$ | |a$ = "Original Post Parameters\n" | ||
|- | |||
b$ = "Sequence By = " + format$(post_seq_by, "#####0") | | | ||
a$ = a$ + "\n" + b$ | |- | ||
|b$ = "Start Program Number = " + format$(post_start_prog_num, "#####0") | |||
! run the post | |- | ||
! ------------ | |a$ = a$ + "\n" + b$ | ||
|- | |||
a$ = a$ + "\n\nOK to run the post?" | | | ||
yesno a$, iyesno | |- | ||
if iyesno = 0 then stop "Stopped without running post" | |b$ = "Sequence From = " + format$(post_seq_from, "#####0") | ||
|- | |||
set_post_data, post_file, post_file$ | |a$ = a$ + "\n" + b$ | ||
set_post_data, output_file, output_file$ | |- | ||
| | |||
run_post | |- | ||
|b$ = "Sequence By = " + format$(post_seq_by, "#####0") | |||
message "Finished - output file = %output_file$" | |- | ||
|a$ = a$ + "\n" + b$ | |||
yesno "View the output ?", iyesno | |- | ||
if iyesno = 0 then stop "Finished" | | | ||
|- | |||
run_exe "\Windows\System32\Notepad.exe", output_file$ | |! change these post parameters | ||
|- | |||
|! ---------------------------- | |||
|- | |||
| | |||
|- | |||
|set_post_data, start_prog_num, 1234 | |||
|- | |||
|set_post_data, seq_from, 12 | |||
|- | |||
|set_post_data, seq_by, 15 | |||
|- | |||
| | |||
|- | |||
|! get them again, to show they have been changed | |||
|- | |||
|! ---------------------------------------------- | |||
|- | |||
| | |||
|- | |||
|get_post_data, start_prog_num, post_start_prog_num | |||
|- | |||
|get_post_data, seq_from, post_seq_from | |||
|- | |||
|get_post_data, seq_by, post_seq_by | |||
|- | |||
| | |||
|- | |||
|b$ = "New Post Parameters\n" | |||
|- | |||
|a$ = a$ + "\n\n" + b$ | |||
|- | |||
| | |||
|- | |||
|b$ = "Start Program Number = " + format$(post_start_prog_num, "#####0") | |||
|- | |||
|a$ = a$ + "\n" + b$ | |||
|- | |||
| | |||
|- | |||
|b$ = "Sequence From = " + format$(post_seq_from, "#####0") | |||
|- | |||
|a$ = a$ + "\n" + b$ | |||
|- | |||
| | |||
|- | |||
|b$ = "Sequence By = " + format$(post_seq_by, "#####0") | |||
|- | |||
|a$ = a$ + "\n" + b$ | |||
|- | |||
| | |||
|- | |||
|! run the post | |||
|- | |||
|! ------------ | |||
|- | |||
| | |||
|- | |||
|a$ = a$ + "\n\nOK to run the post?" | |||
|- | |||
|yesno a$, iyesno | |||
|- | |||
|if iyesno = 0 then stop "Stopped without running post" | |||
|- | |||
| | |||
|- | |||
|set_post_data, post_file, post_file$ | |||
|- | |||
|set_post_data, output_file, output_file$ | |||
|- | |||
| | |||
|- | |||
|run_post | |||
|- | |||
| | |||
|- | |||
|message "Finished - output file = %output_file$" | |||
|- | |||
| | |||
|- | |||
|yesno "View the output ?", iyesno | |||
|- | |||
|if iyesno = 0 then stop "Finished" | |||
|- | |||
| | |||
|- | |||
|run_exe "\Windows\System32\Notepad.exe", output_file$ | |||
|} | |||
Latest revision as of 15:41, 29 July 2010
| ! Set post parameters, prompt user for post and |
| ! run the post to create code |
| a1$ = "This macro will prompt for a post, set some" |
| a2$ = "post parameters and run the post to create code" |
| message "%a1$\n%a2$" |
| check part_open, "You must have a part open to run this macro" |
| ! create a file open dialog and get post filename |
| ! ----------------------------------------------- |
| file_dialog_new "Select Post" |
| file_dialog_extension "Post files (*.pst)", "pst" |
| file_dialog_show open, post_file$ |
| ! create a file save dialog and get code filename |
| ! ----------------------------------------------- |
| file_dialog_new "Post Output File" |
| file_dialog_extension "All files (*.*)", "*" |
| file_dialog_show open, output_file$ |
| ! get some post parameters |
| ! ------------------------ |
| get_post_data, start_prog_num, post_start_prog_num |
| get_post_data, seq_from, post_seq_from |
| get_post_data, seq_by, post_seq_by |
| a$ = "Original Post Parameters\n" |
| b$ = "Start Program Number = " + format$(post_start_prog_num, "#####0") |
| a$ = a$ + "\n" + b$ |
| b$ = "Sequence From = " + format$(post_seq_from, "#####0") |
| a$ = a$ + "\n" + b$ |
| b$ = "Sequence By = " + format$(post_seq_by, "#####0") |
| a$ = a$ + "\n" + b$ |
| ! change these post parameters |
| ! ---------------------------- |
| set_post_data, start_prog_num, 1234 |
| set_post_data, seq_from, 12 |
| set_post_data, seq_by, 15 |
| ! get them again, to show they have been changed |
| ! ---------------------------------------------- |
| get_post_data, start_prog_num, post_start_prog_num |
| get_post_data, seq_from, post_seq_from |
| get_post_data, seq_by, post_seq_by |
| b$ = "New Post Parameters\n" |
| a$ = a$ + "\n\n" + b$ |
| b$ = "Start Program Number = " + format$(post_start_prog_num, "#####0") |
| a$ = a$ + "\n" + b$ |
| b$ = "Sequence From = " + format$(post_seq_from, "#####0") |
| a$ = a$ + "\n" + b$ |
| b$ = "Sequence By = " + format$(post_seq_by, "#####0") |
| a$ = a$ + "\n" + b$ |
| ! run the post |
| ! ------------ |
| a$ = a$ + "\n\nOK to run the post?" |
| yesno a$, iyesno |
| if iyesno = 0 then stop "Stopped without running post" |
| set_post_data, post_file, post_file$ |
| set_post_data, output_file, output_file$ |
| run_post |
| message "Finished - output file = %output_file$" |
| yesno "View the output ?", iyesno |
| if iyesno = 0 then stop "Finished" |
| run_exe "\Windows\System32\Notepad.exe", output_file$ |