3.1 Windows Utilities

3.1.1 clipboard

Loadable Function: clipboard ('copy', data)
Loadable Function: txt = clipboard ('paste')

Insert or get data from the clipboard.

’copy’ or ’paste’ is the required operation to perform. where ’copy’ will copy data to the clipboard, and paste will paste data from the clipboard to a variable.

data is the data to copy to the clipboard.

txt is the text from the clipboard or an empty string it it can not convert to text..

Examples:

Copy a string to the clipboard:

clipboard('copy', 'hello world');

Get a string from the clipboard:

txt = clipboard('paste');

3.1.2 grab

Loadable Function: [x,y] = grab (axis)

Grab positions of landmarks on the screen.

x is the x coordinates of the points.

y is the y coordinates of the points.

axis (optional) if specified then the first 2 clicks must be on the appropriate axes. x and y (or just x if only 2 points specified ) will then be normalised.

for example:

x=grab([1 10]) 

the first two clicks should correspond to x=1 and x=10 subsequent clicks will then be normalized to graph units.

for example:

[x,y]=grab; 

gives x and y in screen pixel units (upper left = 0,0 )

Select points by positioning the cursor over the points and clicking <SPACE>. ’q’ or <ESC> quits

3.1.3 win32_DeleteRegistry

Loadable Function: code = win32_DeleteRegistry (key, subkey, valuename)

Delete a value from the Windows registry.

Example:

key='test\\\\temp';
# create key
win32_WriteRegistry('HKLM',key,'test_value', 0)
# delete it
win32_DeleteRegistry('HKLM',key,'test_value')

key must be one of the following strings:

HKCR

HKEY_CLASSES_ROOT

HKCU

HKEY_CURRENT_USER

HKLM

HKEY_LOCAL_MACHINE

HKU

HKEY_USERS

subkey is the subkey to the registry value.

valuename is the name of the value to delete from the registry.

code is the success code. Values correspond to the codes in the winerror.h header file. The code of 0 is success, while other codes indicate failure

3.1.4 win32_MessageBox

Loadable Function: rv = win32_MessageBox (title, text)
Loadable Function: rv = win32_MessageBox (title, text, MboxType)

Display a message box using the win32 API.

title MessageBox title string

text MessageBox text string

MBoxType can be an integer or a string.

For integer values, consult <windows.h>

The following string values are recognized:

  • MB_OK
  • MB_OKCANCEL
  • MB_ABORTRETRYIGNORE
  • MB_YESNOCANCEL
  • MB_YESNO
  • MB_RETRYCANCEL

Default is MB_OK

Returns a value rv:

1

User Clicked OK

2

User Clicked Cancel

3

User Clicked Abort i

4

User Clicked Retry

5

User Clicked Ignore

6

User Clicked Yes

7

User Clicked No

10

User Clicked Try Again

11

User Clicked Continue

3.1.5 win32_ReadRegistry

Loadable Function: [ rv, code ] = win32_ReadRegistry (key, subkey, value)

Read a value from the Windows registry.

Example:

key='SOFTWARE\\\\Cygnus Solutions\\\\Cygwin\\\\mounts v2';
win32_ReadRegistry('HKLM',key,'cygdrive prefix')

key must be one of the following strings:

HKCR

HKEY_CLASSES_ROOT

HKCU

HKEY_CURRENT_USER

HKLM

HKEY_LOCAL_MACHINE

HKU

HKEY_USERS

rv is an octave string of the returned bytes. This is a natural format for REG_SZ data; however, if the registry data was in another format, REG_DWORD then the calling program will need to process them

code is the success code. Values correspond to the codes in the winerror.h header file. The code of 0 is success, while other codes indicate failure In the case of failure, ’rv’ will be empty

3.1.6 win32_RegEnumKey

Loadable Function: [ rv, code ] = win32_RegEnumKey (key, subkey)

Read the keys of a given subkey from the Windows registry.

Example:

key='SOFTWARE\\\\Cygnus Solutions\\\\Cygwin\\\\mounts v2';
win32_RegEnumKey('HKLM',key)

key must be one of the following strings:

HKCR

HKEY_CLASSES_ROOT

HKCU

HKEY_CURRENT_USER

HKLM

HKEY_LOCAL_MACHINE

HKU

HKEY_USERS

rv is an array of value strings for the name of keys for a given key and subkey.

code is the success code. Values correspond to the codes in the winerror.h header file. The code of 0 is success, while other codes indicate failure In the case of failure, ’rv’ will be empty

See also: winqueryreg.

3.1.7 win32_RegEnumValue

Loadable Function: [ rv, code ] = win32_RegEnumValue (key, subkey)

Read value names from from the Windows registry.

Example:

key='SOFTWARE\\\\Cygnus Solutions\\\\Cygwin\\\\mounts v2';
win32_RegEnumValue('HKLM',key)

key must be one of the following strings:

HKCR

HKEY_CLASSES_ROOT

HKCU

HKEY_CURRENT_USER

HKLM

HKEY_LOCAL_MACHINE

HKU

HKEY_USERS

rv is an array of value strings for the name of values for a given key and subkey.

code is the success code. Values correspond to the codes in the winerror.h header file. The code of 0 is success, while other codes indicate failure In the case of failure, ’rv’ will be empty

See also: winqueryreg.

3.1.8 win32_WriteRegistry

Loadable Function: code = win32_WriteRegistry (key, subkey, valuename, value)

Write a value to the Windows registry.

Example:

key='test\\\\temp';
win32_WriteRegistry('HKLM',key,'test_value', 0)

key must be one of the following strings:

HKCR

HKEY_CLASSES_ROOT

HKCU

HKEY_CURRENT_USER

HKLM

HKEY_LOCAL_MACHINE

HKU

HKEY_USERS

subkey is the subkey to the registry value.

valuename is the name of the value to write to the registry.

value is the value to write. It must be a a string or an integer value.

code is the success code. Values correspond to the codes in the winerror.h header file. The code of 0 is success, while other codes indicate failure

3.1.9 win32api

Loadable Function: rv = win32_MessageBox (title, text)
Loadable Function: rv = win32_MessageBox (title, text, MboxType)

Display a message box using the win32 API.

title MessageBox title string

text MessageBox text string

MBoxType can be an integer or a string.

For integer values, consult <windows.h>

The following string values are recognized:

  • MB_OK
  • MB_OKCANCEL
  • MB_ABORTRETRYIGNORE
  • MB_YESNOCANCEL
  • MB_YESNO
  • MB_RETRYCANCEL

Default is MB_OK

Returns a value rv:

1

User Clicked OK

2

User Clicked Cancel

3

User Clicked Abort i

4

User Clicked Retry

5

User Clicked Ignore

6

User Clicked Yes

7

User Clicked No

10

User Clicked Try Again

11

User Clicked Continue

3.1.10 winopen

Loadable Function: winopen (name)

Open the file or directory name in the windows registered application for the file, using shell open command.

Examples:

Open file document.docx in the docx viewer:

winopen ("document.docx");

Open the current directory in explorer:

winopen (pwd);