
printing Commands to history (similar to the ToCommandLine operation)

andyfaff
ToCommandLine
operation sends command text to the command line without executing the command(s). However, sometimes you want command text to be printed into the history, from within a user function. You can use print
for this, but this doesn't appear as an issued command. For this to happen (such that you can press "up" to scroll between commands) you have to prefix the print with a special character. This character is different on windows and on Mac. The following function prints commands to the history, on Mac and Windows. It works on an English charset, not sure about others.Function cmdToHistory(cmd) // returns 0 if Macintosh, 1 if Windows string cmd String platform= UpperStr(igorinfo(2)) strswitch(platform) case "MACINTOSH": print num2char(-91) + cmd break case "WINDOWS": print num2char(-107)+cmd break endswitch End

Forum

Support

Gallery
Igor Pro 9
Learn More
Igor XOP Toolkit
Learn More
Igor NIDAQ Tools MX
Learn More