In magnetostatic and magnetodynamic problems, Ampere's law leads to a multivalued scalar magnetic potential. A method is proposed to calculate this potential through a finite elements program or, in a more efficient way, through a program using a boundary integral method in nonconducting exterior regions. In this case, one has only to define "cutting lines" on the boundary instead of cutting surfaces. Reported here are the results obtained with the three-dimensional eddy-current code Trifou, using the finite element method inside the conductors coupled with an integral method outside, in which the method has been incorporated, for a test model where some global values can be obtained by hand and compared with those obtained by the code. A study of the influence of mesh refinement and of the position of cutting lines is given. Good agreement and numerical stability indicate that the method is operational.